Ejemplo n.º 1
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            DateTime nowtime = DateTime.Now;

            WX.AT.Signin.MODEL model   = getSigninModel();
            WX.AT.Status.MODEL status  = getStatusModel();
            string             content = "";

            if (nowtime < WX.AT.Signin.OffWork)
            {
                TimeSpan ts = WX.AT.Signin.OffWork - nowtime;
                model.Leaveearly.value = ts.TotalMinutes;
                //写早退日志
                if (nowtime > WX.AT.Signin.NoonStop || ts.TotalMinutes > WX.AT.Signin.KGMinutes)
                {
                    int state = 13;
                    status.NoonState.value = state;
                    content = status.State.ToInt32() == 12? content = WX.AT.Signin.statearray[8]: WX.AT.Signin.statearray[status.NoonState.ToInt32()];
                }
                else
                {
                    status.NoonState.value = 10;
                    content = model.Demo.ToString() + "&nbsp;&nbsp;" + WX.AT.Signin.statearray[status.NoonState.ToInt32()] + ts.Hours + "小时" + ts.Minutes + "分钟";
                }
            }
            status.Uptime.value = DateTime.Now;
            status.Update();
            model.Offtime.value = DateTime.Now;
            model.Demo.value    = content;
            model.Update();
            WX.AT.Signin.AddLogs(status.UserID.ToString(), (int)status.State.value, content);
            pageinit();
        }
Ejemplo n.º 2
0
        private string Getstate(string str, string userid, string type)
        {
            if (type != "" && str == "6")
            {
                type = type == "1" ? "因公" : (type == "2" ? "因私" : "");
            }
            else
            {
                type = "";
            }
            int state = -1;

            if (str == "")
            {
                if (nowtime > WX.AT.Signin.BelateStart)
                {
                    if (nowtime < WX.AT.Signin.BelateStop)
                    {
                        state = 9;
                        str   = "<font color=\"red\">" + WX.AT.Signin.statearray[9] + "</font>";
                    }
                    else
                    {
                        state = 8;
                        str   = "<font color=\"red\">" + WX.AT.Signin.statearray[8] + "</font>";
                    }
                }
            }
            else
            {
                if (Convert.ToInt32(str) == 0 || Convert.ToInt32(str) == 6 || Convert.ToInt32(str) == 7 || Convert.ToInt32(str) == 11)
                {
                    str = WX.AT.Signin.statearray[Convert.ToInt32(str)];
                }
                else if (Convert.ToInt32(str) == 9 && nowtime > WX.AT.Signin.BelateStop)
                {
                    state = 8;
                    str   = "<font color=\"red\">" + WX.AT.Signin.statearray[8] + "</font>";
                }
                else
                {
                    str = "<font color=\"red\">" + WX.AT.Signin.statearray[Convert.ToInt32(str)] + "</font>";
                }
            }
            if (state > -1)
            {
                WX.AT.Status.MODEL status = WX.AT.Status.GetModel("select * from [AT_Status] where UserID='" + userid + "'");
                status.State.value  = state;
                status.Uptime.value = DateTime.Now;
                status.Update();
            }
            str = type + str;
            return(str);
        }
Ejemplo n.º 3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            WX.AT.Status.MODEL status = WX.AT.Status.GetModel("select * from [AT_Status] where UserID='" + WX.Request.rUserId + "'");
            WX.AT.Signin.MODEL model  = WX.AT.Signin.GetModel("select * from [AT_Signin] where UserID='" + WX.Request.rUserId + "' and datediff(day,Addtime,getdate())=0");
            status.Uptime.value = DateTime.Now;
            status.State.value  = Convert.ToInt32(ui_state.SelectedValue);
            string content = "";

            content = ui_state.SelectedItem.Text;
            if (ui_state.SelectedValue != "0")
            {
                if (ui_state.SelectedValue == "10")
                {
                    model.Offtime.value = status.Uptime.value;
                    TimeSpan ts = WX.AT.Signin.OffWork - (DateTime)model.Offtime.value;
                    model.Leaveearly.value = ts.Hours * 60 + ts.Minutes;
                    content += "——早退" + ts.Hours + "小时" + ts.Minutes + "分钟";
                }
                else if (ui_state.SelectedValue == "9")
                {
                    TimeSpan ts = (DateTime)status.Uptime.value - WX.AT.Signin.BelateStart;
                    model.Belate.value = ts.Hours * 60 + ts.Minutes;
                    model.Ontime.value = status.Uptime.value;
                    content           += "——迟到" + ts.Hours + "小时" + ts.Minutes + "分钟";
                }
                else if (ui_state.SelectedValue == "8")
                {
                    TimeSpan ts = (DateTime)status.Uptime.value - WX.AT.Signin.BelateStart;
                    if (model.Ontime.isEmpty)
                    {
                        model.Belate.value = ts.Hours * 60 + ts.Minutes;
                        model.Ontime.value = status.Uptime.value;
                        content           += "——上午旷工";
                    }
                    else if (model.Offtime.isEmpty)
                    {
                        model.Leaveearly.value = WX.AT.Signin.KGMinutes + 10;
                        model.Offtime.value    = status.Uptime.value;
                        content += "——下午旷工";
                    }
                }
                else
                {
                    if (ui_state.SelectedValue == "6")
                    {
                        model.Type.value = ui_type.SelectedValue;
                        content          = (ui_type.SelectedValue == "1"?"因公":"因私") + content;
                    }
                    model.Ontime.value    = model.Ontime.isEmpty ? status.Uptime.value : model.Ontime.value;
                    model.Starttime.value = status.Uptime.value;
                    model.Stoptime.value  = Convert.ToDateTime(ui_stoptime.Text);
                    model.IsSet.value     = ui_isset.Checked?1:0;
                    content += ui_demo.Text;
                }
            }
            else
            {
                //if (model.Ontime.isEmpty && (DateTime)status.Uptime.value > WX.AT.Signin.OnStop)
                //{
                model.Ontime.value = status.Uptime.value;
                //}
            }
            if (ui_demo.Text.Trim() != "")
            {
                model.Demo.value = ui_demo.Text;
            }
            model.Update();
            status.Update();
            WX.AT.Signin.AddLogs(status.UserID.ToString(), (int)status.State.value, content);
            //日志
            Response.Redirect("HR_Status.aspx");
        }
Ejemplo n.º 4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DateTime nowtime = DateTime.Now;

            WX.AT.Signin.MODEL model  = getSigninModel();
            WX.AT.Status.MODEL status = getStatusModel();

            string content = "";

            //switch (status.State.ToString())
            //{
            //    case "1": content = "销假"; break;
            //    case "2": content = "销事假"; break;
            //    case "3": content = "销病假"; break;
            //    case "4": content = "销婚假"; break;
            //    case "5": content = "销产假"; break;
            //    case "6": content = "返回"; break;
            //    case "7": content = "返差"; break;
            //}
            //WX.AT.Signin.AddLogs(status.UserID.ToString(), (int)status.State.value, content);
            content = "上班签到";
            //if (status.State.ToString() == "")
            //{
            if (nowtime < WX.AT.Signin.BelateStart)
            {
                status.State.value = 0;
            }
            else if (nowtime > WX.AT.Signin.BelateStart && nowtime <= WX.AT.Signin.BelateStop)
            {
                status.State.value = 9;
                TimeSpan ts = nowtime - WX.AT.Signin.BelateStart;
                model.Belate.value = ts.TotalMinutes;
                //日志
                content = WX.AT.Signin.statearray[status.State.ToInt32()] + ts.Hours + "小时" + ts.Minutes + "分钟";
            }
            else
            {
                status.State.value = 12;
                model.Belate.value = 180;
                //写旷工日志
                content = WX.AT.Signin.statearray[status.State.ToInt32()];
                if (nowtime > WX.AT.Signin.NoonStart)
                {
                    if (nowtime <= WX.AT.Signin.NoonStop)
                    {
                        status.NoonState.value = 14;
                        TimeSpan ts = nowtime - WX.AT.Signin.NoonStart;
                        model.Belate.value = ts.TotalMinutes;
                        //日志
                        content = content + "&nbsp;&nbsp;" + WX.AT.Signin.statearray[status.State.ToInt32()] + ts.Hours + "小时" + ts.Minutes + "分钟";
                    }
                    else
                    {
                        status.NoonState.value = 13;
                        model.Belate.value     = 360;
                        //写旷工日志
                        content = WX.AT.Signin.statearray[8];
                    }
                }
            }
            //}
            status.Uptime.value = DateTime.Now;
            status.Update();
            model.Ontime.value = nowtime;
            model.Demo.value   = content;
            model.Update();
            WX.AT.Signin.AddLogs(status.UserID.ToString(), (int)status.State.value, content);
            pageinit();
        }