Exemplo n.º 1
0
    //AUTHOR : KHIN MYO MYO SHWE
    public WCFEmployee GetDeptHead(string dcode)
    {
        Department d   = deptController.GetDepartByDepCode(dcode);
        Employee   emp = deptController.GetDHeadByDeptCode(dcode);

        return(WCFEmployee.Make(emp.EmpID, d.DeptName, emp.EmpName, emp.Role, emp.Password
                                , emp.Email, emp.IsTempHead, emp.StartDate.GetValueOrDefault().ToShortDateString()
                                , emp.EndDate.GetValueOrDefault().ToShortDateString()));
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DeptController deptController = new DeptController();

        if (Session["emp"] != null)
        {
            Employee empSession = (Employee)Session["emp"];
            string   dcode      = empSession.DeptCode;
            string   empRole    = empSession.Role;
            string   tempHead   = empSession.IsTempHead;

            if (deptController.GetEmployeeListForActingDHeadSelectedCount(dcode) > 0)
            {
                Employee empActingDHead = deptController.GetEmployeeListForActingDHeadSelected(dcode);
                DateTime?endDate        = empActingDHead.EndDate;
                DateTime today          = DateTime.Now.Date;

                if (today > endDate)
                {
                    deptController.UpdateRevoke();
                    lblActingDHead.Text = null;
                }
            }
            if (!IsPostBack)
            {
                string s = Request.QueryString["SuccessMsg"];
                lblMessage.Text = s;


                if (empRole == "Employee")
                {
                    btnUpdate.Visible = false;
                }

                if (deptController.GetEmployeeListForActingDHeadSelectedCount(dcode) <= 0)
                {
                    Employee   empDRep = deptController.GetEmployeeListForDRepSelected(dcode);
                    Department dept    = deptController.GetDepartByDepCode(dcode);
                    Employee   emp     = deptController.GetDHeadByDeptCode(dcode);

                    string aheadname         = "No Acting Head";
                    string detpRname         = empDRep.EmpName;
                    string dname             = dept.DeptName;
                    string contactname       = dept.DeptContactName;
                    string telephone         = dept.DeptTelephone;
                    string fax               = dept.DeptFax;
                    string dheadname         = emp.EmpName;
                    string empCollectionname = deptController.GetDepartmentForCollectionPointSelected(dcode);


                    lblDeptName.Text    = dname;
                    lblContactName.Text = contactname;
                    lblPhone.Text       = telephone;
                    lblFax.Text         = fax;
                    lblHeadname.Text    = dheadname;

                    lblActingDHead.Text      = aheadname;
                    lblActingDHead.ForeColor = System.Drawing.Color.Red;
                    lblDeptRep.Text          = detpRname;
                    lblCollectPoint.Text     = empCollectionname;
                }
                else
                {
                    Employee   empActingDHead = deptController.GetEmployeeListForActingDHeadSelected(dcode);
                    Employee   empDRep        = deptController.GetEmployeeListForDRepSelected(dcode);
                    Department dept           = deptController.GetDepartByDepCode(dcode);
                    Employee   emp            = deptController.GetDHeadByDeptCode(dcode);

                    string aheadname   = empActingDHead.EmpName;
                    string detpRname   = empDRep.EmpName;
                    string dname       = dept.DeptName;
                    string contactname = dept.DeptContactName;
                    string telephone   = dept.DeptTelephone;
                    string fax         = dept.DeptFax;
                    string dheadname   = emp.EmpName;
                    string startdate   = empActingDHead.StartDate.GetValueOrDefault().Date.ToShortDateString();
                    string enddate     = empActingDHead.EndDate.GetValueOrDefault().ToShortDateString();


                    string empCollectionname = deptController.GetDepartmentForCollectionPointSelected(dcode);
                    //DateTime? endDate = empActingDHead.EndDate;
                    //DateTime today = DateTime.Now;

                    //if (today > endDate)
                    //{
                    //    deptController.UpdateRevoke();
                    //    lblActingDHead.Text = null;


                    //}

                    lblDeptName.Text     = dname;
                    lblContactName.Text  = contactname;
                    lblPhone.Text        = telephone;
                    lblFax.Text          = fax;
                    lblHeadname.Text     = dheadname;
                    lblActingDHead.Text  = aheadname;
                    lblDeptRep.Text      = detpRname;
                    lblCollectPoint.Text = empCollectionname;
                    lblSDate.Text        = startdate;
                    lblEDate.Text        = enddate;
                }
            }//ispostback
        }
        else
        {
            Utility.logout();
        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["emp"] != null)
            {
                Employee empSession = (Employee)Session["emp"];
                string   dcode      = empSession.DeptCode;
                string   empRole    = empSession.Role;

                Department dept    = deptController.GetDepartByDepCode(dcode);
                Employee   emp     = deptController.GetDHeadByDeptCode(dcode);
                Employee   empDRep = deptController.GetEmployeeListForDRepSelected(dcode);

                string dname       = dept.DeptName;
                string contactname = dept.DeptContactName;
                string telephone   = dept.DeptTelephone;
                string fax         = dept.DeptFax;
                string dheadname   = emp.EmpName;



                //DateTime? endTime = emp.EndDate;
                lblDeptName.Text    = dname;
                lblContactName.Text = contactname;
                lblPhone.Text       = telephone;
                lblFax.Text         = fax;
                lblHeadname.Text    = dheadname;


                //Date

                cmpToday.ValueToCompare = DateTime.Now.ToShortDateString();
                //CompareValidator1.ValueToCompare = DateTime.Now.ToShortDateString();

                reqForSDate.Enabled         = true;
                reqForEDate.Enabled         = true;
                cmpToday.Enabled            = true;
                cmpStartAndEndDates.Enabled = true;



                int empRid = empDRep.EmpID;//ForDeptRep Id

                //UpdateActingDHead
                if (deptController.GetEmployeeListForActingDHeadSelectedCount(dcode) <= 0)
                {
                    ddlActingDHead.DataSource     = deptController.GetEmployeeListForActingDHead(dcode, empRid);
                    ddlActingDHead.DataTextField  = "EmpName";
                    ddlActingDHead.DataValueField = "EmpID";
                    ddlActingDHead.DataBind();
                    ddlActingDHead.Items.Insert(0, new ListItem("--Revoke authority--", "0"));
                    ddlActingDHead.SelectedIndex = 0;
                    //if (DropDownListActingDHead.SelectedValue == "0")
                    //{
                    txtSDate.Enabled    = false;
                    txtEDate.Enabled    = false;
                    txtSDate.Visible    = true;
                    txtEDate.Visible    = true;
                    btnEditDate.Visible = false;
                    reqForSDate.Enabled = false;
                    reqForEDate.Enabled = false;

                    // }


                    int    empid       = 0;
                    string empDRepname = empDRep.EmpName;
                    ddlDRep.DataSource     = deptController.GetEmployeeListForDRep(dcode, empid);
                    ddlDRep.DataTextField  = "EmpName";
                    ddlDRep.DataValueField = "EmpID";
                    ddlDRep.DataBind();
                    ddlDRep.Items.FindByText(empDRepname).Selected = true;
                }
                else
                {
                    Employee empActingDHead = deptController.GetEmployeeListForActingDHeadSelected(dcode);

                    string empActingDHeadname = empActingDHead.EmpName;
                    string startdate          = empActingDHead.StartDate.GetValueOrDefault().Date.ToShortDateString();
                    string enddate            = empActingDHead.EndDate.GetValueOrDefault().ToShortDateString();

                    lblStartDate.Text = startdate;
                    lblEndDate.Text   = enddate;
                    txtSDate.Text     = startdate;
                    txtEDate.Text     = enddate;
                    //if (empActingDHead.EndDate != null && txtSDate.Text.ToString()==empActingDHead.StartDate.GetValueOrDefault().ToShortDateString())
                    //{
                    //    cmpToday.Enabled = false;
                    //}else { cmpToday.Enabled = true; }
                    DateTime?endDate   = empActingDHead.EndDate;
                    DateTime?startDate = empActingDHead.StartDate;
                    DateTime today     = DateTime.Now;

                    //if (today <= endDate && today>=startDate && txtEDate.Text==enddate && txtSDate.Text==startdate)
                    //{
                    //    cmpToday.Enabled = false;
                    //    cmpStartAndEndDates.Enabled =false;
                    //    RequiredFieldValidator1.Enabled = false;
                    //    RequiredFieldValidator2.Enabled = false;

                    //}

                    ddlActingDHead.DataSource     = deptController.GetEmployeeListForActingDHead(dcode, empRid);
                    ddlActingDHead.DataTextField  = "EmpName";
                    ddlActingDHead.DataValueField = "EmpID";
                    ddlActingDHead.DataBind();
                    ddlActingDHead.Items.FindByText(empActingDHeadname).Selected = true;
                    ddlActingDHead.Items.Insert(0, new ListItem("--Revoke authority--", "0"));

                    //UpdateDeptRp
                    int    empid       = empActingDHead.EmpID;
                    string empDRepname = empDRep.EmpName;
                    ddlDRep.DataSource     = deptController.GetEmployeeListForDRep(dcode, empid);
                    ddlDRep.DataTextField  = "EmpName";
                    ddlDRep.DataValueField = "EmpID";
                    ddlDRep.DataBind();
                    ddlDRep.Items.FindByText(empDRepname).Selected = true;
                }

                //UpdateCollectionPoint
                string empCollectionname = deptController.GetDepartmentForCollectionPointSelected(dcode);
                ddlCollectionPoint.DataSource     = deptController.GetCollectionPointList();
                ddlCollectionPoint.DataTextField  = "CollectionPoint1";
                ddlCollectionPoint.DataValueField = "CollectionLocationID";
                ddlCollectionPoint.DataBind();
                ddlCollectionPoint.Items.FindByText(empCollectionname).Selected = true;
            }//ispostback
            else
            {
                Utility.logout();
            }
        }
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["emp"] != null)
            {
                Employee empSession = (Employee)Session["emp"];
                string   dcode      = empSession.DeptCode;
                string   empRole    = empSession.Role;

                if (deptController.GetEmployeeListForActingDHeadSelectedCount(dcode) <= 0)
                {
                    Department dept        = deptController.GetDepartByDepCode(dcode);
                    Employee   emp         = deptController.GetDHeadByDeptCode(dcode);
                    Employee   empDRep     = deptController.GetEmployeeListForDRepSelected(dcode);
                    string     aheadname   = "No Acting Head";
                    string     detpRname   = empDRep.EmpName;
                    string     dname       = dept.DeptName;
                    string     contactname = dept.DeptContactName;
                    string     telephone   = dept.DeptTelephone;
                    string     fax         = dept.DeptFax;
                    string     dheadname   = emp.EmpName;



                    lblDeptName.Text         = dname;
                    lblContactName.Text      = contactname;
                    lblPhone.Text            = telephone;
                    lblFax.Text              = fax;
                    lblHeadname.Text         = dheadname;
                    lblActingDHead.Text      = aheadname;
                    lblActingDHead.ForeColor = System.Drawing.Color.Red;
                    lblDeptRep.Text          = detpRname;
                }
                else
                {
                    Department dept           = deptController.GetDepartByDepCode(dcode);
                    Employee   emp            = deptController.GetDHeadByDeptCode(dcode);
                    Employee   empActingDHead = deptController.GetEmployeeListForActingDHeadSelected(dcode);
                    Employee   empDRep        = deptController.GetEmployeeListForDRepSelected(dcode);
                    string     aheadname      = empActingDHead.EmpName;
                    string     detpRname      = empDRep.EmpName;
                    string     dname          = dept.DeptName;
                    string     contactname    = dept.DeptContactName;
                    string     telephone      = dept.DeptTelephone;
                    string     fax            = dept.DeptFax;
                    string     dheadname      = emp.EmpName;



                    lblDeptName.Text    = dname;
                    lblContactName.Text = contactname;
                    lblPhone.Text       = telephone;
                    lblFax.Text         = fax;
                    lblHeadname.Text    = dheadname;
                    lblActingDHead.Text = aheadname;
                    lblDeptRep.Text     = detpRname;
                }
                //UpdateCollectionPoint
                string empCollectionname = deptController.GetDepartmentForCollectionPointSelected(dcode);
                DropDownListCollectionPoint.DataSource     = deptController.GetCollectionPointList();
                DropDownListCollectionPoint.DataTextField  = "CollectionPoint1";
                DropDownListCollectionPoint.DataValueField = "CollectionLocationID";
                DropDownListCollectionPoint.DataBind();
                DropDownListCollectionPoint.Items.FindByText(empCollectionname).Selected = true;
            }//ispostback
            else
            {
                Utility.logout();
            }
        }
    }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["emp"] != null)
            {
                Employee empSession = (Employee)Session["emp"];
                string   dcode      = empSession.DeptCode;
                string   empRole    = empSession.Role;

                Employee   empActingDHead = deptController.GetEmployeeListForActingDHeadSelected(dcode);
                Employee   empDRep        = deptController.GetEmployeeListForDRepSelected(dcode);
                Department dept           = deptController.GetDepartByDepCode(dcode);
                Employee   emp            = deptController.GetDHeadByDeptCode(dcode);

                string aheadname   = empActingDHead.EmpName;
                string dname       = dept.DeptName;
                string contactname = dept.DeptContactName;
                string telephone   = dept.DeptTelephone;
                string fax         = dept.DeptFax;
                string dheadname   = emp.EmpName;
                string startdate   = empActingDHead.StartDate.GetValueOrDefault().ToShortDateString();
                string enddate     = empActingDHead.EndDate.GetValueOrDefault().ToShortDateString();


                //DateTime? endTime = emp.EndDate;
                lblDeptName.Text    = dname;
                lblContactName.Text = contactname;
                lblPhone.Text       = telephone;
                lblFax.Text         = fax;
                lblHeadname.Text    = dheadname;
                lblActingDHead.Text = aheadname;
                lblStartD.Text      = startdate;
                lblEndD.Text        = enddate;
                int empRid = empDRep.EmpID;//ForDeptRep Id

                //UpdateActingDHead
                string empActingDHeadname = empActingDHead.EmpName;
                int    empid = empActingDHead.EmpID;


                //UpdateDeptRp
                string empDRepname = empDRep.EmpName;
                ddlDRep.DataSource     = deptController.GetEmployeeListForDRep(dcode, empid);
                ddlDRep.DataTextField  = "EmpName";
                ddlDRep.DataValueField = "EmpID";
                ddlDRep.DataBind();
                ddlDRep.Items.FindByText(empDRepname).Selected = true;

                //UpdateCollectionPoint
                string empCollectionname = deptController.GetDepartmentForCollectionPointSelected(dcode);
                ddlCollectionPoint.DataSource     = deptController.GetCollectionPointList();
                ddlCollectionPoint.DataTextField  = "CollectionPoint1";
                ddlCollectionPoint.DataValueField = "CollectionLocationID";
                ddlCollectionPoint.DataBind();
                ddlCollectionPoint.Items.FindByText(empCollectionname).Selected = true;
            }

            else
            {
                Utility.logout();
            }
        }
    }