• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# DAO类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DAO的典型用法代码示例。如果您正苦于以下问题:C# DAO类的具体用法?C# DAO怎么用?C# DAO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DAO类属于命名空间,在下文中一共展示了DAO类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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; }
        }
开发者ID:uwitec,项目名称:stowagemanage,代码行数:36,代码来源:OutofLibraryManage.cs


示例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";
 }
开发者ID:SyedArifulIslamEmon,项目名称:DiningManagementSystem,代码行数:30,代码来源:LoginGateway.cs


示例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();
        }
开发者ID:redolin,项目名称:K12.Club.General.ImportClubScore,代码行数:34,代码来源:LogHelper.cs


示例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;
            }
        }
开发者ID:jfpsb,项目名称:VandaConfeccoes,代码行数:40,代码来源:ListagemFornecedor.cs


示例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>");
    }
开发者ID:wjszxli,项目名称:xdjb,代码行数:30,代码来源:list_help_sh.aspx.cs


示例6: EstoqueForm

 public EstoqueForm()
 {
     InitializeComponent();
     DAOEstoque = new DAOEstoque(listSession);
     DAOLoja = new DAO<Loja>(listSession);
     pesquisaEstoqueStrategy = new PesquisaEstoqueStrategy(new PesquisaEstoqueGeral(listSession));
 }
开发者ID:jfpsb,项目名称:VandaConfeccoes,代码行数:7,代码来源:EstoqueForm.cs


示例7: StudCareRecordAddItemForm

 public StudCareRecordAddItemForm(List<string> itemList,DAO.CareRecordItemManager.ItemType itmType)
 {
     InitializeComponent();
     this.MaximumSize = this.MinimumSize = this.Size;
     _itemList = itemList;
     _itemType = itmType;
 }
开发者ID:ChunTaiChen,项目名称:Counsel_System,代码行数:7,代码来源:StudCareRecordAddItemForm.cs


示例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; }
        }
开发者ID:uwitec,项目名称:stowagemanage,代码行数:32,代码来源:StorageManage.cs


示例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.";
        }
开发者ID:SyedArifulIslamEmon,项目名称:DiningManagementSystem,代码行数:30,代码来源:LoginGateway.cs


示例10: DatabaseHelper

 public DatabaseHelper(DBConfig dbconfig)
 {
     this.dbconfig = dbconfig;
     RowsInsert = new ConcurrentQueue<String>();
     this.msgInserting = "";
     this.dao = getDataBaseDAO();
     skip = true;
     databases.Add(mysql);
 }
开发者ID:SolidNerd,项目名称:OpenDataDBBuilder,代码行数:9,代码来源:DatabaseHelper.cs


示例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; }
 }
开发者ID:uwitec,项目名称:stowagemanage,代码行数:15,代码来源:StockManage.cs


示例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());
            }
        }
    }
开发者ID:wjszxli,项目名称:xdjb,代码行数:54,代码来源:uploadFileforandroidrytx.aspx.cs


示例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);
        }
开发者ID:jfpsb,项目名称:VandaConfeccoes,代码行数:12,代码来源:GerenciarPermissoesEmFormulario.cs


示例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);
        }
开发者ID:jfpsb,项目名称:VandaConfeccoes,代码行数:13,代码来源:AlteraPermissaoGerenciarPermissoes.cs


示例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);
     }
 }
开发者ID:uwitec,项目名称:stowagemanage,代码行数:18,代码来源:StockManage.cs


