本文整理汇总了C#中DAO类的典型用法代码示例。如果您正苦于以下问题:C# DAO类的具体用法?C# DAO怎么用?C# DAO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DAO类属于命名空间,在下文中一共展示了DAO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddOL_Singole
/// <summary>
/// 添加单条记录
/// </summary>
/// <param name="myDAOOL">DAO.Outoflibrary</param>
/// <returns>bool</returns>
public bool AddOL_Singole(DAO.Outoflibrary myDAOOL)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into db_Storage (");
strSql.Append("ol_ckid,ol_gsid,ol_num,ol_quantity,ol_dw,ol_dj,ol_yshk,ol_sshk,ol_khid,ol_zd_mgid,ol_yh_mgid,ol_shy,ol_price,ol_date,ol_sh_mgid,ol_status,ol_note");
strSql.Append(")values(");
strSql.Append("'" + myDAOOL.OLckid + "',");
strSql.Append("'" + myDAOOL.OLgsid + "',");
strSql.Append("'" + myDAOOL.OLnum + "',");
strSql.Append("" + myDAOOL.OLquantity + ",");
strSql.Append("'" + myDAOOL.OLDW + "',");
strSql.Append("'" + myDAOOL.OLDJ + "',");
strSql.Append("'" + myDAOOL.OLYSHK + "',");
strSql.Append("'" + myDAOOL.OLSSHK + "',");
strSql.Append("'" + myDAOOL.OLKHID + "',");
strSql.Append("'" + myDAOOL.OLZDMGid + "',");
strSql.Append("'" + myDAOOL.OLYHMGid + "',");
strSql.Append("'" + myDAOOL.OLSHY + "',");
strSql.Append("'" + myDAOOL.OLprice + "',");
strSql.Append("'" + myDAOOL.OLdate + "',");
strSql.Append("'" + myDAOOL.OLSHMGid + "',");
strSql.Append("'" + myDAOOL.OLstatus + "',");
strSql.Append("'" + myDAOOL.OLnote + "')");
int count = DBHelperSQL.ExecuteSql(strSql.ToString());
//判断是否成功添加记录
if (count == 1)
{ return true; }
else
{ return false; }
}
示例2: login
public string login(DAO.Login aLogin)
{
try
{
{
aSqlConnection.Open();
SqlCommand cmd = new SqlCommand("uspLogin",aSqlConnection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@userName", aLogin.userName);
cmd.Parameters.AddWithValue("@password", aLogin.password);
SqlDataReader sdr = cmd.ExecuteReader();
if (sdr.Read())
{
return "Yes";
}
}
}
catch (Exception e)
{
throw new Exception(e.Message);
}
finally
{
if (aSqlConnection != null && aSqlConnection.State == ConnectionState.Open)
{
aSqlConnection.Close();
}
}
return "Sorry,try again";
}
示例3: ComposeInsertLogString
/// <summary>
/// 取得新增的log字串
/// </summary>
/// <param name="rec"></param>
/// <param name="studentNumber"></param>
/// <returns></returns>
public string ComposeInsertLogString(DAO.ResultScoreRecord rec, string studentNumber)
{
StringBuilder sb = new StringBuilder();
sb.Append(Global._ColScholYear).Append("「").Append(rec.SchoolYear).Append("」");
sb.Append(Global._ColSemester).Append("「").Append(rec.Semester).Append("」");
sb.Append(Global._ColClubName).Append("「").Append(rec.ClubName).Append("」");
sb.Append(Global.NewLine);
sb.Append(Global._ColStudentNumber).Append("「").Append(studentNumber).Append("」");
sb.Append(Global.NewLine);
if (rec.ResultScore.HasValue)
{
sb.Append(Global._ColClubScore).Append("「").Append(rec.ResultScore.Value).Append("」");
sb.Append(Global.NewLine);
}
else
{
sb.Append(Global._ColClubScore).Append("「").Append("」");
sb.Append(Global.NewLine);
}
sb.Append(Global._ColCadreName).Append("「").Append(rec.CadreName).Append("」");
sb.Append(Global.NewLine);
return sb.ToString();
}
示例4: ListarGeral
/// <summary>
/// Método que lista todas os fornecedores.
/// </summary>
/// <param name="listSession">Sessão do Hibernate sendo utilizada.</param>
/// <param name="todos">Se a listagem for de fornecedores ativos e inativos, coloque 'true'.</param>
/// <param name="strings">Adicione Strings que serão postas na mesma coleção da consulta.</param>
/// <returns>IList</returns>
public static IList<Fornecedor> ListarGeral(ISession listSession, Boolean todos, params string[] strings)
{
try
{
IList<Fornecedor> ilista = null;
if (todos)
{
ilista = new DAO<Fornecedor>(listSession).Listar();
}
else
{
ilista = new DAO<Fornecedor>(listSession).ListarWhere("ativo", true);
}
for (var i = 0; i < strings.Count(); i++)
{
ilista.Insert(i, new Fornecedor {nome = strings[i], idFornecedor = i});
}
return ilista;
}
catch (GenericADOException gae)
{
MessageLogs.GenericADOExceptionLog(gae);
return null;
}
catch (TransactionException te)
{
MessageLogs.TransactionExceptionLog(te);
return null;
}
}
示例5: btnDeal_Click
//受理
protected void btnDeal_Click(object sender, EventArgs e)
{
TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
TPortalClass.JpAdver JpAdver = new TPortalClass.JpAdver();
string ls_tip = "受理成功!";
for (int i = 0; i < rptList.Items.Count; i++)
{
string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value;
CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
if (cb.Checked)
{
TPortalClass.DAO db = new DAO();
string sql = "update hy_help set hy_ifsh=1 where id=" + int.Parse(id) + "";
db.Execute(sql);
}
}
string pageUrl = JpCommon.CombUrlTxt("list_help_sh.aspx", "page={0}&rnd={1}",
"" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + "");
//写系统日志
string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (userip == null || userip == "")
{
userip = Request.ServerVariables["REMOTE_ADDR"];
}
JpCommon.WriteLog(userip, "审核", "批量受理帮办记录", Session["uid"].ToString(), Session["uname"].ToString());
Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>");
}
示例6: EstoqueForm
public EstoqueForm()
{
InitializeComponent();
DAOEstoque = new DAOEstoque(listSession);
DAOLoja = new DAO<Loja>(listSession);
pesquisaEstoqueStrategy = new PesquisaEstoqueStrategy(new PesquisaEstoqueGeral(listSession));
}
示例7: StudCareRecordAddItemForm
public StudCareRecordAddItemForm(List<string> itemList,DAO.CareRecordItemManager.ItemType itmType)
{
InitializeComponent();
this.MaximumSize = this.MinimumSize = this.Size;
_itemList = itemList;
_itemType = itmType;
}
示例8: AddST_Singole
/// <summary>
/// 添加单条入库单记录
/// </summary>
/// <param name="myDAOST"></param>
/// <returns>bool</returns>
public bool AddST_Singole(DAO.Storage myDAOST)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into db_Storage (");
strSql.Append("st_num,st_ckid,ST_gsid,st_rk_mgid,st_yh_mgid,st_khid,st_quantity,st_dw,st_dj,st_price,st_date,st_note,st_status");
strSql.Append(")values(");
strSql.Append("'" + myDAOST.STnum + "',");
strSql.Append("'" + myDAOST.STckid + "',");
strSql.Append("'" + myDAOST.STgsid + "',");
strSql.Append("'" + myDAOST.STRK_MGid + "',");
strSql.Append("'" + myDAOST.STYH_MGid + "',");
strSql.Append("'" + myDAOST.STKHid + "',");
strSql.Append("'" + myDAOST.STquantity + "',");
strSql.Append("'" + myDAOST.STDW + "',");
strSql.Append("'" + myDAOST.STDJ + "',");
strSql.Append("'" + myDAOST.STprice + "',");
strSql.Append("'" + myDAOST.STdate + "',");
strSql.Append("'" + myDAOST.STnote + "',");
strSql.Append("'" + myDAOST.STstatus + "')");
int count = DBHelperSQL.ExecuteSql(strSql.ToString());
//判断是否成功添加记录
if (count == 1)
{ return true; }
else
{ return false; }
}
示例9: updatePassword
internal string updatePassword(DAO.Login aLogin, string newPassword)
{
try
{
aSqlConnection.Open();
SqlCommand command = new SqlCommand("USPPasswordUpdation", aSqlConnection);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@password", newPassword);
command.Parameters.AddWithValue("@userName", aLogin.userName);
int effectedRows = command.ExecuteNonQuery();
if (effectedRows > 0)
{
return "Password is updated";
}
}
catch (Exception e)
{
throw new Exception(e.Message);
}
finally
{
if (aSqlConnection != null && aSqlConnection.State == ConnectionState.Open)
{
aSqlConnection.Close();
}
}
return "Error while updating password.";
}
示例10: DatabaseHelper
public DatabaseHelper(DBConfig dbconfig)
{
this.dbconfig = dbconfig;
RowsInsert = new ConcurrentQueue<String>();
this.msgInserting = "";
this.dao = getDataBaseDAO();
skip = true;
databases.Add(mysql);
}
示例11: equalsStock
/// <summary>
/// 判断指定仓库的指定物品是否存在
/// </summary>
/// <param name="myDAOSK">DAO.Stock</param>
/// <returns>bool</returns>
public bool equalsStock(DAO.Stock myDAOSK)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select * from db_stock where sk_ck_id=" + myDAOSK.SKCKid + " and sk_gs_id=" + myDAOSK.SKGSid);
DataSet ds = DBHelperSQL.Query(strSql.ToString());
if (ds.Tables[0].Rows.Count == 1)
{ return true; }
else
{ return false; }
}
示例12: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Response.CacheControl = "no-cache";
string ls_update = "";
string ls_filename = "";
string ls_path = "";
string ls_id = Request.Form["id"].ToString();
//string lshy_fatherfield = Request.Form["txtcurloginuserid"].ToString();
//string lshy_fatherid = Request.Form["fatherid"].ToString();
//string hy_userid = Request.Form["userid"].ToString();
//Request.Params["fatherid"].ToString()+"\\"+Request.Params["fatherfield"].ToString();
//string Datedir = DateTime.Now.ToString("yy-MM-dd");
//string updir = s_rpath + "\\" + Datedir;
//string updir = s_rpath;
if (Request.Files["file"].ContentLength > 0)
{
try
{
string updir = Server.MapPath("~/") + "upload\\original\\rytx\\";
DAO db = new DAO();
DataTable dt = new DataTable();
HttpPostedFile uploadFile = Request.Files["file"];
//if (uploadFile.ContentLength > 0)
//{
if (!Directory.Exists(updir))
{
Directory.CreateDirectory(updir);
}
//string extname = Path.GetExtension(uploadFile.FileName);
//string filename = uploadFile.FileName;
//lsfilename = filename;
//lsurl = "fileatt\\" + filename; //存放的文件夹
//uploadFile.SaveAs(string.Format("{0}\\{1}", updir, filename));
ls_filename = ls_id + ".jpg";
uploadFile.SaveAs(updir + ls_filename);
ls_path = "upload\\original\\rytx\\" + ls_filename;
string sql_user = "update hy_user set hy_pic='" + ls_path + "' ";
sql_user += " where hy_id='" + ls_id + "'";
db.Execute(sql_user);
//}
}
catch (Exception ex)
{
Response.Write("Message"+ ex.ToString());
}
}
}
示例13: GerenciarPermissoesEmFormulario
public GerenciarPermissoesEmFormulario(Form formulario)
{
InitializeComponent();
this.formulario = formulario;
DAOPermissoes = new DAO<Permissoes>(MySQLSession);
DAOFormularioMySQL = new DAO<Formulario>(MySQLSession);
DAOControlMySQL = new DAO<ControlTable>(MySQLSession);
DAOControlSQLServer = new DAO<ControlTable>(SQLServerSession);
DAOFormularioSQLServer = new DAO<Formulario>(SQLServerSession);
}
示例14: AlteraPermissaoGerenciarPermissoes
public AlteraPermissaoGerenciarPermissoes(ControlTable control)
{
InitializeComponent();
this.control = control;
lblControleSendoAlterado.Text += this.control.nome;
lblPermissaoAtual.Text += this.control.permissoes.nome;
DAOPermissoesMySQL = new DAO<Permissoes>(MySQLSession);
DAOControlMySQL = new DAO<ControlTable>(MySQLSession);
DAOControlSQLServer = new DAO<ControlTable>(SQLServerSession);
}
示例15: AddSK_bool
/// <summary>
/// 添加记录
/// </summary>
/// <param name="myDAOSK">DAO.Stock</param>
/// <returns>bool</returns>
public bool AddSK_bool(DAO.Stock myDAOSK)
{
DataSet ds = mySM.SelectStock(myDAOSK.SKCKid, myDAOSK.SKGSid);
if (ds.Tables[0].Rows.Count > 0)
{
myDAOSK.SKquantity += int.Parse(ds.Tables[0].Rows[0]["sk_quantity"].ToString());
return mySM.UpdateSK(myDAOSK);
}
else
{
return mySM.AddSK(myDAOSK);
}
}