Esempio n. 1
0
 public Form1()
 {
     InitializeComponent();
     client.BaseAddress = new Uri("http://localhost:53834/");
     client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
     empController  = new EmpController(client);
     deptController = new DeptController(client);
     this.Load     += Form1_LoadAsync;
 }
Esempio n. 2
0
 public static void InitGlobalVar(PowerEntities db, TS_OPERATOR oper)
 {
     Oper = oper;
     DataStateStringList = Enum.GetNames(typeof(DataState)).ToList();
     DeptList            = DeptController.GetList(db);
     RoleList            = RoleController.GetList(db);
     MenuList            = MenuController.GetList(db);
     PortalList          = PortalControler.GetList(db);
     OperList            = OperController.GetList(db);
     OperRoleList        = OperRoleController.GetList(db);
 }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DeptController deptController = new DeptController();

        if (!IsPostBack)
        {
            GridViewDept.DataSource = EFBroker_DeptEmployee.GetDepartDetailInfoList();

            StationeryEntities smodel = new StationeryEntities();
            GridViewDept.DataSource = deptController.GetDepartDetailInfoList();

            GridViewDept.DataBind();
        }
    }
Esempio n. 4
0
    protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        if (Session["emp"] != null)
        {
            emp = (Employee)Session["emp"];
            int    RequestedBy = emp.EmpID;
            string DeptCode    = emp.DeptCode;
            if (gvItemList.Rows.Count <= 0)
            {
                Response.Write("<script>alert('You have not requested any item yet!');</script>");
            }
            else
            {
                RequisitionControl.addNewRequisitionItem(rItem, DateTime.Now, "Pending", RequestedBy, DeptCode);

                DeptController dc       = new DeptController();
                Employee       tempHead = EmployeeController.GetDeptHeadTempHeadEmail(emp);
                Employee       deptHead = dc.GetDHeadByDeptCode(emp.DeptCode);

                if (tempHead != null)
                {
                    string mail                 = tempHead.Email;
                    string receiver             = mail;
                    Thread emailThreadWithParam = new Thread(() => TempMailNotification(receiver));
                    emailThreadWithParam.Start();
                }


                if (deptHead != null)
                {
                    string mail1                 = deptHead.Email;
                    string receiver1             = mail1;
                    Thread emailThreadWithParam1 = new Thread(() => HeadMailNotification(receiver1));
                    emailThreadWithParam1.Start();
                }
                Response.Redirect(LoginController.RequisitionListDepEmpURI);
            }
            //Response.Write("<script language='javascript'>alert('Requisition Submitted');</script>");
            //Server.Transfer("RequisitionListDepartment.aspx", true);
        }
        else
        {
            Utility.logout();
        }
    }
    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();
        }
    }
Esempio n. 6
0
        public DeptView()
        {
            InitializeComponent();

            DeptController controller = new DeptController();
        }