Exemplo n.º 1
0
 protected void Sign_Btn1(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(base.Request.QueryString["tid"]) && base.Request.QueryString["type"] == "1")
     {
         string text = base.Request.QueryString["tid"];
         IList  all  = Work_Attend.Init().GetAll(string.Concat(new string[]
         {
             " AttendType=1 and UID=",
             this.Uid,
             " and AttendTimeID=",
             text,
             " and datediff(d,addtime,getdate())=0 "
         }), null);
         if (all.Count == 0)
         {
             Work_AttendSetInfo byId            = Work_AttendSet.Init().GetById(Convert.ToInt32(text));
             Work_AttendInfo    work_AttendInfo = new Work_AttendInfo();
             work_AttendInfo.AddTime       = DateTime.Now;
             work_AttendInfo.UID           = Convert.ToInt32(this.Uid);
             work_AttendInfo.DepID         = Convert.ToInt32(this.DepID);
             work_AttendInfo.RealName      = this.RealName;
             work_AttendInfo.DepName       = this.DepName;
             work_AttendInfo.AttendTimeID  = Convert.ToInt32(text);
             work_AttendInfo.StandardTimes = byId.AttendTimes;
             work_AttendInfo.StandardNames = byId.AttendNames;
             work_AttendInfo.SignTimes     = DateTime.Now.TimeOfDay.ToString().Substring(0, 5);
             work_AttendInfo.SignDates     = DateTime.Now.ToString("yyyy-MM-dd");
             DateTime t  = Convert.ToDateTime(byId.AttendTimes);
             DateTime t2 = Convert.ToDateTime(DateTime.Now.Hour + ":" + DateTime.Now.Minute);
             if (byId.AttendNames.Contains("上班"))
             {
                 if (DateTime.Compare(t, t2) >= 0)
                 {
                     work_AttendInfo.SignJudge = "正常";
                 }
                 else
                 {
                     work_AttendInfo.SignJudge = "迟到";
                 }
             }
             if (byId.AttendNames.Contains("下班"))
             {
                 if (DateTime.Compare(t, t2) <= 0)
                 {
                     work_AttendInfo.SignJudge = "正常";
                 }
                 else
                 {
                     work_AttendInfo.SignJudge = "早退";
                 }
             }
             work_AttendInfo.AttendType = 1;
             work_AttendInfo.Notes      = "(" + RequestUtils.GetIP() + ") " + this.Notes1.Value;
             work_AttendInfo.BeginTime  = DateTime.Now;
             work_AttendInfo.EndTime    = DateTime.Now;
             Work_Attend.Init().Add(work_AttendInfo);
             base.Response.Write("<script>alert('上下班登记已添加!');window.location='WorkAttendAdd.aspx?type=1'</script>");
         }
     }
 }
Exemplo n.º 2
0
    private void Edit_Show()
    {
        this.p_edit.Visible = true;
        this.p_list.Visible = true;
        if (!string.IsNullOrEmpty(base.Request.QueryString["manage"]))
        {
            Work_AttendSetInfo byId = Work_AttendSet.Init().GetById(Convert.ToInt32(base.Request.QueryString["manage"]));
            this.ViewState["wi"]            = byId;
            this.AttendNames1.SelectedValue = byId.AttendNames;
            if (byId.AttendTimes.Contains(":"))
            {
                this.ddl_hour.SelectedValue = byId.AttendTimes.Split(new char[]
                {
                    ':'
                })[0];
                this.ddl_minute.SelectedValue = byId.AttendTimes.Split(new char[]
                {
                    ':'
                })[1];
            }
        }
        IList all = Work_AttendSet.Init().GetAll(null, null);

        this.rpt.DataSource = all;
        this.rpt.DataBind();
        this.num.InnerHtml = "当前 总计 - <span style='color:#ff0000; font-weight:bold;'>" + all.Count + "</span> 个 记录数据";
    }
Exemplo n.º 3
0
 //protected HtmlHead Head1;
 //protected HtmlForm form1;
 //protected Panel p_list;
 //protected Repeater rpt;
 //protected HtmlGenericControl num;
 //protected Panel p_edit;
 //protected DropDownList AttendNames1;
 //protected DropDownList ddl_hour;
 //protected DropDownList ddl_minute;
 //protected Button save_bt;
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack && !string.IsNullOrEmpty(base.Request.QueryString["type"]))
     {
         if (base.Request.QueryString["type"] == "edit")
         {
             this.Edit_Show();
         }
         if (base.Request.QueryString["type"] == "del" && !string.IsNullOrEmpty(base.Request.QueryString["manage"]))
         {
             int id = Convert.ToInt32(base.Request.QueryString["manage"]);
             Work_AttendSet.Init().Delete(id);
             base.Response.Redirect("WorkSet.aspx?type=edit");
         }
     }
 }
Exemplo n.º 4
0
 protected void Save_Btn(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(base.Request.QueryString["manage"]))
     {
         Work_AttendSetInfo work_AttendSetInfo = this.ViewState["wi"] as Work_AttendSetInfo;
         work_AttendSetInfo.AttendNames = this.AttendNames1.SelectedValue;
         work_AttendSetInfo.AttendTimes = this.ddl_hour.SelectedValue + ":" + this.ddl_minute.SelectedValue;
         Work_AttendSet.Init().Update(work_AttendSetInfo);
         base.Response.Write("<script>alert('编辑上下班时间成功!');window.location='WorkSet.aspx?type=edit'</script>");
     }
     else
     {
         Work_AttendSetInfo work_AttendSetInfo = new Work_AttendSetInfo();
         work_AttendSetInfo.AttendNames = this.AttendNames1.SelectedValue;
         work_AttendSetInfo.AttendTimes = this.ddl_hour.SelectedValue + ":" + this.ddl_minute.SelectedValue;
         Work_AttendSet.Init().Add(work_AttendSetInfo);
         base.Response.Write("<script>alert('添加上下班时间成功!');window.location='WorkSet.aspx?type=edit'</script>");
     }
 }