コード例 #1
0
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                string OCODE = Convert.ToString(((SessionUser)Session["SessionUser"]).OCode);

                HRM_OfficialDay_Individual OfficialDayIndvidual = new HRM_OfficialDay_Individual();
                OfficialDayIndvidual.Official_Date = Convert.ToDateTime(txtDate.Text);
                OfficialDayIndvidual.Working_Day   = ddlday.Text;
                OfficialDayIndvidual.OT_Applicable = Convert.ToBoolean(ddlOT.SelectedValue);
                OfficialDayIndvidual.Edit_User     = ((SessionUser)Session["SessionUser"]).UserId;
                OfficialDayIndvidual.Edit_Date     = DateTime.Now;
                OfficialDayIndvidual.OCode         = OCODE;
                OfficialDayIndvidual.EID           = txtEid_TRNS.Text;

                var result = objAtt_BLL.GetAllOfficeDayById(OCODE, txtEid_TRNS.Text, Convert.ToDateTime(txtDate.Text));
                if (result.Count > 0)
                {
                    objAtt_BLL.UpdateOffialTypeById(OfficialDayIndvidual, Convert.ToDateTime(txtDate.Text), txtEid_TRNS.Text);  //update working day
                }
                else
                {
                    objAtt_BLL.InsertOfficeTypeIndividual(OfficialDayIndvidual);
                }

                HRM_ATTENDANCE attendanceDay = new HRM_ATTENDANCE();
                attendanceDay.Working_Day = ddlday.Text;



                var result1 = objAtt_BLL.UpdateAtt_WorkingDayById(OCODE, txtEid_TRNS.Text, txtDate.Text, ddlday.Text);
                if (result1 == 1)
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true);
                    //lblMessage.Text = "Data Update successfully!";
                    //lblMessage.ForeColor = System.Drawing.Color.Green;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updating Error!')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }