当前位置: 首页>>代码示例>>C#>>正文


C# DAL.RunSql方法代码示例

本文整理汇总了C#中DAL.RunSql方法的典型用法代码示例。如果您正苦于以下问题:C# DAL.RunSql方法的具体用法?C# DAL.RunSql怎么用?C# DAL.RunSql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DAL的用法示例。


在下文中一共展示了DAL.RunSql方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PwdSet

 /// <summary>
 /// 更改用户密码
 /// </summary>
 /// <param name="user">用户名</param>
 /// <param name="pw">密码</param>
 /// <returns>是否成功</returns>
 public static bool PwdSet(string user, string pw)
 {
     string sql = "UPDATE [WebApp].[dbo].[DL_用户名]SET [密码] [email protected]参数一 WHERE 用户名='" + user.Trim() + "'";
     SqlParameter par1 = new SqlParameter("@参数一", Sys.getMd5(pw.Trim()));
     SqlParameter[] par = { par1 };
     DAL dal = new DAL();
     dal.RunSql(sql, par);
     int n = dal.ExecuteRowCount;
     if (n > 0)
     {
         return (true);
     }
     else
     {
         return (false);
     }
 }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:23,代码来源:login.cs

示例2: adduser

        /// <summary>
        /// 新增用户
        /// </summary>
        /// <param name="name">用户名</param>
        /// <param name="context"></param>
        public void adduser(string name, HttpContext context)
        {
            string nono = "对不起,你没有权限进行此操作!";
            string[] xy = { "【运行所】", "【系统管理员】" }; //需要的权限才能操作

            if (testQX(xy, context) == false)
            {
                context.Response.Write(nono);
                return;
            }

            string SQL = "INSERT INTO [WebApp].[dbo].[DL_用户名]([用户名],[密码],[权限])VALUES('{0}','f379eaf3c831b04de153469d1bec345e','【普通】')";
            SQL = string.Format(SQL, name.Trim());

            DAL dal = new DAL();

            bool ok = dal.RunSqlExists("SELECT [ID] FROM [WebApp].[dbo].[DL_用户名] where 用户名='" + name.Trim() + "'");
            if (ok == true)
            {
                context.Response.Write("添加失败:用户[" + name.Trim() + "]已经存在!");

            }
            else
            {
                dal.RunSql(SQL);
                if (dal.ExecuteRowCount == 1)
                {
                    setupUserML(name);
                    Sys.addSteps(getname(context), "新增用户:" + name.Trim(), "[用户管理]");
                    context.Response.Write("成功");
                }
                else
                {
                    context.Response.Write(dal.ErrorMsg);
                }
            }
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:42,代码来源:UserMain.ashx.cs

示例3: VerAdd

        /// <summary>
        /// 插入版本控制记录
        /// </summary>
        /// <param name="context"></param>
        public void VerAdd(HttpContext context)
        {
            string name = context.Request["name"];
            string ver = context.Request["ver"];
            string info = context.Request["info"];

            string conf = context.Server.MapPath("~/Public/CNGconfig.xml");
            string oldver = Sys.xmlRead(conf, "缓存配置", "全局版本", "0");//读取版本号
            string retext = "{{ \"ok\":{0},\"msg\":\"{1}\",\"data\":@替换对象@ }}";
            if (double.Parse(ver) <= double.Parse(oldver))
            {
                retext = string.Format(retext, "false", "新版本号必须比老版本号大,更改数据失败!");
                retext = retext.Replace("@替换对象@", "0");
                context.Response.Write(retext);
                return;
            }
            string SQL = "INSERT INTO [WebApp].[dbo].[WEB_版本控制]([日期],[版本号],[更新说明],[操作人员]) VALUES(getdate(),@版本号,@更新说明,@操作人员)";
            DAL dal = new DAL();
            SqlParameter par1 = new SqlParameter("版本号", ver);
            SqlParameter par2 = new SqlParameter("更新说明", info);
            SqlParameter par3 = new SqlParameter("操作人员", name);
            dal.RunSql(SQL, new SqlParameter[] { par1, par2, par3 });
            if (dal.ExecuteRowCount == 1)
            {
                Sys.xmlAdd(conf, "缓存配置", "全局版本", ver);
                retext = string.Format(retext, "true", "提交版本号成功!当前版本号:" + ver);
                retext = retext.Replace("@替换对象@", "0");
            }
            else
            {
                retext = string.Format(retext, "false", "错误信息:" + dal.ErrorMsg);
                retext = retext.Replace("@替换对象@", "0");
            }
            context.Response.Write(retext);
            Sys.DebugMes(retext);
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:40,代码来源:websys.ashx.cs

示例4: updateqx

        /// <summary>
        /// 更新用户权限
        /// </summary>
        /// <param name="name">用户名</param>
        /// <param name="context"></param>
        public void updateqx(string name, HttpContext context)
        {
            string nono = "对不起,你没有权限进行此操作!";
            string[] xy = { "【运行所】", "【系统管理员】" }; //需要的权限才能操作

            if (testQX(xy, context) == false)
            {
                context.Response.Write(nono);
                return;
            }

            if (name == null)
            {
                context.Response.Write("");
                return;
            }
            string val = context.Request["val"];
            string SQL = "UPDATE [WebApp].[dbo].[DL_用户名] SET  [权限]='" + val + "'  WHERE 用户名='" + name.Trim() + "'";
            DAL dal = new DAL();
            dal.RunSql(SQL);
            if (dal.ExecuteRowCount == 1)
            {
                Sys.addSteps(getname(context), "更改用户:[" + name.Trim() + "]权限", "[用户管理]");
                context.Response.Write("成功");
            }
            else
            {
                context.Response.Write(dal.ErrorMsg);
            }
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:35,代码来源:UserMain.ashx.cs

示例5: KQ_update

        /// <summary>
        /// 修改考勤处理
        /// </summary>
        /// <param name="context"></param>
        public void KQ_update(HttpContext context)
        {
            string ID = context.Request["ID"];
            string time1 = context.Request["time1"];
            string time2 = context.Request["time2"];
            string cqqk = context.Request["cqqk"];
            string name = context.Request["name"];
            string sm = context.Request["sm"];

            int cq = 0;//实到 根据签到情况来判断
            if (time1 != "") { cq += 1; } else { time1 = null; }
            if (time2 != "") { cq += 1; } else { time2 = null; }

            int cqsj = 0;//计算出勤时间
            if (time1 != null && time2 != null)
            {
                DateTime t1 = DateTime.Parse(time1);
                DateTime t2 = DateTime.Parse(time2);
                TimeSpan sp = t2.Subtract(t1);
                cqsj = (int)sp.TotalMinutes;
            }

            string SQL = @"UPDATE [CNGTZ].[dbo].[TZ_人员_考勤表]
                                            SET [上班签到] = @上班
                                                ,[下班签退] = @下班
                                                ,[实到] [email protected]实到
                                                ,[出勤情况] = @出勤情况
                                                ,[出勤时间] = @出勤时间
                                                ,[修改] =1
                                                ,[说明] [email protected]说明
                                            WHERE [email protected]";

            SqlParameter par1 = new SqlParameter("ID", ID);
            SqlParameter par2 = new SqlParameter("说明", sm);
            SqlParameter par3 = new SqlParameter("实到", cq);
            SqlParameter par4 = new SqlParameter("出勤情况", cqqk);
            SqlParameter par5 = new SqlParameter("出勤时间", cqsj);
            SqlParameter par6 = (time1 == null) ? new SqlParameter("上班", DBNull.Value) : new SqlParameter("上班", time1);
            SqlParameter par7 = (time2 == null) ? new SqlParameter("下班", DBNull.Value) : new SqlParameter("下班", time2);

            SqlParameter[] par = { par1, par2, par3, par4, par5, par6, par7 };
            DAL dal = new DAL();
            dal.RunSql(SQL, par);//执行操作
            Sys.addSteps(name, "修改ID=" + ID, "异常考勤");
            context.Response.Write("ok");
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:50,代码来源:user.ashx.cs

示例6: JF_GG_save

 /// <summary>
 /// 保存站点积分公告
 /// </summary>
 public void JF_GG_save(HttpContext context)
 {
     int zd = int.Parse(context.Request["zd"]);
     string txt = context.Request["txt"];
     string SQL = "UPDATE [CNGTZ].[dbo].[TZ_站点] SET [积分公告] = @公告 WHERE  [email protected]站点";
     DAL dal = new DAL();
     SqlParameter par1 = new SqlParameter("站点", zd);
     SqlParameter par2 = new SqlParameter("公告", txt);
     dal.RunSql(SQL, new SqlParameter[] {par1, par2});
     string retext = "";
     if (dal.ExecuteRowCount ==1)
     {
         retext = "yes";
     }
     context.Response.Write(retext);
 }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:19,代码来源:user.ashx.cs

示例7: datediff

 /// <summary>
 /// 处理出勤情况,生成出勤时间(分钟)
 /// </summary>
 /// <param name="dt"></param>
 /// <param name="dd"></param>
 public void KQ_出勤情况(DateTime dt, int dd)
 {
     DateTime 起始时间 = dt.AddDays(0 - dd);
     string SQL = "UPDATE [CNGTZ].[dbo].[TZ_人员_考勤表] SET [出勤情况] ='正常',[出勤时间] = datediff(mi,[上班签到],[下班签退]) WHERE [实到]=2 AND 日期 BETWEEN @起始 AND @结束";
     SqlParameter par1 = new SqlParameter("起始", 起始时间);
     SqlParameter par2 = new SqlParameter("结束", dt);
     DAL dal = new DAL();
     dal.RunSql(SQL, new SqlParameter[] { par1, par2 });
     SQL = "UPDATE [CNGTZ].[dbo].[TZ_人员_考勤表] SET [出勤情况] ='异常' WHERE [实到]<>2 AND 日期 BETWEEN @起始 AND @结束";
     dal.RunSql(SQL, new SqlParameter[] { par1, par2 });
     if (this.SJ_指纹处理 != null)
     {
         Even_指纹系统处理 e = new Even_指纹系统处理();
         e.mesg = "处理考勤情况【" + 起始时间.ToShortDateString() + " 至 " + dt.ToShortDateString() + "】到完成!";
         //触发事件
         this.SJ_指纹处理(this, e);
     }
 }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:23,代码来源:MainClass.cs

示例8: IcAdd

        /// <summary>
        /// 新增IC卡
        /// </summary>
        /// <param name="context"></param>
        public void IcAdd(HttpContext context)
        {
            string bzno = context.Request["bzno"];
            string zdcode = context.Request["zdcode"];
            string icno = context.Request["icno"];
            string SQL = @"INSERT INTO [CNGTZ].[dbo].[IC_绑定]
                                                               ([卡号]
                                                               ,[班组]
                                                               ,[所属站点]
                                                               ,[更新时间])
                                                         VALUES
                                                               (@卡号
                                                               ,@班组
                                                               ,@所属站点
                                                               ,getdate())";
            var par1 = new SqlParameter("@卡号", icno);
            var par2 = new SqlParameter("@班组", bzno);
            var par3 = new SqlParameter("@所属站点", zdcode);
            string retext = "{\"ok\":@[email protected],\"msg\":\"@[email protected]\"}";
            var dal = new DAL();
            try
            {

                dal.RunSql(SQL, new SqlParameter[] { par1, par2, par3 });
                if (dal.ExecuteRowCount == 1)
                {
                    retext = retext.Replace("@[email protected]", "true");
                    retext = retext.Replace("@[email protected]", "添加IC卡成功!请重新刷新加载数据!");
                }
                else
                {
                    retext = retext.Replace("@[email protected]", "false");
                    retext = retext.Replace("@[email protected]", "添加IC卡失败!<br/>注意:IC卡号不能重复!");
                }
            }
            catch (Exception)
            {
                retext = retext.Replace("@[email protected]", "false");
                retext = retext.Replace("@[email protected]", dal.ErrorMsg);
            }

            context.Response.Write(retext);
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:47,代码来源:user.ashx.cs

示例9: JF_add

        /// <summary>
        /// 加入一条积分数据
        /// </summary>
        /// <param name="context"></param>
        public void JF_add(HttpContext context)
        {
            string name = context.Request["name"];
            string info = context.Request["info"];
            string user = context.Request["user"];
            int num = int.Parse(context.Request["num"]);
            string SQL = "INSERT INTO [CNGTZ].[dbo].[TZ_人员_积分]([姓名] ,[积分] ,[说明],[操作人])VALUES(@姓名,@积分,@说明,@操作人)";
            string text = "";

            DAL dal = new DAL();
            SqlParameter par1 = new SqlParameter("姓名", name);
            SqlParameter par2 = new SqlParameter("积分", num);
            SqlParameter par3 = new SqlParameter("说明", info);
            SqlParameter par4 = new SqlParameter("操作人", user);
            dal.RunSql(SQL, new SqlParameter[] { par1, par2, par3, par4 });
            if (dal.ExecuteRowCount == 1)
            {
                text = "yes";
            }
            context.Response.Write(text);
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:25,代码来源:user.ashx.cs

示例10: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            //初始化 FI_公司文件 表
            string SQL = "INSERT INTO [WebApp].[dbo].[FI_公司文件]([名称],[路径],[修改日期],[文件大小],[上传用户])VALUES(@名称,@路径,@修改日期,@文件大小,'姜雪松')";
            DAL dal = new DAL();
            List<FileItem> dirs = FileManager.GetDirectoryItems(@"E:\CNGfile\公司文件");
            foreach (FileItem dir in dirs)
            {
                List<FileItem> files = FileManager.GetFileItems(dir.FullName);
                foreach (FileItem fi in files)
                {
                    SQL = "INSERT INTO [WebApp].[dbo].[FI_公司文件]([名称],[路径],[修改日期],[文件大小],[上传用户],[目录])VALUES(@名称,@路径,@修改日期,@文件大小,@上传用户,@目录)";
                    SqlParameter par1 = new SqlParameter("@名称", fi.Name);
                    SqlParameter par2 = new SqlParameter("@路径", fi.FullName);
                    SqlParameter par3 = new SqlParameter("@修改日期", fi.LastWriteDate);
                    SqlParameter par4 = new SqlParameter("@文件大小", fi.Size);
                    SqlParameter par5 = new SqlParameter("@上传用户", "姜雪松");
                    SqlParameter par6 = new SqlParameter("@目录", fi.FullName.Replace(fi.Name, ""));
                    dal.RunSql(SQL, new SqlParameter[] { par1, par2, par3, par4, par5, par6 });

                }

                //Sys.DebugMes(files.Count.ToString());
            }

            Sys.DebugMes("完成");
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:27,代码来源:Form1.cs

示例11: DG_code

        /// <summary>
        /// 调岗操作
        /// </summary>
        /// <param name="context"></param>
        public void DG_code(HttpContext context)
        {
            string code = context.Request["code"];
            string name = context.Request["name"];

            DAL dal = new DAL();
            SqlParameter par1 = new SqlParameter("@code", code);
            SqlParameter par2 = new SqlParameter("@name", name);
            string SQL = "SELECT [ID],[所属部门] FROM [CNGTZ].[dbo].[TZ_人员] where 姓名[email protected]";
            string[] dqcode = dal.RunSqlStrings(SQL, new SqlParameter[] { par2 });

            SQL = "UPDATE [CNGTZ].[dbo].[TZ_人员] SET [所属部门] [email protected],[更新时间] = getdate()  WHERE  姓名[email protected]";
            dal.RunSql(SQL, new SqlParameter[] { par1, par2 });

            if (dqcode[1] == "02")
            {//如果是离职人员 调岗操作
                SQL = "UPDATE [CNGTZ].[dbo].[TZ_人员_档案2] SET [离职日期] =null,[离职原因] ='',[更新时间] = getdate() WHERE ID=" + dqcode[0];
                dal.RunSql(SQL);
            }

            if (dal.ExecuteRowCount > 0)
            {
                if (dqcode[1] == "02")
                {//如果是离职人员 调岗操作
                    SQL = "UPDATE [CNGTZ].[dbo].[TZ_人员_档案2] SET [离职日期] =null,[离职原因] ='',[更新时间] = getdate() WHERE ID=" + dqcode[0];
                    dal.RunSql(SQL);
                }
                //调岗成功 解除相关人员的IC卡绑定
                SQL = "UPDATE [CNGTZ].[dbo].[IC_绑定] SET [人员] = '',[更新时间]=getdate() WHERE [人员]='" + name + "'";
                dal.RunSql(SQL);
                context.Response.Write("true");
            }
            else
            {
                context.Response.Write("false");
            }
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:41,代码来源:user.ashx.cs

示例12: VerUpdate

 /// <summary>
 /// 修改版本控制记录
 /// </summary>
 /// <param name="context"></param>
 public void VerUpdate(HttpContext context)
 {
     string SQL = "UPDATE [WebApp].[dbo].[WEB_版本控制] SET [更新说明] = @更新说明 WHERE 版本号[email protected]版本号";
     string ver = context.Request["ver"];
     string info = context.Request["info"] ?? "";
     string retext = "{{ \"ok\":{0},\"msg\":\"{1}\",\"data\":@替换对象@ }}";
     DAL dal = new DAL();
     SqlParameter par1 = new SqlParameter("版本号", ver);
     SqlParameter par2 = new SqlParameter("更新说明", info);
     dal.RunSql(SQL, new SqlParameter[] { par1, par2 });
     if (dal.ExecuteRowCount == 1)
     {
         retext = string.Format(retext, "true", "更改数据成功!");
         retext = retext.Replace("@替换对象@", "0");
     }
     else
     {
         retext = string.Format(retext, "false", "错误信息:" + dal.ErrorMsg);
         retext = retext.Replace("@替换对象@", "0");
     }
     context.Response.Write(retext);
 }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:26,代码来源:websys.ashx.cs

示例13: lockData

 /// <summary>
 /// 锁定 解锁 操作
 /// </summary>
 /// <param name="context"></param>
 public void lockData(HttpContext context)
 {
     string year = context.Request["year"];
     string yue = context.Request["yue"];
     string val = context.Request["val"];
     string retext = "{{ \"ok\":{0},\"msg\":\"{1}\" }}";
     string SQL = @"UPDATE [CNGQT].[dbo].[CW_月度统计] SET  锁定[email protected]锁定@ WHERE 年[email protected]年@ and 月[email protected]月@ ";
     SQL = SQL.Replace("@锁定@", val);
     SQL = SQL.Replace("@年@", year);
     SQL = SQL.Replace("@月@", yue);
     DAL dal = new DAL();
     dal.RunSql(SQL);
     if (dal.ExecuteRowCount == 3)
     {
         retext = string.Format(retext, "true", "操作成功!");
     }
     else
     {
         retext = string.Format(retext, "false", "操作失败!");
     }
     context.Response.Write(retext);
 }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:26,代码来源:CNGGAS.ashx.cs

示例14: VerDel

 /// <summary>
 /// 删除版本控制记录
 /// </summary>
 /// <param name="context"></param>
 public void VerDel(HttpContext context)
 {
     string SQL = "DELETE FROM [WebApp].[dbo].[WEB_版本控制] WHERE  版本号[email protected]版本号";
     string ver = context.Request["ver"];
     string conf = context.Server.MapPath("~/Public/CNGconfig.xml");
     string oldver = Sys.xmlRead(conf, "缓存配置", "全局版本", "1.00");//读取版本号
     string retext = "{{ \"ok\":{0},\"msg\":\"{1}\",\"data\":@替换对象@ }}";
     DAL dal = new DAL();
     SqlParameter par1 = new SqlParameter("版本号", ver);
     dal.RunSql(SQL, new SqlParameter[] { par1 });
     if (dal.ExecuteRowCount == 1)
     {
         if (double.Parse(ver) >= double.Parse(oldver))
         {
             SQL = "SELECT TOP 1 [版本号] FROM [WebApp].[dbo].[WEB_版本控制] ORDER BY 版本号 DESC";
             oldver = dal.RunSqlGetID(SQL) ?? "1.00";
             Sys.xmlAdd(conf, "缓存配置", "全局版本", oldver);
         }
         retext = string.Format(retext, "true", "更改数据成功,当前版本号为:" + oldver);
         retext = retext.Replace("@替换对象@", "0");
     }
     else
     {
         retext = string.Format(retext, "false", "错误信息:" + dal.ErrorMsg);
         retext = retext.Replace("@替换对象@", "0");
     }
     context.Response.Write(retext);
 }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:32,代码来源:websys.ashx.cs

示例15: SqlParameter

        /// <summary>
        /// 签到时间生成
        /// </summary>
        /// <param name="dt">结束日期</param>
        /// <param name="dd">处理天数</param>
        /// <param name="wc">指纹刷机误差小时</param>
        /// <param name="cdwc">迟到误差分钟</param>
        /// <param name="ztwc">早退误差分钟</param> 
        public void KQ_签到处理(DateTime dt, int dd, int wc, int cdwc, int ztwc)
        {
            //dt = DateTime.Parse(dt.ToShortDateString());
            DateTime 起始时间 = dt.AddDays(0 - dd);

            //签到处理
            string SQL = "SELECT  [ID],[姓名],[上班时间],[下班时间] FROM [CNGTZ].[dbo].[TZ_人员_考勤表] where 上班签到 IS NULL and 日期 between @起始 and @结束";
            SqlParameter par1 = new SqlParameter("起始", 起始时间);
            SqlParameter par2 = new SqlParameter("结束", dt);
            //Sys.DebugMes(起始时间.ToString() + "   " + dt.ToString());

            DAL dal = new DAL();

            DataTable renName = dal.RunSqlDataTable(SQL, new SqlParameter[] { par1, par2 });//取得人员列表

            foreach (DataRow row in renName.Rows)
            {
                DateTime t = DateTime.Parse(row["上班时间"].ToString());
                SqlParameter p1 = new SqlParameter("起始", t.AddHours(0 - wc));
                SqlParameter p2 = new SqlParameter("结束", t.AddHours(wc));
                SqlParameter p3 = new SqlParameter("姓名", row["姓名"].ToString());
                if (row["姓名"].ToString() == "陈兴华")
                {
                    Sys.DebugMes("XXX");
                }

                SQL = "SELECT top 1 [刷机时间] FROM [CNGTZ].[dbo].[TZ_人员_考勤_刷机时间] where 姓名[email protected]姓名 AND 刷机时间 BETWEEN @起始 AND @结束 ORDER BY 刷机时间";
                string qdsj = dal.RunSqlGetID(SQL, new SqlParameter[] { p1, p2, p3 });//找到最早指纹签到时间
                if (qdsj == null)
                {
                    continue;//如果没有找到签到时间 就到下一条记录
                }
                int cd = 0;//判断是否迟到
                DateTime tt = DateTime.Parse(qdsj);//签到时间
                TimeSpan temp = tt.Subtract(t);
                cd = temp.Minutes;//迟到分钟

                cd = (cd > cdwc) ? 1 : 0;

                SQL = "UPDATE [CNGTZ].[dbo].[TZ_人员_考勤表] SET [上班签到] = @签到时间,[实到] =[实到]+ 1,[迟到]= " + cd.ToString() + " WHERE ID [email protected]";
                SqlParameter p4 = new SqlParameter("ID", int.Parse(row["ID"].ToString()));
                SqlParameter p5 = new SqlParameter("签到时间", DateTime.Parse(qdsj));
                dal.RunSql(SQL, new SqlParameter[] { p4, p5 });//更新签到时间列表
            }

            //进行签退处理
            SQL = "SELECT  [ID],[姓名],[上班时间],[下班时间] FROM [CNGTZ].[dbo].[TZ_人员_考勤表] where 下班签退 IS NULL and 日期 between @起始 and @结束";
            par1 = new SqlParameter("起始", 起始时间);
            par2 = new SqlParameter("结束", dt);

            renName = dal.RunSqlDataTable(SQL, new SqlParameter[] { par1, par2 });//取得人员列表

            foreach (DataRow row in renName.Rows)
            {
                DateTime t = DateTime.Parse(row["下班时间"].ToString());
                SqlParameter p1 = new SqlParameter("起始", t.AddHours(0 - wc));
                SqlParameter p2 = new SqlParameter("结束", t.AddHours(wc));
                SqlParameter p3 = new SqlParameter("姓名", row["姓名"].ToString());
                SQL = "SELECT top 1 [刷机时间] FROM [CNGTZ].[dbo].[TZ_人员_考勤_刷机时间] where 姓名[email protected]姓名 AND 刷机时间 BETWEEN @起始 AND @结束 ORDER BY 刷机时间 desc";
                string qdsj = dal.RunSqlGetID(SQL, new SqlParameter[] { p1, p2, p3 });//找到最后下班指纹签到时间
                if (qdsj == null)
                {
                    continue;//如果没有找到签到时间 就到下一条记录
                }
                int zt = 0;//判断是否早退
                DateTime tt = DateTime.Parse(qdsj);
                TimeSpan temp = t.Subtract(tt);
                zt = temp.Minutes;

                zt = (zt > ztwc) ? 1 : 0;
                SQL = "UPDATE [CNGTZ].[dbo].[TZ_人员_考勤表] SET [下班签退] = @签到时间,[实到] =[实到]+ 1,[早退]= " + zt.ToString() + " WHERE ID [email protected]";
                SqlParameter p4 = new SqlParameter("ID", int.Parse(row["ID"].ToString()));
                SqlParameter p5 = new SqlParameter("签到时间", DateTime.Parse(qdsj));
                dal.RunSql(SQL, new SqlParameter[] { p4, p5 });//更新签到时间列表
            }
            //记录处理时间
            SQL = "INSERT INTO [CNGTZ].[dbo].[TZ_人员_考勤处理时间]([时间]) VALUES ('" + DateTime.Now.ToString() + "')";
            dal.RunSql(SQL);

            if (this.SJ_指纹处理 != null)
            {
                Even_指纹系统处理 e = new Even_指纹系统处理();
                e.mesg = "处理考勤签到【" + 起始时间.ToShortDateString() + " 至 " + dt.ToShortDateString() + "】到完成!";
                //触发事件
                this.SJ_指纹处理(this, e);
            }
        }
开发者ID:jxsgood,项目名称:WEBCNG,代码行数:95,代码来源:MainClass.cs


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