Пример #1
0
    //AUTHOR : KHIN MYO MYO SHWE
    public List <WCFEmployee> ListForDeptRep(string dcode, string id)
    {
        List <WCFEmployee> wlist = new List <WCFEmployee>();
        List <Employee>    elist = deptController.GetEmployeeListForDRep(dcode, Convert.ToInt16(id));

        foreach (Employee e in elist)
        {
            wlist.Add(WCFEmployee.Make(e.EmpID, e.DeptCode, e.EmpName, e.Role, e.Password, e.Email
                                       , e.IsTempHead, e.StartDate.GetValueOrDefault().ToShortDateString()
                                       , e.EndDate.GetValueOrDefault().ToShortDateString()));
        }
        return(wlist);
    }
Пример #2
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();
            }
        }
    }
Пример #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;

                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();
            }
        }
    }