示例16: StudCaseMeetingRecordForm

 /// <summary>
 /// 學生個案會議
 /// </summary>
 public StudCaseMeetingRecordForm(DAO.UDT_CounselCaseMeetingRecordDef CounselCaseMeetingRecord,accessType accType)
 {
     InitializeComponent();
     _UDTTransfer = new DAO.UDTTransfer();
     _CounselCaseMeetingRecord = CounselCaseMeetingRecord;
     _accessType = accType;
     _studRec = Student.SelectByID(CounselCaseMeetingRecord.StudentID.ToString());
     _TeacherIDNameDict = Utility.GetCounselTeacherIDNameDict(CounselCaseMeetingRecord.StudentID.ToString ());
     _TeacherNameIDDict = Utility.GetCounselTeacherNameIDDict(CounselCaseMeetingRecord.StudentID.ToString());
     //if (_accessType == accessType.Insert)
     //    _CounselCaseMeetingRecord.AuthorID = Utility.GetAuthorID();
     _LogTransfer = new DAO.LogTransfer();
 }
开发者ID:ChunTaiChen,项目名称:Counsel_System,代码行数:16,代码来源:StudCaseMeetingRecordForm.cs


示例17: ConvertToListViewItem

        private ListViewItem ConvertToListViewItem(DAO.StudentVO rec)
        {
            ListViewItem item = new ListViewItem();

            item.Tag = rec;
            // 學號
            item.Text = rec.StudentNumber;
            // 班級
            item.SubItems.Add(rec.ClassName);
            // 姓名
            item.SubItems.Add(rec.StudentName);
            
            return item;
        }
开发者ID:redolin,项目名称:K12.Report.ExamFailStudentReport,代码行数:14,代码来源:FrmWarningStudent.cs


示例18: SetCounselTeacherForm

        public SetCounselTeacherForm(DAO.CounselTeacherRecord.CounselTeacherType Type,List<string> StudentIDList)
        {
            InitializeComponent();
            _UDTTransfer = new DAO.UDTTransfer ();
            this.MaximumSize = this.MinimumSize = this.Size;
            _CounselTeacherType = Type;
            _StudentIDList = new List<int>();
            _hasCounselStudent_List = new List<DAO.UDT_CounselStudent_ListDef>();
            _StudentIDList = (from data in StudentIDList select int.Parse(data)).ToList();
            if(StudentIDList.Count>0)
                _hasCounselStudent_List = _UDTTransfer.GetCounselStudentListIDs(StudentIDList);

            this.Text = "指定" + Type.ToString();
        }
开发者ID:ChunTaiChen,项目名称:Counsel_System,代码行数:14,代码来源:SetCounselTeacherForm.cs


示例19: FrmFitnessRecord

        public FrmFitnessRecord(DAO.StudentFitnessRecord rec, accessType actType)
        {
            InitializeComponent();

            _studRec = Student.SelectByID(rec.StudentID);
            _fitnessRec = rec;
            _actType = actType;
            _LogTransfer = new Log.LogTransfer();

            if(_actType == accessType.Edit)
                this.TitleText = _FrmTitleEdit;
            else
                this.TitleText = _FrmTitleAdd;
        }
开发者ID:redolin,项目名称:K12.Sports.FitnessImportExport,代码行数:14,代码来源:FrmFitnessRecord.cs


示例20: StudCareRecordForm

        public StudCareRecordForm(DAO.UDT_CounselCareRecordDef CareRecordDef,accessType accType)
        {
            InitializeComponent();
            this.MaximumSize = this.MinimumSize = this.Size;
            _accessType = accType;
            _CounselCareRecord = CareRecordDef;
            _itemListCategory = new List<string>();
            _itemListOrigin = new List<string>();

            _studRec = Student.SelectByID(_CounselCareRecord.StudentID.ToString());
            _UDTTransfer = new DAO.UDTTransfer();
            _LogTransfer = new DAO.LogTransfer();
            //if (accType == accessType.Insert)
            //    _CounselCareRecord.AuthorID = Utility.GetAuthorID();
        }
开发者ID:ChunTaiChen,项目名称:Counsel_System,代码行数:15,代码来源:StudCareRecordForm.cs



注:本文中的DAO类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DAT类代码示例发布时间:2022-05-24
下一篇:
C# DAL.UnitOfWork类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap