Esempio n. 1
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        if (Session["emp"] != null)
        {
            Employee empSession = (Employee)Session["emp"];
            string   dcode      = empSession.DeptCode;
            string   empRole    = empSession.Role;

            int cid = deptController.GetCollectionidbyDeptCode(dcode);
            int c   = Convert.ToInt16(DropDownListCollectionPoint.SelectedValue);
            //lblFax.Text = cid.ToString();
            //lblPhone.Text = c.ToString();
            if (c != cid)
            {
                deptController.UpdateCollectionPoint(dcode, c);
                Response.Redirect(LoginController.DepartmentDetailInfoURI + "?SuccessMsg=" + "Successfully Updated!!");
            }
            else
            {
                Response.Redirect(LoginController.DepartmentDetailInfoURI);
            }
        }
        else
        {
            Utility.logout();
        }
    }
Esempio n. 2
0
    protected void BtnUpdate_Click(object sender, EventArgs e)
    {
        if (Session["emp"] != null)
        {
            Employee empSession = (Employee)Session["emp"];
            string   dcode      = empSession.DeptCode;
            string   empRole    = empSession.Role;

            Employee empDRep = deptController.GetEmployeeListForDRepSelected(dcode);
            int      cid     = deptController.GetCollectionidbyDeptCode(dcode);
            int      c       = Convert.ToInt16(ddlCollectionPoint.SelectedValue);


            int empRepid = empDRep.EmpID;

            int      empid       = Convert.ToInt16(ddlDRep.SelectedValue);
            string   empRepEmail = empDRep.Email;
            Employee newDeptRep  = deptController.GetEmployeeEmailByEid(empid);
            String   newempEmail = newDeptRep.Email;


            if (c == cid && empid == empRepid)
            {
                Response.Redirect(LoginController.DepartmentDetailInfoURI);
            }
            else
            {
                if (c != cid)
                {
                    deptController.UpdateCollectionPoint(dcode, c);
                }
                if (empid != empRepid)
                {
                    deptController.UpdateDeptRep(dcode, empid);
                }
                Response.Redirect(LoginController.DepartmentDetailInfoURI + "?SuccessMsg=" + "Successfully Updated!!");
            }
        }//ispostback
        else
        {
            Utility.logout();
        }
    }
Esempio n. 3
0
    protected void BtnUpdate_Click(object sender, EventArgs e)
    {
        if (Session["emp"] != null)
        {
            Employee empSession = (Employee)Session["emp"];
            string   dcode      = empSession.DeptCode;
            string   empRole    = empSession.Role;

            if (dcode != null)
            {
                int cid = deptController.GetCollectionidbyDeptCode(dcode);
                int c   = Convert.ToInt16(ddlCollectionPoint.SelectedValue);


                Employee empDRep     = deptController.GetEmployeeListForDRepSelected(dcode);
                int      empRepid    = empDRep.EmpID;
                string   empRepEmail = empDRep.Email;
                int      empid       = Convert.ToInt16(ddlDRep.SelectedValue);
                Employee newDeptRep  = deptController.GetEmployeeEmailByEid(empid);
                String   newempEmail = newDeptRep.Email;



                if (Convert.ToInt32(ddlActingDHead.SelectedValue) == 0)
                {
                    if (deptController.GetEmployeeListForActingDHeadSelectedCount(dcode) > 0)
                    {
                        int      Aempid           = Convert.ToInt16(ddlActingDHead.SelectedValue);
                        Employee oldDeptTemp      = deptController.GetEmployeeListForActingDHeadSelected(dcode);
                        string   oldDeptTempEmail = oldDeptTemp.Email;



                        string sdate   = txtSDate.Text;
                        string edate   = txtEDate.Text;
                        string lbsdate = lblStartDate.Text;
                        string lbedate = lblEndDate.Text;
                        //lblFax.Text = Aempid.ToString();

                        if (c == cid && empid == empRepid && Aempid == 0 && sdate == "" && edate == "" && lbsdate == "" && lbedate == "")
                        {
                            Response.Redirect(LoginController.DepartmentDetailInfoURI);
                        }
                        else
                        {
                            if (c != cid)
                            {
                                deptController.UpdateCollectionPoint(dcode, c);
                            }
                            if (empid != empRepid)
                            {
                                deptController.UpdateDeptRep(dcode, empid);
                            }
                            if (Aempid != 0 || sdate != "" || edate != "")
                            {
                                Thread emailThreadWithParam = new Thread(() => ADMailNotification(oldDeptTempEmail));
                                emailThreadWithParam.Start();
                            }
                            deptController.UpdateRevoke();

                            Response.Redirect(LoginController.DepartmentDetailInfoURI + "?SuccessMsg=" + "Successfully Updated!!");
                        }
                    }
                    else
                    {
                        int Aempid = Convert.ToInt16(ddlActingDHead.SelectedValue);
                        //Employee newDeptTemp = deptController.GetEmployeeEmailByEid(Aempid);
                        //String newDeptTempEmail = newDeptTemp.Email;
                        string sdate   = txtSDate.Text;
                        string edate   = txtEDate.Text;
                        string lbsdate = lblStartDate.Text;
                        string lbedate = lblEndDate.Text;
                        if (c == cid && empid == empRepid && Aempid == 0 && sdate == "" && edate == "" && lbsdate == "" && lbedate == "")
                        {
                            Response.Redirect(LoginController.DepartmentDetailInfoURI);
                        }
                        else
                        {
                            if (c != cid)
                            {
                                deptController.UpdateCollectionPoint(dcode, c);
                            }
                            if (empid != empRepid)
                            {
                                deptController.UpdateDeptRep(dcode, empid);
                            }

                            Response.Redirect(LoginController.DepartmentDetailInfoURI + "?SuccessMsg=" + "Successfully Updated!!");
                        }
                    }
                }
                else
                {
                    if (deptController.GetEmployeeListForActingDHeadSelectedCount(dcode) > 0)
                    {
                        int Aempid = Convert.ToInt16(ddlActingDHead.SelectedValue);
                        reqForSDate.Enabled         = true;
                        reqForEDate.Enabled         = true;
                        cmpToday.Enabled            = true;
                        cmpStartAndEndDates.Enabled = true;

                        string sdate = txtSDate.Text;
                        string edate = txtEDate.Text;



                        Employee empActingDHead   = deptController.GetEmployeeListForActingDHeadSelected(dcode);
                        int      aid              = empActingDHead.EmpID;
                        string   oldDeptTempEmail = empActingDHead.Email;
                        Employee newDeptTemp      = deptController.GetEmployeeEmailByEid(Aempid);
                        String   newDeptTempEmail = newDeptTemp.Email;
                        string   ssdate           = empActingDHead.StartDate.GetValueOrDefault().ToShortDateString();
                        string   eedate           = empActingDHead.EndDate.GetValueOrDefault().ToShortDateString();
                        string   lbsdate          = lblStartDate.Text;
                        string   lbedate          = lblEndDate.Text;
                        lblFax.Text   = aid.ToString();
                        lblPhone.Text = Aempid.ToString();

                        if (c == cid && empid == empRepid && Aempid == aid && sdate == ssdate && edate == eedate && lbsdate == ssdate && lbedate == eedate)
                        {
                            Response.Redirect(LoginController.DepartmentDetailInfoURI);
                        }
                        else
                        {
                            if (c != cid)
                            {
                                deptController.UpdateCollectionPoint(dcode, c);
                            }
                            if (empid != empRepid)
                            {
                                deptController.UpdateDeptRep(dcode, empid);
                            }
                            if (Aempid != aid || sdate != ssdate || edate != eedate)
                            {
                                Thread emailThreadWithParamnew = new Thread(() => ADNewMailNotification(newDeptTempEmail));
                                emailThreadWithParamnew.Start();
                                Thread emailThreadWithParam = new Thread(() => ADMailNotification(oldDeptTempEmail));
                                emailThreadWithParam.Start();
                            }
                            deptController.UpdateActingDHead(dcode, Aempid, sdate, edate);
                            Response.Redirect(LoginController.DepartmentDetailInfoURI + "?SuccessMsg=" + "Successfully Updated!!");
                        }
                    }
                    else
                    {
                        int      Aempid           = Convert.ToInt16(ddlActingDHead.SelectedValue);
                        Employee newDeptTemp      = deptController.GetEmployeeEmailByEid(Aempid);
                        String   newDeptTempEmail = newDeptTemp.Email;
                        reqForSDate.Enabled         = true;
                        reqForEDate.Enabled         = true;
                        cmpToday.Enabled            = true;
                        cmpStartAndEndDates.Enabled = true;

                        string sdate = txtSDate.Text;
                        string edate = txtEDate.Text;


                        if (c != cid)
                        {
                            deptController.UpdateCollectionPoint(dcode, c);
                        }
                        if (empid != empRepid)
                        {
                            deptController.UpdateDeptRep(dcode, empid);
                        }
                        Thread emailThreadWithParamnew = new Thread(() => ADNewMailNotification(newDeptTempEmail));
                        emailThreadWithParamnew.Start();
                        deptController.UpdateActingDHead(dcode, Aempid, sdate, edate);
                        Response.Redirect(LoginController.DepartmentDetailInfoURI + "?SuccessMsg=" + "Successfully Updated!!");
                    }
                }
            }
            else
            {
                lblMessage.Text = "Update Failed!";
            }
        }
        else
        {
            Utility.logout();
        }
    }
Esempio n. 4
0
 //AUTHOR : KHIN MYO MYO SHWE
 public string GetCollectionPointByDeptCode(string deptcode)
 {
     return(deptController.GetCollectionidbyDeptCode(deptcode).ToString());
 }