Example #1
0
        public string FindOTType(string OTDate, string WorkNo)
        {
            OverTimeBll bll = new OverTimeBll();
            string LHZBIsDisplayG2G3 = "";
            string OtStatus = "";
            OtStatus = bll.GetOTType(WorkNo, OTDate);
            #region 龍華總部周邊HR。G2,G3名稱更改為G2(休息日上班),G3(法定假日上班)
            try
            {
                LHZBIsDisplayG2G3 = System.Configuration.ConfigurationManager.AppSettings["LHZBIsDisplayG2G3"];
            }
            catch
            {
                LHZBIsDisplayG2G3 = "N";
            }

            if (LHZBIsDisplayG2G3 == "Y")
            {
                if (OtStatus == "G2")
                {
                    return OtStatus + "(休息日上班)";
                }
                else if (OtStatus == "G3")
                {
                    return OtStatus + "(法定假日上班)";
                }
                else
                {
                    return OtStatus;
                }
            }
            else
            {
                return OtStatus;
            }
            #endregion
        }
        private void EmpQuery(string EmployeeNo, string ID)
        {
            OverTimeBll bll=new OverTimeBll();
            DataTable dt= bll.GetOverTimeInfo(ID);

            if (dt != null && dt.Rows.Count > 0)
            {
                textBoxEmployeeNo.Text = dt.Rows[0]["WORKNO"].ToString();
                textBoxLocalName.Text = dt.Rows[0]["LOCALNAME"].ToString();
                textBoxDPcode.Text = dt.Rows[0]["DEPNAME"].ToString();
                textBoxPersonType.Text = dt.Rows[0]["OVERTIMETYPE"].ToString();

                if (dt.Rows[0]["APPLYDATE"].ToString() != string.Empty)
                {
                    textBoxApplyDate.Text = Convert.ToDateTime(dt.Rows[0]["APPLYDATE"].ToString()).ToShortDateString();
                }

                GetMonthOverTime(EmployeeNo);
                if (dt.Rows[0]["OTDATE"].ToString() != string.Empty)
                {
                    textBoxOTDate.Text = Convert.ToDateTime(dt.Rows[0]["OTDATE"].ToString()).ToShortDateString();
                }

                textBoxWeek.Text = dt.Rows[0]["WEEK"].ToString();
                textBoxOTType.Text = dt.Rows[0]["OTTYPE"].ToString();
                if (dt.Rows[0]["BEGINTIME"].ToString() != string.Empty)
                {
                    textBoxBeginTime.Text = Convert.ToDateTime(dt.Rows[0]["BEGINTIME"].ToString()).ToString("HH:mm");
                }
                if (dt.Rows[0]["ENDTIME"].ToString() != string.Empty)
                {
                    textBoxEndTime.Text = Convert.ToDateTime(dt.Rows[0]["ENDTIME"].ToString()).ToString("HH:mm");
                }

                textBoxHours.Text = dt.Rows[0]["HOURS"].ToString();
                textBoxWorkDesc.Text = dt.Rows[0]["WORKDESC"].ToString();
                ddlIsMoveLeave.SelectedValue = dt.Rows[0]["G2ISFORREST"].ToString();
            }
            else
            {
                this.textBoxLocalName.Text = "";
                this.textBoxDPcode.Text = "";
                this.textBoxPersonType.Text = "";

                this.textBoxOTDate.Text = "";
                this.textBoxWorkDesc.Text = "";
                this.textBoxBeginTime.Text = "";
                this.textBoxEndTime.Text = "";
                this.textBoxHours.Text = "";

                TextBoxsReset("", true);
                //    this.WriteMessage(1, this.GetResouseValue("bfw.hrm_no_employee_info"));
            }

            //string condition = "WHERE a.WorkNO='" + EmployeeNo.ToUpper() + "'";
            //if (this.bPrivileged)
            //{
            //    condition += " AND exists (SELECT 1 FROM (" + this.sqlDep + ") e where e.DepCode=a.DCode)";
            //}
            //this.tempDataTable = ((eBFW.Sys.ServiceLocator)Session["serviceLocator"]).GetFunctionData().GetVDataByCondition(condition).Tables["V_Employee"];
            //if (this.tempDataTable.Rows.Count > 0)
            //{
            //    foreach (System.Data.DataRow newRow in tempDataTable.Rows)
            //    {
            //        this.textBoxLocalName.Text = newRow["LOCALNAME"].ToString();
            //        this.textBoxDPcode.Text = newRow["DName"].ToString();
            //        this.textBoxPersonType.Text = newRow["OverTimeType"].ToString();
            //    }
            //    GetMonthOverTime(EmployeeNo.ToUpper());
            //    Query(EmployeeNo, ID);
            //}
            //else
            //{
            //
            //}
            //tempDataTable.Clear();
        }
 protected void textBoxOTDate_TextChanged(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(textBoxOTDate.Text))
     {
         DateTime dt = Convert.ToDateTime(textBoxOTDate.Text);
         textBoxWeek.Text = GetWeekCh(dt);
         OverTimeBll bll = new OverTimeBll();
         if (!string.IsNullOrEmpty(textBoxEmployeeNo.Text))
         {
             textBoxOTType.Text = bll.GetOTType(textBoxEmployeeNo.Text.Trim(), textBoxOTDate.Text.Trim());
             if (textBoxOTType.Text == "G1" || textBoxOTType.Text == "G3")
             {
                 ddlIsMoveLeave.Enabled = false;
             }
             else
             {
                 ddlIsMoveLeave.Enabled = true;
             }
         }
         else
         {
             this.WriteMessage(1, Message.WorkNoFirst);
             textBoxEmployeeNo.Focus();
             textBoxWeek.Text = string.Empty;
             textBoxOTType.Text = string.Empty;
             textBoxOTDate.Text = string.Empty;
         }
     }
 }
 protected void textBoxEmployeeNo_TextChanged(object sender, EventArgs e)
 {
     OverTimeBll bll = new OverTimeBll();
     if (!string.IsNullOrEmpty(textBoxEmployeeNo.Text.Trim()) && !string.IsNullOrEmpty(textBoxApplyDate.Text.Trim()))
     {
         DataTable dt = bll.GetEmpinfo(textBoxEmployeeNo.Text.Trim().ToUpper());
         if (dt != null && dt.Rows.Count > 0)
         {
             textBoxLocalName.Text = dt.Rows[0]["LOCALNAME"].ToString();
             textBoxDPcode.Text = dt.Rows[0]["DEPNAME"].ToString();
             textBoxPersonType.Text = dt.Rows[0]["OverTimeType"].ToString();
         }
         else
         {
             this.WriteMessage(1, "'" + textBoxEmployeeNo.Text + "'" + Message.EmpNoNotExist);
             textBoxPersonType.Text = string.Empty;
             textBoxEmployeeNo.Text = string.Empty;
             textBoxLocalName.Text = string.Empty;
             textBoxDPcode.Text = string.Empty;
             //textBoxApplyDate.Text = string.Empty;
             textBoxMonthAllHours.Text = string.Empty;
             return;
         }
         //textBoxPersonType.Text = bll.GetShiftNo(textBoxEmployeeNo.Text.Trim(), textBoxApplyDate.Text.Trim());
         //if (string.IsNullOrEmpty(textBoxPersonType.Text))
         //{
         //    this.WriteMessage(1, textBoxEmployeeNo.Text+"沒有排班,請先排班");
         //    textBoxEmployeeNo.Text = string.Empty;
         //    textBoxLocalName.Text = string.Empty;
         //    textBoxDPcode.Text = string.Empty;
         //   // textBoxApplyDate.Text = string.Empty;
         //    textBoxMonthAllHours.Text = string.Empty;
         //    return;
         //}
         textBoxApplyDate.Text = DateTime.Now.ToShortDateString();
         GetMonthOverTime(textBoxEmployeeNo.Text.Trim());
     }
 }
        public string GetOTHours(string WorkNo, string OTDate, string BeginTime, string EndTime, string OTType)
        {
            double hours = 0;
            string LHZBIsDisplayG2G3 = "";
            if (OTType.Length == 0)
            {
                OTType = FindOTType(OTDate, WorkNo);
                #region 龍華總部周邊HR。G2,G3名稱更改為G2(休息日上班),G3(法定假日上班)
                try
                {
                    LHZBIsDisplayG2G3 = System.Configuration.ConfigurationManager.AppSettings["LHZBIsDisplayG2G3"];
                }
                catch
                {
                    LHZBIsDisplayG2G3 = "N";
                }
                if (LHZBIsDisplayG2G3 == "Y")
                {
                    OTType = OTType.Substring(0, 2);
                }
                #endregion

            }
            OverTimeBll bll = new OverTimeBll();
            if (BeginTime != EndTime)
            {
                hours = bll.GetOtHours(WorkNo.ToUpper(), OTDate, BeginTime, EndTime, OTType);
            }
            return hours.ToString();
        }
Example #6
0
 public string FindOTType(string OTDate, string WorkNo)
 {
     OverTimeBll bll = new OverTimeBll();
     return bll.GetOTType(WorkNo, OTDate);
 }
        protected void textBoxOTDate_TextChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(textBoxOTDate.Text))
            {
                DateTime dt = Convert.ToDateTime(textBoxOTDate.Text);
                textBoxWeek.Text = GetWeekCh(dt);
                OverTimeBll bll = new OverTimeBll();

                if (!string.IsNullOrEmpty(textBoxEmployeeNo.Text))
                {
                    textBoxOTType.Text = wfaddt.GetOTType(textBoxEmployeeNo.Text.Trim(), textBoxOTDate.Text.Trim());
                }
                else
                {
                    this.WriteMessage(1, Message.WorkNoFirst);
                    textBoxEmployeeNo.Focus();
                    textBoxWeek.Text = string.Empty;
                    textBoxOTType.Text = string.Empty;
                    textBoxOTDate.Text = string.Empty;
                }
            }
        }