Example #1
0
    public int DeleteEMPData(EmployeeInfo EmpInfo,string userID)
    {
        int flag=0;
        SqlConnection sqlCon = new SqlConnection(conStr);
        SqlCommand sqlCmd = new SqlCommand("sp_delete_EmployeeInfo", sqlCon);
        sqlCmd.CommandType = CommandType.StoredProcedure;

        SqlParameter sp_empID = sqlCmd.Parameters.Add("@EMP_ID", SqlDbType.Int);
        sp_empID.Value = EmpInfo.EMPID;

        SqlParameter pUserID = sqlCmd.Parameters.Add("@UserID", SqlDbType.VarChar, 20);
        pUserID.Value = userID;

        try
        {
            sqlCon.Open();
            sqlCmd.ExecuteNonQuery();
            flag = 1;
        }
        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);

        }
        finally
        {
            sqlCon.Close();
        }
        return flag;
    }
        public void CalculatePayslip_ShouldReturnPayslip()
        {
            // Arrange
            EmployeeInfo employeeInfo = new EmployeeInfo
            {
                FirstName = "David",
                LastName = "Rudd",
                AnnualSalary = 60050,
                SuperRate = 0.09M,
                PaymentStartDate = "01 March – 31 March",
            };

            // Act
            Payslip actual = this.employeeIncomeService.CalculatePayslip(employeeInfo);

            // Assert
            Payslip expected = new Payslip
            {
                Name = "David Rudd",
                PayPeriod = "01 March – 31 March",
                GrossIncome = 5004,
                IncomeTax = 922,
                NetIncome = 4082,
                Super = 450
            };

            actual.ShouldBeEquivalentTo(expected);
        }
 private void CheckAnnualSalary(EmployeeInfo employeeInfo)
 {
     if (employeeInfo.AnnualSalary < 0)
     {
         throw new OverflowException();
     }
 }
        private void EmailEveryone(MonthlyValidationReminderRecords records)
        {
            EmployeeInfo e = new EmployeeInfo();
            Employees userList = e.GetAllUserEmails();

            foreach (Employee user in userList)
            {
                string email = user.Email;

                StringBuilder emailBuilder = new StringBuilder();
                string templatePath = HttpContext.Current.Server.MapPath(AppConfiguration.Current.MonthlyValidationReminder);
                string templateText = File.ReadAllText(templatePath);
                DotLiquid.Template.RegisterSafeType(typeof(MonthlyValidationReminderRecord), new string[] { "FacilityName", "EmmittingAssetName", "UnitOfMeasure", "ValidationPeriod", "EmissionVolume", "FormattedVolume" });
                Template template = Template.Parse(templateText);

                string date = DateTime.Now.AddMonths(-1).ToString("MMMM yyyy");

                string html = template.Render(Hash.FromAnonymousObject(new { Date = date, SystemAdmin = config.SystemAdmin, Kickouts = records }));

                if (email != null)
                    SendEmail(html, config.MonthyValidationReminderSubject, config.SystemAdmin, email);
                else
                    EmailTechnicalError("Could not send kickout report to: " + user);
            }
        }
Example #5
0
 /// <summary>
 /// Adds the item.
 /// </summary>
 public void AddItem()
 {
     var employeeInfo = new EmployeeInfo();
     if (employeeInfo.ShowDialog() == true & employeeInfo.CurrentEmployee != null)
     {
         var employee = employeeInfo.CurrentEmployee;
         Employees.Add(employeeInfo.CurrentEmployee);
     }
 }
        public async Task<ActionResult> Edit(int id,EmployeeInfo Emp)
        {

            HttpResponseMessage responseMessage = await client.PutAsJsonAsync(url+"/" +id, Emp);
            if (responseMessage.IsSuccessStatusCode)
            {
                return RedirectToAction("Index");
            }
            return RedirectToAction("Error");
        }
Example #7
0
 /// <summary>
 /// Edits selected item.
 /// </summary>
 public void EditItem()
 {
     if (MainDataGrid.SelectedIndex >= 0)
     {
         Employee employee = MainDataGrid.SelectedItem as Employee;
         var employeeInfo = new EmployeeInfo();
         employeeInfo.DataContext = employee;
         employeeInfo.ShowDialog();
     }
 }
Example #8
0
        public void SaveEmployee(EmployeeInfo employeeInfo)
        {
            if (employeeInfo == null)
                return;

            var employee = (Employee) employeeInfo;

            var empFact = employee.GetFactory();

            empFact.Persist(employee);
        }
 public bool AddEmployee(EmployeeInfo.Employee emp)
 {
     if (emp == null)
     {
         return false;
     }
     else
     {
         EmployeeInfo.Employee.DefaultEmployees.Add(emp);
         return true;
     }
 }
 public Result<EmployeeInfo> Get()
 {
     View.Run();
     EmployeeInfo info = null;
     if (ServiceResult == ServiceResult.Ok)
     {
         info = new EmployeeInfo
             {
                 FirstName = FirstName,
                 LastName = LastName,
                 Email = Email
             };
     }
     Result<EmployeeInfo> result = new Result<EmployeeInfo>(ServiceResult, info);
     return result;
 }
        public Payslip CalculatePayslip(EmployeeInfo employeeInfo)
        {
            this.CheckSuperRate(employeeInfo);
            this.CheckAnnualSalary(employeeInfo);

            Payslip payslip = new Payslip();

            this.CalcName(employeeInfo, payslip);
            this.CalcPayPeriod(employeeInfo, payslip);
            this.CalcGrossIncome(employeeInfo, payslip);
            this.CalcIncomeTax(employeeInfo, payslip);
            this.CalcNetIncome(payslip);
            this.CalcSuper(employeeInfo, payslip);

            return payslip;
        }
 public bool ModifyEmployees(EmployeeInfo.Employee emp)
 {
     if (emp == null)
     {
         return false;
     }
     else
     {
         for (int i = 0; i < EmployeeInfo.Employee.DefaultEmployees.Count; i++)
         {
             if (EmployeeInfo.Employee.DefaultEmployees[i].Id == emp.Id)
             {
                 EmployeeInfo.Employee.DefaultEmployees[i] = emp;
             }
         }
         return true;
     }
 }
	// *****************************************************************************
	// Returns the list of all employees
	public EmployeeInfo GetEmployeeDetails(int empID)
	{
		// Get details about the specified employee
		SqlDataAdapter adapter = new SqlDataAdapter(
            String.Format(EmployeeCommandList.cmdEmployeeDetails, empID),
			ConfigurationManager.ConnectionStrings["J2EENorthwind"].ConnectionString);
		DataTable table = new DataTable();
		adapter.Fill(table);

		// Execute the command and populate the return buffer
		DataRow row = table.Rows[0];
		EmployeeInfo info = new EmployeeInfo();
		info.ID = empID;
		info.FirstName = row["firstname"].ToString();
		info.LastName = row["lastname"].ToString();
		info.Title = row["title"].ToString();
		info.Country = row["country"].ToString();
		info.Notes = row["notes"].ToString();

		return info;
	}
Example #14
0
    public DataTable GetEMPData(EmployeeInfo EmpInfo)
    {
        SqlConnection sqlCon = new SqlConnection(conStr);
        SqlCommand sqlCmd = new SqlCommand("sp_getEmployeeInfo", sqlCon);
        sqlCmd.CommandType = CommandType.StoredProcedure;

        SqlParameter sp_empID = sqlCmd.Parameters.Add("@EMP_ID", SqlDbType.Int);
        sp_empID.Value = EmpInfo.EMPID;

        SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
        DataSet dsemp = new DataSet();
        try
        {
            sqlDa.Fill(dsemp, "Details");
        }
        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);
        }
        return dsemp.Tables["Details"];
    }
        public void CalculatePayslip_ShouldNOTThrowOverflowException_WhenAnnualSalaryIsIntMaxAndSuperRateIsGreaterThan50OrLessThan0(decimal superRate)
        {
            // Arrange
            EmployeeInfo employeeInfo = new EmployeeInfo
            {
                FirstName = "David",
                LastName = "Rudd",
                AnnualSalary = int.MaxValue,
                SuperRate = superRate,
                PaymentStartDate = "01 March – 31 March",
            };

            // Act
            Action action = () =>
            {
                this.employeeIncomeService.CalculatePayslip(employeeInfo);
            };

            // Assert
            action.ShouldNotThrow<OverflowException>();
        }
        public void InitClass()
        {
            EmployeeInfo info = MockRepository.Mock <EmployeeInfo>("ID001");

            Assert.NotNull(info);
        }
Example #17
0
        //
        // GET: /Base/

        //public ActionResult Index()
        //{
        //    return View();
        //}

        //
        // 摘要:
        //     在调用操作方法前调用。
        //
        // 参数:
        //   filterContext:
        //     有关当前请求和操作的信息。
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //接收登陆的用户名
            EmployeeInfo em = filterContext.HttpContext.Session["Employeer"] as EmployeeInfo;


            /*收件箱 GetEmailMessages HaverID,IsDel=0,IsRead=0*/
            EmailDal dalem = new EmailDal();

            if (em != null)
            {
                List <GetEmailMessages> get = dalem.GetHaverEmail(em.ID, 0, 0);
                Session["list"]    = get;
                Session["HaveNum"] = get.Count;
            }
            else
            {
                RedirectToAction("/login/login");
            }

            /*地址栏可输入跳转!!!*/
            /*-----------------------------------锁屏开始------------------------------------------*/
            //拿到控制器名称
            string controllerName = filterContext.RouteData.Values["controller"].ToString();
            //拿到视图名称
            string actionName = filterContext.RouteData.Values["action"].ToString();

            //全路径 string url = Request.Url.ToString();    http://localhost:1224/home/main/1
            //虚拟路径 string url = Request.Path;            /home/main/1

            string url = Request.Path;

            //判断是否锁屏
            if (controllerName == "home" && actionName == "lock")
            {
                Session["isLock"] = "true";
            }


            if (Session["isLock"] != null && Session["isLock"] == "true")
            {
                if (url == "/home/main/" + em.LoginPassword)
                {
                    filterContext.RouteData.Values["controller"] = "home";
                    filterContext.RouteData.Values["action"]     = "main";
                    Session["isLock"] = "false";
                }
                else
                {
                    filterContext.RouteData.Values["controller"] = "home";
                    filterContext.RouteData.Values["action"]     = "lock";
                }
            }

            /*-----------------------------------锁屏结束------------------------------------------*/


            //登陆失败跳转到登陆页面
            if (em == null)
            {
                filterContext.Result = new RedirectResult("/login/login");
            }
            else
            {
                EmployeeDal dal = new EmployeeDal();

                RoleInfo r      = dal.GetRoleByEmployeeID(em.ID);
                int      roleID = r.ID;                                  //获取角色ID
                List <PermissionInfo> alllist = dal.GetAllPermissions(); //查询所有菜单栏
                //判断用户有无角色
                if (r != null)
                {
                    ViewBag.roleName = r.RoleName;
                    if (roleID == 1)
                    {
                        ViewBag.list = alllist;
                    }
                    else
                    {
                        /*
                         * 根据员工id 查询该员工的所有权限(角色权限+个人权限)
                         */
                        List <PermissionInfo> allpers = dal.GetPers(em.ID);
                        ViewBag.allpers = allpers;
                    }
                }
            }
        }
Example #18
0
    public int update_EmpInfo(EmployeeInfo EmpInfo,string userID)
    {
        int flag = 0;
        SqlConnection sqlCon = new SqlConnection(conStr);
        SqlCommand sqlCmd = new SqlCommand("sp_update_MEmployee", sqlCon);
        sqlCmd.CommandType = CommandType.StoredProcedure;

        SqlParameter sp_empID = sqlCmd.Parameters.Add("@Emp_ID", SqlDbType.Int);
        sp_empID.Value = EmpInfo.EMPID;

        SqlParameter Emp_FName = sqlCmd.Parameters.Add("@Emp_FName", SqlDbType.VarChar, 25);
        Emp_FName.Value = EmpInfo.EMPFName;

        SqlParameter Emp_MName = sqlCmd.Parameters.Add("@Emp_MName", SqlDbType.VarChar, 15);
        Emp_MName.Value = EmpInfo.EMPMName;

        SqlParameter Emp_LName = sqlCmd.Parameters.Add("@Emp_LName", SqlDbType.VarChar, 25);
        Emp_LName.Value = EmpInfo.EMPLName;

        SqlParameter Emp_Address1 = sqlCmd.Parameters.Add("@Emp_Address", SqlDbType.VarChar, 50);
        Emp_Address1.Value = EmpInfo.Address1;

        SqlParameter Emp_Address2 = sqlCmd.Parameters.Add("@Emp_Address2", SqlDbType.VarChar, 50);
        Emp_Address2.Value = EmpInfo.Address2;

        SqlParameter Emp_City = sqlCmd.Parameters.Add("@Emp_City", SqlDbType.VarChar, 50);
        Emp_City.Value = EmpInfo.City;

        SqlParameter Emp_State = sqlCmd.Parameters.Add("@Emp_State", SqlDbType.VarChar, 50);
        Emp_State.Value = EmpInfo.State;

        SqlParameter Emp_Zip = sqlCmd.Parameters.Add("@Emp_Zip", SqlDbType.VarChar, 10);
        Emp_Zip.Value = EmpInfo.ZIP;

        SqlParameter Emp_Phone = sqlCmd.Parameters.Add("@Emp_Phone", SqlDbType.VarChar, 12);
        Emp_Phone.Value = EmpInfo.Phone;

        SqlParameter Emp_HomePhone = sqlCmd.Parameters.Add("@Emp_HomePhone", SqlDbType.VarChar, 12);
        Emp_HomePhone.Value = EmpInfo.Pat_CellPhone;

        //@Emp_Email

        SqlParameter Emp_Email = sqlCmd.Parameters.Add("@Emp_Email", SqlDbType.VarChar, 50);
        Emp_Email.Value = EmpInfo.EMail;

        //@Emp_HireDate

        SqlParameter Emp_HireDate = sqlCmd.Parameters.Add("@Emp_HireDate", SqlDbType.Date);
        Emp_HireDate.Value = EmpInfo.EMPHireDate.ToShortDateString();

        SqlParameter Emp_TermDate = sqlCmd.Parameters.Add("@Emp_TermDate", SqlDbType.Date);
        Emp_TermDate.Value = EmpInfo.EMPTermDate.ToShortDateString();

        SqlParameter Emp_Sup1 = sqlCmd.Parameters.Add("@Emp_Sup1", SqlDbType.Int);
        if (EmpInfo.EMPSup1 != 0)
            Emp_Sup1.Value = EmpInfo.EMPSup1;

        SqlParameter Emp_Sup2 = sqlCmd.Parameters.Add("@Emp_Sup2", SqlDbType.Int);
        if (EmpInfo.EMPSup2 != 0)
            Emp_Sup2.Value = EmpInfo.EMPSup2;

        SqlParameter Emp_LocID = sqlCmd.Parameters.Add("@Emp_LocID", SqlDbType.Int);
        if (EmpInfo.LocationID != 0)
        {
            Emp_LocID.Value = EmpInfo.LocationID;
        }
        else
            Emp_LocID.Value = Convert.DBNull;

        SqlParameter Emp_TitleID = sqlCmd.Parameters.Add("@Emp_TitleID", SqlDbType.Int);
        if (EmpInfo.TitleID != 0)
        {
            Emp_TitleID.Value = EmpInfo.TitleID;
        }
        else
            Emp_TitleID.Value = Convert.DBNull;

        //@Emp_Role
        SqlParameter Emp_Role = sqlCmd.Parameters.Add("@Emp_Role", SqlDbType.VarChar, 10);
        Emp_Role.Value = EmpInfo.Role;

        SqlParameter Isapprov = sqlCmd.Parameters.Add("@Isapprov", SqlDbType.Char, 1);
        Isapprov.Value = EmpInfo.IsApprove;

        SqlParameter Emp_Status = sqlCmd.Parameters.Add("@Emp_Status", SqlDbType.Char, 1);
        Emp_Status.Value = EmpInfo.Status;

        SqlParameter Emp_Comments = sqlCmd.Parameters.Add("@Emp_Comments", SqlDbType.Char, 255);
        Emp_Comments.Value = EmpInfo.Comments;

        SqlParameter pUserID = sqlCmd.Parameters.Add("@UserID", SqlDbType.VarChar, 20);
        pUserID.Value = userID;

        try
        {
            sqlCon.Open();
            sqlCmd.ExecuteNonQuery();

            flag = 1;
        }
        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);

        }
        finally
        {
            sqlCon.Close();
        }
        return flag;
    }
        public void CalculatePayslip_ShouldReturnPayslip_WhenAnnualSalaryIsIntMaxAndSuperRateIs50()
        {
            // Arrange
            EmployeeInfo employeeInfo = new EmployeeInfo
            {
                FirstName = "David",
                LastName = "Rudd",
                AnnualSalary = int.MaxValue,
                SuperRate = 0.5M,
                PaymentStartDate = "01 March – 31 March",
            };

            // Act
            Payslip actual = this.employeeIncomeService.CalculatePayslip(employeeInfo);

            // Assert
            Payslip expected = new Payslip
            {
                Name = "David Rudd",
                PayPeriod = "01 March – 31 March",
                GrossIncome = 178956970,
                IncomeTax = 80528432,
                NetIncome = 98428538,
                Super = 89478485
            };

            actual.ShouldBeEquivalentTo(expected);
        }
 public static void deleteEmployeeInfo(EmployeeInfo EmployeeInfoObj)
 {
     EmployeeInfoDBMapper dbm = new EmployeeInfoDBMapper();
     dbm.delete(EmployeeInfoObj);
 }
Example #21
0
        protected void PageInit()
        {
            int             dsid = Convert.ToInt32(Request["DriverScoreId"].ToString());
            DriverScoreInfo ds   = new DriverScoreInfo(dsid);

            EmployeeInfo em = new EmployeeInfo(Convert.ToInt32(ds.EmployeeId));

            lblName.Text = em.EmployeeName.ToString();
            PositionInfo position = new PositionInfo(Convert.ToInt32(em.PositionId));

            lblPosition.Text = position.PositionName.ToString();
            DepartInfo depart = new DepartInfo(Convert.ToInt32(em.DepartId));

            lblDepart.Text = depart.DepartName.ToString();

            //ddlYear.SelectedValue=ds.YearId.ToString();
            //ddlMonth.SelectedValue=ds.MonthId.ToString();

            YearInfo  year  = new YearInfo(Convert.ToInt32(ds.YearId));
            MonthInfo month = new MonthInfo(Convert.ToInt32(ds.MonthId));

            lblDate.Text = year.YearName + "Äê" + month.MonthNames + "ÔÂ";

            lblSelfds1.Text  = ds.Selfds1.ToString();
            lblSelfds2.Text  = ds.Selfds2.ToString();
            lblSelfds3.Text  = ds.Selfds3.ToString();
            lblSelfds4.Text  = ds.Selfds4.ToString();
            lblSelfds5.Text  = ds.Selfds5.ToString();
            lblSelfds6.Text  = ds.Selfds6.ToString();
            lblSelfds7.Text  = ds.Selfds7.ToString();
            lblSelfds8.Text  = ds.Selfds8.ToString();
            lblSelfds9.Text  = ds.Selfds9.ToString();
            lblSelfds10.Text = ds.Selfds10.ToString();
            lblSelfds11.Text = ds.Selfds11.ToString();
            lblSelfds12.Text = ds.Selfds12.ToString();
            lblSelfds13.Text = ds.Selfds13.ToString();
            lblSelfds14.Text = ds.Selfds14.ToString();
            lblSelfds15.Text = ds.Selfds15.ToString();
            lblSelfds16.Text = ds.Selfds16.ToString();
            lblSelfds17.Text = ds.Selfds17.ToString();
            lblSelfds18.Text = ds.Selfds18.ToString();
            lblSelfds19.Text = ds.Selfds19.ToString();
            lblSelfds20.Text = ds.Selfds20.ToString();
            lblSelfds21.Text = ds.Selfds21.ToString();
            lblSelfds22.Text = ds.Selfds22.ToString();
            lblSelfds23.Text = ds.Selfds23.ToString();

            lblUpds1.Text  = ds.Upds1.ToString();
            lblUpds2.Text  = ds.Upds2.ToString();
            lblUpds3.Text  = ds.Upds3.ToString();
            lblUpds4.Text  = ds.Upds4.ToString();
            lblUpds5.Text  = ds.Upds5.ToString();
            lblUpds6.Text  = ds.Upds6.ToString();
            lblUpds7.Text  = ds.Upds7.ToString();
            lblUpds8.Text  = ds.Upds8.ToString();
            lblUpds9.Text  = ds.Upds9.ToString();
            lblUpds10.Text = ds.Upds10.ToString();
            lblUpds11.Text = ds.Upds11.ToString();
            lblUpds12.Text = ds.Upds12.ToString();
            lblUpds13.Text = ds.Upds13.ToString();
            lblUpds14.Text = ds.Upds14.ToString();
            lblUpds15.Text = ds.Upds15.ToString();
            lblUpds16.Text = ds.Upds16.ToString();
            lblUpds17.Text = ds.Upds17.ToString();
            lblUpds18.Text = ds.Upds18.ToString();
            lblUpds19.Text = ds.Upds19.ToString();
            lblUpds20.Text = ds.Upds20.ToString();
            lblUpds21.Text = ds.Upds21.ToString();
            lblUpds22.Text = ds.Upds22.ToString();
            lblUpds23.Text = ds.Upds23.ToString();

            lblSectds1.Text  = ds.Secds1.ToString();
            lblSectds2.Text  = ds.Secds2.ToString();
            lblSectds3.Text  = ds.Secds3.ToString();
            lblSectds4.Text  = ds.Secds4.ToString();
            lblSectds5.Text  = ds.Secds5.ToString();
            lblSectds6.Text  = ds.Secds6.ToString();
            lblSectds7.Text  = ds.Secds7.ToString();
            lblSectds8.Text  = ds.Secds8.ToString();
            lblSectds9.Text  = ds.Secds9.ToString();
            lblSectds10.Text = ds.Secds10.ToString();
            lblSectds11.Text = ds.Secds11.ToString();
            lblSectds12.Text = ds.Secds12.ToString();
            lblSectds13.Text = ds.Secds13.ToString();
            lblSectds14.Text = ds.Secds14.ToString();
            lblSectds15.Text = ds.Secds15.ToString();
            lblSectds16.Text = ds.Secds16.ToString();
            lblSectds17.Text = ds.Secds17.ToString();
            lblSectds18.Text = ds.Secds18.ToString();
            lblSectds19.Text = ds.Secds19.ToString();
            lblSectds20.Text = ds.Secds20.ToString();
            lblSectds21.Text = ds.Secds21.ToString();
            lblSectds22.Text = ds.Secds22.ToString();
            lblSectds23.Text = ds.Secds23.ToString();

            lblTotalScore.Text = ds.TotalScore.ToString();
        }
Example #22
0
        public override string ToString()
        {
            StringBuilder __sb    = new StringBuilder("Employment(");
            bool          __first = true;

            if (__isset.userId)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("UserId: ");
                __sb.Append(UserId);
            }
            if (__isset.mode)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Mode: ");
                __sb.Append(Mode);
            }
            if (EmployeeInfo != null && __isset.employeeInfo)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("EmployeeInfo: ");
                __sb.Append(EmployeeInfo == null ? "<null>" : EmployeeInfo.ToString());
            }
            if (__isset.personEmploymentId)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("PersonEmploymentId: ");
                __sb.Append(PersonEmploymentId);
            }
            if (__isset.requestId)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("RequestId: ");
                __sb.Append(RequestId);
            }
            if (City != null && __isset.city)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("City: ");
                __sb.Append(City == null ? "<null>" : City.ToString());
            }
            if (DbStatus != null && __isset.dbStatus)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("DbStatus: ");
                __sb.Append(DbStatus == null ? "<null>" : DbStatus.ToString());
            }
            if (EmployeeIds != null && __isset.employeeIds)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("EmployeeIds: ");
                __sb.Append(EmployeeIds);
            }
            if (__isset.rating)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Rating: ");
                __sb.Append(Rating);
            }
            __sb.Append(")");
            return(__sb.ToString());
        }
        List <EmployeeInfo> GetEmployeeList()
        {
            //上月期间开始
            DateTime date = SalaryResult.GetLastSalaryDate(group);

            //2018-7-11 获取软件开发人员
            List <EmployeeInfo> developer_list = new List <EmployeeInfo>();
            List <string>       names          = Developer.GetDeveloperList();

            foreach (string name in names)
            {
                EmployeeInfo emp = EmployeeInfo.GetEmployeeInfoByName(name);
                if (emp != null)
                {
                    developer_list.Add(emp);
                }
            }

            List <EmployeeInfo> emp_list = new List <EmployeeInfo>();

            if (jobgrade != null)
            {
                if (salary_plan == "软件开发")
                {
                    emp_list = developer_list;
                }
                else
                {
                    //先将在职员工信息加载到内存
                    EmployeeInfo.GetEmployeeList(company_code, group, true);
                    //获取上月工资表中的人员名单
                    emp_list = SalaryResult.GetEmployeeList(date.Year, date.Month, company_code, group, !check包括离职人员.Checked);

                    //剔除软件开发人员
                    foreach (EmployeeInfo emp in developer_list)
                    {
                        emp_list.RemoveAll(a => a.员工编号 == emp.员工编号);
                    }
                }
            }
            else
            {
                if (group == "管培生")
                {
                    //先将在职员工信息加载到内存
                    EmployeeInfo.GetEmployeeList(company_code, null, true);
                    //获取上月工资表中的人员名单
                    emp_list = SalaryResult.GetEmployeeList(date.Year, date.Month, company_code, null, !check包括离职人员.Checked);
                    //移除非管培生
                    emp_list.RemoveAll(a => a.是管培生 == false);
                }
                else
                {
                    string[] grade_list = null;
                    if (group == "副总经理以上")
                    {
                        grade_list = 副总经理以上职等.Split(new char[] { ',' });
                    }
                    if (grade_list != null)
                    {
                        for (int i = 0; i < grade_list.Length; i++)
                        {
                            //先将在职员工信息加载到内存
                            EmployeeInfo.GetEmployeeList(company_code, group, true);
                            //获取上月工资表中的人员名单
                            List <EmployeeInfo> emps = SalaryResult.GetEmployeeList(date.Year, date.Month, company_code, grade_list[i], !check包括离职人员.Checked);
                            emp_list.AddRange(emps);
                        }
                    }
                }
                //剔除软件开发人员
                foreach (EmployeeInfo emp in developer_list)
                {
                    emp_list.RemoveAll(a => a.员工编号 == emp.员工编号);
                }
            }
            //如果不是管培生组,剔除管培生
            if (group != "管培生")
            {
                emp_list.RemoveAll(a => a.是管培生);
            }

            return(emp_list);
        }
Example #24
0
        static void Main(string[] args)
        {
            // Constants
            const int kNumWeeksPerYear = 52;

            Double[] kTaxCutoffs =               // Cutoff income for tax brackets
            {
                9525, 38700, 82500, 157500, 200000, 500000
            };
            Double[] kTaxPercents =               // Percentages for tax brackets
            {
                .10, .12, .22, .24, .32, .35, .37
            };

            Console.WriteLine("Payroll Calculator");                   // Output program name

            List <EmployeeInfo> employees = new List <EmployeeInfo>(); // Hold information on all employees

            // Main application loop
            while (true)
            {
                EmployeeInfo tmp = new EmployeeInfo();                 // Builder struct

                Console.Write("\n");

                // Get employee name
                do
                {
                    Console.Write("Enter employee name (type 'done' to stop): ");
                    tmp.sEmployeeName = Console.ReadLine();
                } while (tmp.sEmployeeName == "");
                if (tmp.sEmployeeName == "done")
                {
                    break;               // Stop entering names if done
                }
                String inputBuffer = ""; // Buffer to hold input to number
                do                       // Input hourly rate
                {
                    Console.Write("Enter hourly pay rate: ");
                    inputBuffer = Console.ReadLine();
                } while (!Double.TryParse(inputBuffer, out tmp.numHourlyRate));

                inputBuffer = "";    // Clear buffer
                do                   // Input hours worked
                {
                    Console.Write("Enter hours worked: ");
                    inputBuffer = Console.ReadLine();
                } while (!Double.TryParse(inputBuffer, out tmp.numHoursWorked));

                // Calculate gross pay per week & estimate per year
                tmp.numGrossPay     = tmp.numHourlyRate * tmp.numHoursWorked;
                tmp.numGrossPerYear = tmp.numGrossPay * kNumWeeksPerYear;

                // Set tax percentage
                ushort taxNdx = 0;
                while (tmp.numGrossPerYear > kTaxCutoffs[taxNdx])
                {
                    taxNdx++;
                }
                tmp.numNetPay        = tmp.numGrossPay - (tmp.numGrossPay * kTaxPercents[taxNdx]); // Calculate net pay
                tmp.numTaxesDeducted = tmp.numGrossPay * kTaxPercents[taxNdx];                     // Calculate deducted taxes

                employees.Add(tmp);                                                                // Copy builder to new ndx of employee list
            }

            // Output information
            foreach (EmployeeInfo obj in employees)
            {
                Console.WriteLine("\n");                 // 2 newlines
                Console.WriteLine("Payroll information for employee: " + obj.sEmployeeName);
                Console.WriteLine("Hourly rate:                      " + obj.numHourlyRate);
                Console.WriteLine("Hours worked:                     " + obj.numHoursWorked);
                Console.WriteLine("Gross pay:                        " + obj.numGrossPay);
                Console.WriteLine("Estimated yearly gross pay:       " + obj.numGrossPerYear);
                Console.WriteLine("Taxes deducted:                   " + obj.numTaxesDeducted);
                Console.WriteLine("Net pay this week:                " + obj.numNetPay);
            }

            // Emulate DOS shell pause
            Console.WriteLine(" Press any key to continue . . . ");
            Console.ReadKey();
        }
Example #25
0
        public void Write(TProtocol oprot)
        {
            TStruct struc = new TStruct("Employment");

            oprot.WriteStructBegin(struc);
            TField field = new TField();

            if (__isset.userId)
            {
                field.Name = "userId";
                field.Type = TType.I32;
                field.ID   = 1;
                oprot.WriteFieldBegin(field);
                oprot.WriteI32(UserId);
                oprot.WriteFieldEnd();
            }
            if (__isset.mode)
            {
                field.Name = "mode";
                field.Type = TType.I16;
                field.ID   = 2;
                oprot.WriteFieldBegin(field);
                oprot.WriteI16(Mode);
                oprot.WriteFieldEnd();
            }
            if (EmployeeInfo != null && __isset.employeeInfo)
            {
                field.Name = "employeeInfo";
                field.Type = TType.Struct;
                field.ID   = 3;
                oprot.WriteFieldBegin(field);
                EmployeeInfo.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (__isset.personEmploymentId)
            {
                field.Name = "personEmploymentId";
                field.Type = TType.I64;
                field.ID   = 4;
                oprot.WriteFieldBegin(field);
                oprot.WriteI64(PersonEmploymentId);
                oprot.WriteFieldEnd();
            }
            if (__isset.requestId)
            {
                field.Name = "requestId";
                field.Type = TType.I64;
                field.ID   = 5;
                oprot.WriteFieldBegin(field);
                oprot.WriteI64(RequestId);
                oprot.WriteFieldEnd();
            }
            if (City != null && __isset.city)
            {
                field.Name = "city";
                field.Type = TType.Struct;
                field.ID   = 6;
                oprot.WriteFieldBegin(field);
                City.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (DbStatus != null && __isset.dbStatus)
            {
                field.Name = "dbStatus";
                field.Type = TType.Struct;
                field.ID   = 7;
                oprot.WriteFieldBegin(field);
                DbStatus.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (EmployeeIds != null && __isset.employeeIds)
            {
                field.Name = "employeeIds";
                field.Type = TType.String;
                field.ID   = 8;
                oprot.WriteFieldBegin(field);
                oprot.WriteString(EmployeeIds);
                oprot.WriteFieldEnd();
            }
            if (__isset.rating)
            {
                field.Name = "rating";
                field.Type = TType.I32;
                field.ID   = 9;
                oprot.WriteFieldBegin(field);
                oprot.WriteI32(Rating);
                oprot.WriteFieldEnd();
            }
            oprot.WriteFieldStop();
            oprot.WriteStructEnd();
        }
 public ActionResult Create(EmployeeInfo Emp)
 {
     _repository.Add(Emp);
     return(RedirectToAction("Index"));
 }
        public ActionResult Create()
        {
            var Emp = new EmployeeInfo();

            return(View(Emp));
        }
Example #28
0
        public bool EmployeeInsert(EmployeeInfo empInfo)
        {
            try
            {
                SqlParameter[] param = new SqlParameter[29];
                int            i;

                param[0]  = new SqlParameter("@FirstName", SqlDbType.VarChar);
                param[1]  = new SqlParameter("@MiddleName", SqlDbType.VarChar);
                param[2]  = new SqlParameter("@LastName", SqlDbType.VarChar);
                param[3]  = new SqlParameter("@BirthDate", SqlDbType.DateTime);
                param[4]  = new SqlParameter("@Gender", SqlDbType.VarChar);
                param[5]  = new SqlParameter("@CivilStatus", SqlDbType.Int);
                param[6]  = new SqlParameter("@SSNo", SqlDbType.VarChar);
                param[7]  = new SqlParameter("@TinNo", SqlDbType.VarChar);
                param[8]  = new SqlParameter("@Citizenship", SqlDbType.VarChar);
                param[9]  = new SqlParameter("@MobileNo", SqlDbType.VarChar);
                param[10] = new SqlParameter("@HomePhoneNo", SqlDbType.VarChar);
                param[11] = new SqlParameter("@Street1", SqlDbType.VarChar);
                param[12] = new SqlParameter("@Street2", SqlDbType.VarChar);
                param[13] = new SqlParameter("@City", SqlDbType.VarChar);
                param[14] = new SqlParameter("@State", SqlDbType.VarChar);
                param[15] = new SqlParameter("@Country", SqlDbType.VarChar);
                param[16] = new SqlParameter("@EducBackGround", SqlDbType.VarChar);
                param[17] = new SqlParameter("@Recognitions", SqlDbType.VarChar);
                param[18] = new SqlParameter("@Email", SqlDbType.VarChar);
                param[19] = new SqlParameter("@EnterpriseId", SqlDbType.VarChar);


                param[20] = new SqlParameter("@Level", SqlDbType.Int);
                param[21] = new SqlParameter("@LMU", SqlDbType.VarChar);
                param[22] = new SqlParameter("@GMU", SqlDbType.VarChar);
                param[23] = new SqlParameter("@DateHired", SqlDbType.DateTime);
                param[24] = new SqlParameter("@WorkGroup", SqlDbType.VarChar);
                param[25] = new SqlParameter("@Specialty", SqlDbType.Int);
                param[26] = new SqlParameter("@ServiceLine", SqlDbType.VarChar);
                param[27] = new SqlParameter("@Status", SqlDbType.VarChar);
                param[28] = new SqlParameter("@CreatedBy", SqlDbType.Int);



                param[0].Value  = empInfo.FirstName;
                param[1].Value  = empInfo.MiddleName;
                param[2].Value  = empInfo.LastName;
                param[3].Value  = empInfo.BirthDate;
                param[4].Value  = empInfo.Gender;
                param[5].Value  = empInfo.CivilStatus;
                param[6].Value  = empInfo.SSNo;
                param[7].Value  = empInfo.TinNo;
                param[8].Value  = empInfo.Citizenship;
                param[9].Value  = empInfo.MobileNo;
                param[10].Value = empInfo.HomePhoneNo;
                param[11].Value = empInfo.Street1;
                param[12].Value = empInfo.Street2;
                param[13].Value = empInfo.City;
                param[14].Value = empInfo.State;
                param[15].Value = empInfo.Country;
                param[16].Value = empInfo.EducBackGround;
                param[17].Value = empInfo.Recognitions;
                param[18].Value = empInfo.AccentureDetailsInfo.Email;
                param[19].Value = empInfo.AccentureDetailsInfo.EnterpriseId;


                param[20].Value = empInfo.AccentureDetailsInfo.Level;
                param[21].Value = empInfo.AccentureDetailsInfo.LMU;
                param[22].Value = empInfo.AccentureDetailsInfo.GMU;
                param[23].Value = empInfo.AccentureDetailsInfo.DateHired;
                param[24].Value = empInfo.AccentureDetailsInfo.WorkGroup;
                param[25].Value = empInfo.AccentureDetailsInfo.Specialty;
                param[26].Value = empInfo.AccentureDetailsInfo.ServiceLine;
                param[27].Value = empInfo.AccentureDetailsInfo.Status;
                param[28].Value = empInfo.CreatedBy;

                i = SqlHelper.ExecuteNonQuery(constr, CommandType.StoredProcedure, "spCreateEmployee", param);


                if (i > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (SqlException ex)
            {
                new CustomException(ex.Message, "Employee DAO", "You are inside an exception", ex.StackTrace, " ", CreatedBy);
                return(false);
            }
        }
        /// <summary>
        /// Reload the EmployeeInfo from the database
        /// </summary>
        /// <remarks>
        /// use this method when you want to relad the EmployeeInfo 
        /// from the database, discarding any changes
        /// </remarks>
        public static void reload(ref EmployeeInfo mo)
        {
            if (mo == null) {
                throw new System.ArgumentNullException("null object past to reload function");
            }

            mo = (EmployeeInfo)new EmployeeInfoDBMapper().findByKey(mo.Id);
        }
Example #30
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     this.ClickedEmployee = (EmployeeInfo)e.Parameter;
     FillFIelds();
 }
 public static void saveEmployeeInfo(DataTable dt, ref EmployeeInfo mo)
 {
     foreach (DataRow dr in dt.Rows) {
         saveEmployeeInfo(dr, ref mo);
     }
 }
Example #32
0
        protected void btnSendFile_Click(object sender, EventArgs e)
        {
            if (IsPageValid())
            {
                try
                {
                    int          emid = Convert.ToInt32(Session["EmployeeId"]);
                    EmployeeInfo em   = (EmployeeInfo)Session["Employee"];
                    //获取文件名
                    string   name     = this.UpFile.FileName;
                    DateTime sendtime = DateTime.Now;
                    if (!CanYou.OA.BLL.FileInfo.IsFileSame(name))
                    {
                        string[] strto = new String[lbxRecv.Items.Count];
                        for (int i = 0; i < lbxRecv.Items.Count; i++)
                        {
                            CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo();
                            file.RecvEmployeeId = Convert.ToInt32(lbxRecv.Items[i].Value);
                            file.FileName       = name;
                            file.FileTypeId     = Convert.ToInt32(ddlFileType.SelectedValue.ToString());
                            file.SendEmployeeId = emid;
                            file.Memo           = txtMemo.Text.ToString();
                            file.SendTime       = sendtime;
                            file.IsCommon       = 0;
                            file.IsDelete       = 0;
                            file.IsMsg          = 0;
                            file.Save();

                            MessageInfo Msg = new MessageInfo();
                            Msg.Msg            = "您收到新文件:" + name;
                            Msg.Url            = "~/ShareManage/RecvFile.aspx";
                            Msg.RecvEmployeeId = Convert.ToInt32(lbxRecv.Items[i].Value);
                            Msg.Memo           = file.FileId.ToString();
                            Msg.EmployeeName   = em.EmployeeName;
                            Msg.MsgType        = "daiyue";
                            Msg.MsgTime        = DateTime.Now.ToString("yyyy-MM-dd");
                            Msg.MsgTitle       = name;
                            Msg.Save();

                            EmployeeInfo ems = new EmployeeInfo(Convert.ToInt32(lbxRecv.Items[0].Value));
                            strto[i] = ems.Qq.ToString();
                        }


                        //文件上传地址根目录,这里通过IIS架设本地主机为FTP服务器
                        //string FileSaveUri = @"ftp://192.168.11.70/www/Files/File/";
                        ////FTP用户名密码,就是本机的用户名密码
                        //string ftpUser = "******";
                        //string ftpPassWord = "******";
                        //SendFiles(FileSaveUri, ftpUser, ftpPassWord);
                        this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/File/" + UpFile.FileName));
                        MessageInfo.SendMailS(strto, "OA新消息", "您收到新文件");

                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('发送成功!');</script>");
                    }
                    else
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('该文件名已存在,请重命名!');</script>");
                    }
                }
                catch (Exception ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('发送失败:" + ex.Message + "');", true);
                }
            }
        }
Example #33
0
        public void ImportExcel()
        {
            ExcelShiftsOfDepartment excelShiftsOfDepartment = ReadExcelShiftData();

            excelShiftsOfDepartment.DepartmentId = 2; //HR
            excelShiftsOfDepartment.Location     = 2;
            excelShiftsOfDepartment.Month        = 7;
            excelShiftsOfDepartment.Year         = 2017;

            Dictionary <string, int> duplicatedEmployees = ValidateDuplicatedData(excelShiftsOfDepartment);

            string siteUrl = "http://rbvhspdev01:81/";

            ShiftManagementDAL       _shiftManagementDAL       = new ShiftManagementDAL(siteUrl);
            ShiftManagementDetailDAL _shiftManagementDetailDAL = new ShiftManagementDetailDAL(siteUrl);

            List <ShiftManagement>       shiftManagements       = _shiftManagementDAL.GetByMonthYearDepartment(excelShiftsOfDepartment.Month, excelShiftsOfDepartment.Year, excelShiftsOfDepartment.DepartmentId, excelShiftsOfDepartment.Location);
            List <ShiftManagementDetail> shiftManagementDetails = new List <ShiftManagementDetail>();

            if (shiftManagements != null && shiftManagements.Count > 0)
            {
                shiftManagementDetails = _shiftManagementDetailDAL.GetByShiftManagementID(shiftManagements[0].ID);
            }

            EmployeeInfoDAL     _employeeInfoDAL      = new EmployeeInfoDAL(siteUrl);
            List <EmployeeInfo> employeesOfDepartment = _employeeInfoDAL.GetByLocationAndDepartment(2, excelShiftsOfDepartment.DepartmentId, true, 4, StringConstant.EmployeeInfoList.EmployeeIDField);

            if (shiftManagementDetails != null && shiftManagementDetails.Count > 0)
            {
                foreach (var employeeShift in excelShiftsOfDepartment.EmployeeShifts)
                {
                    EmployeeInfo employeeInfo = employeesOfDepartment.Where(e => e.EmployeeID == employeeShift.EmployeeID).FirstOrDefault();
                    if (employeeInfo != null)
                    {
                        employeeShift.EmployeeLookupID = employeeInfo.ID;
                    }
                }

                List <int> employeeLookupIds = excelShiftsOfDepartment.EmployeeShifts.Select(e => e.EmployeeLookupID).ToList();
                shiftManagementDetails = shiftManagementDetails.Where(e => employeeLookupIds.Contains(e.Employee.LookupId)).ToList();
            }

            foreach (ExcelEmployeeShift excelEmployeeShift in excelShiftsOfDepartment.EmployeeShifts)
            {
                ShiftManagementDetail shiftManagementDetail = shiftManagementDetails.Where(e => e.Employee.LookupId == excelEmployeeShift.EmployeeLookupID).FirstOrDefault();
                if (shiftManagementDetail == null)
                {
                    shiftManagementDetail = new ShiftManagementDetail();
                    EmployeeInfo employeeInfo = employeesOfDepartment.Where(e => e.EmployeeID == excelEmployeeShift.EmployeeID).FirstOrDefault();
                    shiftManagementDetail.Employee = new LookupItem()
                    {
                        LookupId = employeeInfo.ID, LookupValue = employeeInfo.FullName
                    };
                    shiftManagementDetails.Add(shiftManagementDetail);
                }

                ShiftTimeDAL     _shiftTimeDAL = new ShiftTimeDAL(siteUrl);
                List <ShiftTime> shiftTimes    = _shiftTimeDAL.GetAll();

                for (int i = 0; i < 11; i++)
                {
                    ShiftTime shiftTime = shiftTimes.Where(e => e.Code.ToUpper() == excelEmployeeShift.ShiftCodes[i].ToUpper()).FirstOrDefault();
                    if (shiftTime != null)
                    {
                        Type         type = typeof(ShiftManagementDetail);
                        PropertyInfo shiftApprovalInfo  = type.GetProperty(string.Format("ShiftTime{0}Approval", i + 21));
                        object       shiftApprovalValue = shiftApprovalInfo.GetValue(shiftManagementDetail, null);
                        if (shiftApprovalValue != null && Convert.ToBoolean(shiftApprovalValue) == false)
                        {
                            PropertyInfo shiftInfo  = type.GetProperty(string.Format("ShiftTime{0}", i + 21));
                            LookupItem   shiftValue = shiftInfo.GetValue(shiftManagementDetail, null) as LookupItem;
                            if (shiftValue == null)
                            {
                                shiftValue = new LookupItem();
                            }
                            shiftValue.LookupId    = shiftTime.ID;
                            shiftValue.LookupValue = shiftTime.Code;
                        }
                    }
                }

                for (int i = 11; i < 31; i++)
                {
                    ShiftTime shiftTime = shiftTimes.Where(e => e.Code.ToUpper() == excelEmployeeShift.ShiftCodes[i].ToUpper()).FirstOrDefault();
                    if (shiftTime != null)
                    {
                        Type         type = typeof(ShiftManagementDetail);
                        PropertyInfo shiftApprovalInfo  = type.GetProperty(string.Format("ShiftTime{0}Approval", i - 10));
                        object       shiftApprovalValue = shiftApprovalInfo.GetValue(shiftManagementDetail, null);
                        if (shiftApprovalValue != null && Convert.ToBoolean(shiftApprovalValue) == false)
                        {
                            PropertyInfo shiftInfo  = type.GetProperty(string.Format("ShiftTime{0}", i - 10));
                            LookupItem   shiftValue = shiftInfo.GetValue(shiftManagementDetail, null) as LookupItem;
                            if (shiftValue == null)
                            {
                                shiftValue = new LookupItem();
                            }
                            shiftValue.LookupId    = shiftTime.ID;
                            shiftValue.LookupValue = shiftTime.Code;
                        }
                    }
                }
            }

            int shiftId = 0;

            if (shiftManagements == null || shiftManagements.Count == 0)
            {
                Biz.Models.ShiftManagement shiftManagement = new Biz.Models.ShiftManagement();
                shiftManagement.Department = new LookupItem()
                {
                    LookupId = excelShiftsOfDepartment.DepartmentId, LookupValue = excelShiftsOfDepartment.DepartmentId.ToString()
                };
                shiftManagement.Location = new LookupItem()
                {
                    LookupId = excelShiftsOfDepartment.Location, LookupValue = excelShiftsOfDepartment.Location.ToString()
                };
                shiftManagement.Month = excelShiftsOfDepartment.Month;
                shiftManagement.Year  = excelShiftsOfDepartment.Year;

                EmployeeInfo requester = _employeeInfoDAL.GetByADAccount(122);
                shiftManagement.Requester = new LookupItem()
                {
                    LookupId = requester.ID, LookupValue = requester.FullName
                };

                EmployeeInfo approvedBy = _employeeInfoDAL.GetByPositionDepartment(StringConstant.EmployeePosition.DepartmentHead, excelShiftsOfDepartment.DepartmentId, excelShiftsOfDepartment.Location).FirstOrDefault();
                shiftManagement.ApprovedBy = new User()
                {
                    ID = approvedBy.ADAccount.ID, UserName = approvedBy.ADAccount.UserName, FullName = approvedBy.FullName, IsGroup = false
                };

                shiftId = _shiftManagementDAL.SaveOrUpdate(shiftManagement);
            }
            else
            {
                shiftId = shiftManagements[0].ID;
            }

            if (shiftId > 0)
            {
                foreach (ShiftManagementDetail shiftManagementDetail in shiftManagementDetails)
                {
                    shiftManagementDetail.ShiftManagementID = new LookupItem()
                    {
                        LookupId = shiftId, LookupValue = shiftId.ToString()
                    };
                    int shiftDetailId = _shiftManagementDetailDAL.SaveOrUpdate(shiftManagementDetail);
                }
            }
        }
Example #34
0
        public void TestGetEmployeeById()
        {
            EmployeeInfo info = scanmark.Get(1);

            Assert.IsNotNull(info);
        }
Example #35
0
 public async Task <ActionResult <int> > AddEMp([FromBody] EmployeeInfo em)
 {
     db.EmployeeInfo.Add(em);
     return(await db.SaveChangesAsync());
 }
        /// <summary>
        /// Function for save
        /// </summary>
        public void SaveFunction()
        {
            try
            {
                EmployeeInfo infoEmployee = new EmployeeInfo();
                EmployeeCreationBll BllEmployeeCreation = new EmployeeCreationBll();
                infoEmployee.EmployeeCode = txtEmployeeCode.Text.Trim();
                infoEmployee.EmployeeName = txtEmployeeName.Text.Trim();
                infoEmployee.DesignationId = Convert.ToDecimal(cmbDesignation.SelectedValue.ToString());
                infoEmployee.Dob = Convert.ToDateTime(dtpDob.Text.ToString());
                infoEmployee.MaritalStatus = (cmbMaritalStatus.Text.ToString()).TrimEnd();
                if (cmbGender.Text != string.Empty)
                {
                    infoEmployee.Gender = (cmbGender.SelectedItem.ToString()).TrimEnd();
                }
                else
                {
                    infoEmployee.Gender = cmbGender.Text.ToString();
                }
                infoEmployee.Qualification = txtQualification.Text.Trim();
                infoEmployee.Address = txtAddress.Text.Trim();
                infoEmployee.PhoneNumber = txtPhoneNumber.Text.Trim();
                infoEmployee.MobileNumber = txtMobileNumber.Text.Trim();
                infoEmployee.Email = txtEmail.Text.Trim();
                infoEmployee.JoiningDate = Convert.ToDateTime(txtJoiningDate.Text.ToString());
                infoEmployee.TerminationDate = Convert.ToDateTime(txtTerminationDate.Text.ToString());
                if (cbxActive.Checked)
                {
                    infoEmployee.IsActive = true;
                }
                else
                {
                    infoEmployee.IsActive = false;
                }
                infoEmployee.Narration = txtNarration.Text.Trim();
                infoEmployee.BloodGroup = (cmbBloodGroup.Text.ToString()).TrimEnd();
                infoEmployee.PassportNo = txtPassportNumber.Text.Trim();
                infoEmployee.PassportExpiryDate = Convert.ToDateTime(dtpPassportExpiryDate.Text.ToString());
                infoEmployee.VisaNumber = txtVisaNumber.Text.Trim();
                infoEmployee.VisaExpiryDate = Convert.ToDateTime(dtpVisaExpiryDate.Text.ToString());
                infoEmployee.LabourCardNumber = txtlabourCardNumber.Text.Trim();
                infoEmployee.LabourCardExpiryDate = Convert.ToDateTime(dtpLabourCardExpiryDate.Text.ToString());
                infoEmployee.SalaryType = (cmbSalaryType.SelectedItem.ToString()).TrimEnd();
                if (cmbSalaryType.SelectedItem.ToString() == "Daily wage")
                {
                    if (txtDailyWage.Text.Trim() != string.Empty)
                    {
                        infoEmployee.DailyWage = Convert.ToDecimal(txtDailyWage.Text.ToString());
                    }

                }
                else
                {
                    if (cmbDefaultPackage.Text != string.Empty)
                    {
                        infoEmployee.DefaultPackageId = Convert.ToDecimal(cmbDefaultPackage.SelectedValue.ToString());
                    }
                }
                infoEmployee.BankName = txtBankName.Text.Trim();
                infoEmployee.BankAccountNumber = txtBankAccountNumber.Text.Trim();
                infoEmployee.BranchName = txtBranch.Text.Trim();
                infoEmployee.BranchCode = txtBranchCode.Text.Trim();
                infoEmployee.PanNumber = txtPanNumber.Text.Trim();
                infoEmployee.PfNumber = txtPfNumber.Text.Trim();
                infoEmployee.EsiNumber = txtEsiNumber.Text.Trim();
                infoEmployee.ExtraDate = DateTime.Now;
                infoEmployee.Extra1 = string.Empty;
                infoEmployee.Extra2 = string.Empty;
                if (BllEmployeeCreation.EmployeeCodeCheckExistance(txtEmployeeCode.Text.Trim(), 0) == false)
                {
                    decEmployeeId = BllEmployeeCreation.EmployeeAddWithReturnIdentity(infoEmployee);
                    Messages.SavedMessage();
                    ClearFunction();
                    decIdForOtherForms = decEmployeeId;
                    if (frmSalesInvoiceObj != null)
                    {
                        if (decIdForOtherForms != 0)
                        {
                            this.Close();
                        }
                    }

                }
                else
                {
                    Messages.InformationMessage("Employee code already exist");
                    txtEmployeeCode.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("EC1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        // DELETE api/<controller>/5
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="collection"></param>
        /// <returns></returns>
        //public Common.ClientResult.Result Delete(string query)
        //{
        //    IBLL.IEmployeeBLL m_BLL = new EmployeeBLL();
        //    Common.ClientResult.Result result = new Common.ClientResult.Result();

        //    string returnValue = string.Empty;
        //    int[] deleteId = Array.ConvertAll<string, int>(query.Split(','), delegate(string s) { return int.Parse(s); });
        //    if (deleteId != null && deleteId.Length > 0)
        //    {
        //        if (m_BLL.DeleteCollection(ref validationErrors, deleteId))
        //        {
        //            LogClassModels.WriteServiceLog(Suggestion.DeleteSucceed + ",信息的Id为" + string.Join(",", deleteId), "消息"
        //                );//删除成功,写入日志
        //            result.Code = Common.ClientCode.Succeed;
        //            result.Message = Suggestion.DeleteSucceed;
        //        }
        //        else
        //        {
        //            if (validationErrors != null && validationErrors.Count > 0)
        //            {
        //                validationErrors.All(a =>
        //                {
        //                    returnValue += a.ErrorMessage;
        //                    return true;
        //                });
        //            }
        //            LogClassModels.WriteServiceLog(Suggestion.DeleteFail + ",信息的Id为" + string.Join(",", deleteId) + "," + returnValue, "消息"
        //                );//删除失败,写入日志
        //            result.Code = Common.ClientCode.Fail;
        //            result.Message = Suggestion.DeleteFail + returnValue;
        //        }
        //    }
        //    return result;
        //}

        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        //public Common.ClientResult.Result Post([FromBody]Employee entity)
        //{
        //    IBLL.IEmployeeBLL m_BLL = new EmployeeBLL();
        //    Common.ClientResult.Result result = new Common.ClientResult.Result();
        //    if (entity != null && ModelState.IsValid)
        //    {
        //        //string currentPerson = GetCurrentPerson();
        //        //entity.CreateTime = DateTime.Now;
        //        //entity.CreatePerson = currentPerson;


        //        string returnValue = string.Empty;
        //        if (m_BLL.Create(ref validationErrors, entity))
        //        {
        //            LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",员工的信息的Id为" + entity.Id, "员工"
        //                );//写入日志
        //            result.Code = Common.ClientCode.Succeed;
        //            result.Message = Suggestion.InsertSucceed;
        //            return result; //提示创建成功
        //        }
        //        else
        //        {
        //            if (validationErrors != null && validationErrors.Count > 0)
        //            {
        //                validationErrors.All(a =>
        //                {
        //                    returnValue += a.ErrorMessage;
        //                    return true;
        //                });
        //            }
        //            LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",员工的信息," + returnValue, "员工"
        //                );//写入日志
        //            result.Code = Common.ClientCode.Fail;
        //            result.Message = Suggestion.InsertFail + returnValue;
        //            return result; //提示插入失败
        //        }
        //    }

        //    result.Code = Common.ClientCode.FindNull;
        //    result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对
        //    return result;
        //}

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public Common.ClientResult.Result Create([FromBody] EmployeeInfo entity)
        {
            IBLL.IEmployeeBLL          m_BLL  = new EmployeeBLL();
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            #region 验证
            //if (entity.CertificateType == null)
            //{
            //    result.Code = Common.ClientCode.FindNull;
            //    result.Message = "请选择证件类型";
            //    return result; //提示输入的数据的格式不对
            //}
            //if (entity.Sex == null)
            //{
            //    result.Code = Common.ClientCode.FindNull;
            //    result.Message = "请选择性别";
            //    return result; //提示输入的数据的格式不对
            //}
            //if (entity.AccountType == null)
            //{
            //    result.Code = Common.ClientCode.FindNull;
            //    result.Message = "请选择户口类型";
            //    return result; //提示输入的数据的格式不对
            //}
            //if (entity.CertificateType == "居民身份证")
            //{
            //    string number = entity.BasicInfo.CertificateNumber;

            //    if (Common.CardCommon.CheckCardID18(number) == false)
            //    {
            //        result.Code = Common.ClientCode.FindNull;
            //        result.Message = "证件号不正确请重新输入";
            //        return result; //提示输入的数据的格式不对
            //    }
            //}
            //if (entity.CompanyId==0)
            //{
            //    result.Code = Common.ClientCode.FindNull;
            //    result.Message = "请选择所属公司";
            //    return result; //提示输入的数据的格式不对
            //}
            //if (string.IsNullOrEmpty(entity.Citys))
            //{
            //    result.Code = Common.ClientCode.FindNull;
            //    result.Message = "请选择社保缴纳地";
            //    return result; //提示输入的数据的格式不对
            //}
            //if (entity.PoliceAccountNatureId == 0)
            //{
            //    result.Code = Common.ClientCode.FindNull;
            //    result.Message = "请选择户口性质";
            //    return result; //提示输入的数据的格式不对

            //}
            #endregion
            //if (entity != null && ModelState.IsValid)
            //{
            Employee baseModel = entity.BasicInfo;    //基本信息
            baseModel.AccountType     = entity.AccountType;
            baseModel.CertificateType = entity.CertificateType;
            baseModel.Sex             = entity.Sex;
            baseModel.CreateTime      = DateTime.Now;
            baseModel.CreatePerson    = LoginInfo.RealName;

            EmployeeContact contact = entity.empContacts;
            contact.CreatePerson = LoginInfo.RealName;
            contact.CreateTime   = DateTime.Now;

            EmployeeBank bank = entity.empBank;
            if (bank.AccountName == null && bank.Bank == null && bank.BranchBank == null && bank.Account == null)
            {
                bank = null;
            }
            else
            {
                bank.CreatePerson = LoginInfo.RealName;
                bank.CreateTime   = DateTime.Now;
            }

            CompanyEmployeeRelation relation = new CompanyEmployeeRelation();
            relation.CityId                = entity.Citys;
            relation.State                 = "在职";
            relation.CompanyId             = entity.CompanyId;
            relation.CreateTime            = DateTime.Now;
            relation.CreatePerson          = LoginInfo.RealName;
            relation.Station               = entity.Station;
            relation.PoliceAccountNatureId = entity.PoliceAccountNatureId;


            string returnValue = string.Empty;
            if (m_BLL.EmployeeAdd(ref validationErrors, baseModel, contact, bank, relation))
            {
                //LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",客户_企业信息_待审核的信息的Id为" + entity.ID, "客户_企业信息_待审核"
                //);//写入日志
                result.Code    = Common.ClientCode.Succeed;
                result.Message = Suggestion.InsertSucceed;
                return(result);    //提示创建成功
            }
            else
            {
                if (validationErrors != null && validationErrors.Count > 0)
                {
                    validationErrors.All(a =>
                    {
                        returnValue += a.ErrorMessage;
                        return(true);
                    });
                }
                //LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",客户_企业信息_待审核的信息," + returnValue, "客户_企业信息_待审核"
                //    );//写入日志
                result.Code    = Common.ClientCode.Fail;
                result.Message = Suggestion.InsertFail + returnValue;
                return(result);    //提示插入失败
            }
            //}
            result.Code    = Common.ClientCode.FindNull;
            result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对
            return(result);
        }
        /// <summary>
        /// Function to fill controls when cell double click in frmEmployeeRegister for updation
        /// </summary>
        /// <param name="decEmployeeId"></param>
        /// <param name="frm"></param>
        public void CallFromEmployeeRegister(decimal decEmployeeId, frmEmployeeRegister frm)
        {
            try
            {
                base.Show();
                frmEmployeeRegisterObj = frm;
                EmployeeInfo infoEmployee = new EmployeeInfo();
                EmployeeCreationBll BllEmployeeCreation = new EmployeeCreationBll();
                infoEmployee = BllEmployeeCreation.EmployeeView(decEmployeeId);
                lblEmployeeId.Text = infoEmployee.EmployeeId.ToString();
                txtEmployeeCode.Text = infoEmployee.EmployeeCode.ToString();
                strEmployeeCode = infoEmployee.EmployeeCode.ToString();
                txtEmployeeName.Text = infoEmployee.EmployeeName.ToString();
                cmbDesignation.SelectedValue = infoEmployee.DesignationId;
                dtpDob.Text = infoEmployee.Dob.ToString("dd-MMM-yyyy");
                cmbMaritalStatus.SelectedItem = infoEmployee.MaritalStatus.ToString();
                cmbGender.SelectedItem = infoEmployee.Gender.ToString();
                txtQualification.Text = infoEmployee.Qualification;
                cmbBloodGroup.SelectedItem = infoEmployee.BloodGroup.ToString();
                txtAddress.Text = infoEmployee.Address;
                txtBankAccountNumber.Text = infoEmployee.BankAccountNumber;
                txtBankName.Text = infoEmployee.BankName;
                txtBranch.Text = infoEmployee.BranchName;
                txtEmail.Text = infoEmployee.Email;
                txtEsiNumber.Text = infoEmployee.EsiNumber;
                txtlabourCardNumber.Text = infoEmployee.LabourCardNumber;
                txtBranchCode.Text = infoEmployee.BranchCode;
                txtMobileNumber.Text = infoEmployee.MobileNumber;
                txtNarration.Text = infoEmployee.Narration;
                txtPanNumber.Text = infoEmployee.PanNumber;
                txtPassportNumber.Text = infoEmployee.PassportNo;
                txtPfNumber.Text = infoEmployee.PfNumber;
                txtPhoneNumber.Text = infoEmployee.PhoneNumber;
                txtVisaNumber.Text = infoEmployee.VisaNumber;
                cmbSalaryType.SelectedItem = infoEmployee.SalaryType;
                if (cmbSalaryType.SelectedItem.ToString() == "Daily wage")
                {
                    txtDailyWage.Text = infoEmployee.DailyWage.ToString();
                }
                else
                {
                    cmbDefaultPackage.SelectedValue = int.Parse(infoEmployee.DefaultPackageId.ToString());
                }
                txtJoiningDate.Text = infoEmployee.JoiningDate.ToString("dd-MMM-yyyy");
                dtpLabourCardExpiryDate.Value = infoEmployee.LabourCardExpiryDate;
                dtpPassportExpiryDate.Value = infoEmployee.PassportExpiryDate;
                txtTerminationDate.Text = infoEmployee.TerminationDate.ToString("dd-MMM-yyyy");
                dtpVisaExpiryDate.Value = infoEmployee.VisaExpiryDate;
                txtEmployeeCode.Focus();
                if (infoEmployee.IsActive)
                {
                    cbxActive.Checked = true;
                }
                else
                {
                    cbxActive.Checked = false;
                }
                btnSave.Text = "Update";
                btnDelete.Enabled = true;
                txtEmployeeCode.Select();

            }
            catch (Exception ex)
            {
                MessageBox.Show("EC12" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        public void CalculatePayslip_ShouldThrowOverflowException_WhenAnnualSalaryIsNegative()
        {
            // Arrange
            EmployeeInfo employeeInfo = new EmployeeInfo
            {
                FirstName = "David",
                LastName = "Rudd",
                AnnualSalary = -1,
                SuperRate = 0,
                PaymentStartDate = "01 March – 31 March",
            };

            // Act
            Action action = () =>
            {
                this.employeeIncomeService.CalculatePayslip(employeeInfo);
            };

            // Assert
            action.ShouldThrow<OverflowException>();
        }
Example #40
0
 public int CreateEmployee(EmployeeInfo Emp)
 {
     context.EmployeeInfo.Add(Emp);
     context.SaveChanges();
     return(Emp.EmpNo);
 }
Example #41
0
        /// <summary>
        ///登录
        /// </summary>
        /// <param name="ENo">员工号</param>
        /// <param name="Rpassword">密码</param>
        /// <returns></returns>
        public static LoginResult Login(string ENo, string Rpassword)
        {
            using (EFContext Context = new EFContext())
            {
                var jieguo = from s in Context.EmployeeInfo
                             select s;
                if (jieguo.FirstOrDefault() == null)
                {
                    EmployeeInfo employee = new EmployeeInfo()
                    {
                        ENo       = ENo,
                        EName     = "管理员",
                        Esex      = true,
                        Ephone    = "",
                        Eemail    = "",
                        EcardID   = Rpassword,
                        Ppassword = Rpassword.Substring(12),
                        Eheart    = "",
                        Pid       = 1
                    };
                    PositionInfo positionInfo = new PositionInfo()
                    {
                        PoName     = "超级管理员",
                        PoLeave    = 1,
                        PoMinMoney = 0,
                        Permission = "ALL"
                    };
                    PersonMessage personMessage = new PersonMessage()
                    {
                        EID         = 1,
                        PeBeginWork = DateTime.Now.ToString(),
                        PeEndwork   = "",
                        Pstatic     = true
                    };
                    DbEntityEntry <EmployeeInfo> entityEntry = Context.Entry <EmployeeInfo>(employee);
                    entityEntry.State = System.Data.Entity.EntityState.Added;
                    DbEntityEntry <PositionInfo> entityEn = Context.Entry <PositionInfo>(positionInfo);
                    entityEn.State = System.Data.Entity.EntityState.Added;
                    DbEntityEntry <PersonMessage> person = Context.Entry <PersonMessage>(personMessage);
                    person.State = System.Data.Entity.EntityState.Added;
                    Context.SaveChanges();
                    Rpassword = Rpassword.Substring(12);
                    //"create trigger trigger_insert on employeeinfo for insert as insert into PersonMessage values(@@IDENTITY,CONVERT(varchar(12) , getdate(), 111 ),'',1)"
                }

                var result = (from a in Context.EmployeeInfo
                              join b in Context.PositionInfo
                              on a.Pid equals b.PoID
                              join c in Context.PersonMessage
                              on a.EID equals c.EID
                              where a.ENo.Equals(ENo) && a.Ppassword.Equals(Rpassword)
                              select new
                {
                    name = a.EName,
                    Eid = a.EID,
                    Pstats = c.Pstatic,
                    ENo = a.ENo,
                    PoName = b.PoName,
                    permissins = b.Permission
                }).ToList().FirstOrDefault();
                LoginResult loginResult = new LoginResult();
                if (result == null)
                {
                    loginResult.Result = false;
                }
                else
                {
                    if (result.Pstats)
                    {
                        loginResult.Result     = true;
                        loginResult.EID        = result.Eid;
                        loginResult.EName      = result.name.ToString();
                        loginResult.ENo        = result.ENo.ToString();
                        loginResult.PoName     = result.PoName.ToString();
                        loginResult.Permissins = result.permissins.ToString();
                    }
                    else
                    {
                        loginResult.Result = false;
                    }
                }
                return(loginResult);
            }
        }
Example #42
0
        public static List <EmployeeInfo> GetEmpInfo(AprajitaRetailsContext db)
        {
            var emps = db.Attendances.Include(c => c.Employee).
                       Where(c => (c.AttDate) == (DateTime.Today)).OrderByDescending(c => c.Employee.StaffName);

            var empPresent = db.Attendances.Include(c => c.Employee)
                             .Where(c => c.Status == AttUnits.Present && (c.AttDate).Month == (DateTime.Today).Month)
                             .GroupBy(c => c.Employee.StaffName).OrderBy(c => c.Key).Select(g => new { StaffName = g.Key, Days = g.Count() }).ToList();

            var empAbsent = db.Attendances.Include(c => c.Employee)
                            .Where(c => c.Status == AttUnits.Absent && (c.AttDate).Month == (DateTime.Today).Month)
                            .GroupBy(c => c.Employee.StaffName).OrderBy(c => c.Key).Select(g => new { StaffName = g.Key, Days = g.Count() }).ToList();

            var totalSale = db.DailySales.Include(c => c.Salesman).Where(c => (c.SaleDate).Month == (DateTime.Today).Month).Select(a => new { StaffName = a.Salesman.SalesmanName, Amount = a.Amount }).ToList();

            List <EmployeeInfo> infoList = new List <EmployeeInfo>();

            foreach (var item in emps)
            {
                if (item.Employee.StaffName != "Amit Kumar")
                {
                    EmployeeInfo info = new EmployeeInfo()
                    {
                        Name        = item.Employee.StaffName,
                        AbsentDays  = 0,
                        NoOfBills   = 0,
                        Present     = "",
                        PresentDays = 0,
                        Ratio       = 0,
                        TotalSale   = 0
                    };

                    if (item.Status == AttUnits.Present)
                    {
                        info.Present = "Present";
                    }
                    else
                    {
                        info.Present = "Absent";
                    }

                    try
                    {
                        if (item.Employee.Category == EmpType.Salesman)
                        {
                            info.IsSalesman = true;
                        }

                        if (empPresent != null)
                        {
                            var pd = empPresent.Where(c => c.StaffName == info.Name).FirstOrDefault();
                            if (pd != null)
                            {
                                info.PresentDays = pd.Days;
                            }
                            else
                            {
                                info.PresentDays = 0;
                            }
                        }
                        else
                        {
                            info.PresentDays = 0;
                        }

                        if (empAbsent != null)
                        {
                            var ad = empAbsent.Where(c => c.StaffName == info.Name).FirstOrDefault();
                            if (ad != null)
                            {
                                info.AbsentDays = ad.Days;
                            }
                            else
                            {
                                info.AbsentDays = 0;
                            }
                        }
                        else
                        {
                            info.AbsentDays = 0;
                        }

                        //var ts = db.DailySales.Include(c=>c.Salesman ).Where (c => c.Salesman.SalesmanName == info.Name && (c.SaleDate).Month == (DateTime.Today).Month).ToList();
                        if (totalSale != null && (item.Employee.Category == EmpType.Salesman || item.Employee.Category == EmpType.StoreManager))
                        {
                            var ts = totalSale.Where(c => c.StaffName == info.Name).ToList();
                            info.TotalSale = (decimal?)ts.Sum(c => (decimal?)c.Amount) ?? 0;
                            info.NoOfBills = (int?)ts.Count ?? 0;
                        }

                        if (info.PresentDays > 0 && info.TotalSale > 0)
                        {
                            info.Ratio = Math.Round((double)info.TotalSale / info.PresentDays, 2);
                        }
                    }
                    catch (Exception)
                    {
                        // Log.Error().Message("emp-present exception");
                    }
                    infoList.Add(info);
                }
            }
            return(infoList);
        }
Example #43
0
 public int UpdateEmployeeInfo(EmployeeInfo theEmployee)
 {
     return(EmployeeIntegration.UpdateEmployeeInfo(theEmployee));
 }
        public override void ItemAdded(SPItemEventProperties properties)
        {
            try
            {
                base.ItemAdded(properties);

                var siteURL = properties.WebUrl;
                var vehicleManagementDAL = new VehicleManagementDAL(siteURL);
                var ItemID      = properties.ListItemId;
                var currentItem = vehicleManagementDAL.GetByID(ItemID);

                taskManagementDAL = new TaskManagementDAL(siteURL);
                TaskManagement taskManagement = new TaskManagement();
                taskManagement.StartDate       = DateTime.Now;
                taskManagement.DueDate         = currentItem.RequestDueDate;
                taskManagement.PercentComplete = 0;
                taskManagement.ItemId          = currentItem.ID;
                taskManagement.ItemURL         = properties.List.DefaultDisplayFormUrl + "?ID=" + properties.ListItemId;
                taskManagement.ListURL         = properties.List.DefaultViewUrl;
                taskManagement.TaskName        = TASK_NAME;
                taskManagement.TaskStatus      = TaskStatusList.InProgress;
                taskManagement.StepModule      = StepModuleList.VehicleManagement.ToString();
                taskManagement.Department      = currentItem.CommonDepartment;
                taskManagement.AssignedTo      = currentItem.DepartmentHead;

                employeeInfoDAL = new EmployeeInfoDAL(siteURL);
                EmployeeInfo requesterInfo = employeeInfoDAL.GetByID(currentItem.Requester.LookupId);

                if ((int)Convert.ToDouble(requesterInfo.EmployeeLevel.LookupValue, CultureInfo.InvariantCulture.NumberFormat) == (int)StringConstant.EmployeeLevel.DepartmentHead)
                {
                    taskManagement.StepStatus = StepStatusList.BODApproval;
                }
                else
                {
                    taskManagement.StepStatus = StepStatusList.DHApproval;
                }

                DepartmentDAL _departmentDAL = new DepartmentDAL(siteURL);
                Department    departmentHR   = _departmentDAL.GetByCode("HR");
                if (departmentHR.ID == currentItem.CommonDepartment.LookupId)
                {
                    taskManagement.NextAssign = null;
                }
                else
                {
                    EmployeeInfo deptHeadOfHR = employeeInfoDAL.GetByPositionDepartment(StringConstant.EmployeePosition.DepartmentHead, requesterInfo.FactoryLocation.LookupId, departmentHR.ID).FirstOrDefault();
                    if (deptHeadOfHR != null)
                    {
                        taskManagement.NextAssign = deptHeadOfHR.ADAccount;
                    }
                }

                taskManagementDAL.SaveItem(taskManagement);

                var          mailDAL       = new EmailTemplateDAL(siteURL);
                var          emailTemplate = mailDAL.GetByKey("VehicleManagement_Request");
                EmployeeInfo assigneeInfo  = employeeInfoDAL.GetByADAccount(taskManagement.AssignedTo.ID);
                currentItem.ApprovalStatus = taskManagement.StepStatus;

                vehicleManagementDAL.SaveOrUpdate(currentItem);

                vehicleManagementDAL.SendEmail(currentItem, emailTemplate, null, assigneeInfo, VehicleTypeOfEmail.Request, siteURL);

                try
                {
                    List <EmployeeInfo> toUsers = DelegationPermissionManager.GetListOfDelegatedEmployees(siteURL, assigneeInfo.ID, StringConstant.VehicleManagementList.ListUrl, currentItem.ID);
                    vehicleManagementDAL.SendDelegationEmail(currentItem, emailTemplate, toUsers, siteURL);
                }
                catch { }
            }
            catch (Exception ex)
            {
                ULSLogging.Log(new SPDiagnosticsCategory("STADA -  Transportation Event Receiver - ItemAdded fn",
                                                         TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected,
                               string.Format(CultureInfo.InvariantCulture, "{0}:{1}", ex.Message, ex.StackTrace));
            }
        }
 public static EmployeeInfo loadFromDataRow(DataRow r)
 {
     DataRowLoader a = new DataRowLoader();
     IModelObject mo = new EmployeeInfo();
     a.DataSource = r;
     a.load(mo);
     return (EmployeeInfo)mo;
 }
Example #46
0
        /// <summary>
        /// To be called on when user clicks OK. Attempts to add a new employee given the values entered in the boxes.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            multiListBox.Visible = false;

            if (!radMale.Checked && !radFemale.Checked)
            {
                MessageBox.Show("Please enter gender.");
                return;
            }

            //Calculates age based on given date of birth
            DateTime zeroTime = new DateTime(1, 1, 1);
            TimeSpan age      = DateTime.Now - dtpDOB.Value;
            int      years    = (zeroTime + age).Year - 1;

            //If the calculated age don't correlate with input age, an error must be thrown
            if (years != (int)numAge.Value)
            {
                //Employees must be between 18 and 60 years old, according to client specifications
                if (years >= MIN_AGE && years <= MAX_AGE)
                {
                    DialogResult answer = MessageBox.Show(
                        $"Liar. According to date of birth, {txtName.Text} isn't {numAge.Value} years, " +
                        $"{(radMale.Checked? "he" : "she")} is {years} years old.\n" +
                        $"Change age to {years}?\n" +
                        $"(If no, employee will NOT be added)",
                        "Age error", MessageBoxButtons.YesNo);
                    if (answer == DialogResult.Yes)
                    {
                        numAge.Value = years;
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    MessageBox.Show(
                        $"Liar. according to date of birth, {txtName.Text} is {years} years old. Please try again.\n" +
                        $"Please note that employees must be between {MIN_AGE} and {MAX_AGE}.");
                    return;
                }
            }
            //Adds all checked hobbies to the hobby-list
            List <Hobby> hob = new List <Hobby>();

            foreach (Hobby h in chkLstHobbies.CheckedItems)
            {
                hob.Add(h);
            }
            //if the new employee is null, just return
            EmployeeInfo emp = CreateEmployee();

            if (emp == null)
            {
                return;
            }

            //Tries to add the new employee. If that fails, Prompt the user that the given employeenumber already exists
            if (!employeeHandler.AddEmployee(emp))
            {
                MessageBox.Show($"Employee-number {mskTxtEmpNo.Text} already exists.");
                return;
            }
            txtDetails.Text = emp.ToLongString();
        }
        public static void saveEmployeeInfo(DataRow dr, ref EmployeeInfo mo)
        {
            if (mo == null) {
                mo = new EmployeeInfo();
            }

            foreach (DataColumn dc in dr.Table.Columns) {
                mo.setAttribute(dc.ColumnName, dr[dc.ColumnName]);
            }

            saveEmployeeInfo(mo);
        }
Example #48
0
        /// <summary>
        /// To be called on when the index is changed in the multiListBox, to update the txtDetails-textbox with appropriate data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void multiListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            EmployeeInfo tempEmp = (EmployeeInfo)multiListBox.SelectedItem;

            txtDetails.Text = tempEmp.ToLongString();
        }
 public void saveEmployeeInfo(EmployeeInfo mo)
 {
     base.save(mo);
 }
Example #50
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //查看是否有用户级语言辅助器,没有则用公共的
        LangHelper = FetchData.GetLanguageHelper(Session);

        lblUser.Text                = LangHelper.GetText("User Name:");
        lblPwd.Text                 = LangHelper.GetText("Password:"******"Change Password");
        lblNewPwd.Text              = LangHelper.GetText("New Password:"******"Confirm New Password:"******"Verify Code:");
        btnSubmit.Text              = LangHelper.GetText("Login");
        imgVerifyCode.ToolTip       = LangHelper.GetText("Click For New Picture.");
        imgVerifyCode.AlternateText = LangHelper.GetText("Verify Code");
        btnSubmit.Text              = LangHelper.GetText("Login");
        imgVerifyCode.ImageUrl      = "FetchData.ashx?fn=VerifyCode&k=" + (new System.Random().Next());

        if (Request["iptUser"] != null)
        {
            string sErrInfo = null;

#if !WEB_DEBUG
            try
            {
                if (string.Equals((string)Session["VerifyCode"], Request["iptCheckCode"], StringComparison.OrdinalIgnoreCase) == false)
                {
                    throw new Exception(LangHelper.GetText("Verify Code Is Incorrect !"));
                }
#endif
            string userName = Request["iptUser"];
            string password = Request["iptPwd"];

            Session["LogonEmployee"] = null;

            bool bChangePwd    = Cvt.ToBoolean(Request["bChangePwd"]);
            string sNewPwd     = Request["iptNewPwd"];
            string sConfirmPwd = Request["iptConfirmPwd"];
            if ((!bChangePwd) || sNewPwd != sConfirmPwd || string.IsNullOrEmpty(sNewPwd))
            {
                sNewPwd = "";
            }

            string sStation = "", sFromIP = Request.ServerVariables["HTTP_X_FORWARDED_FOR"], sFromHost = Request.UserHostName, sFromMAC = "";
            if (string.IsNullOrEmpty(sFromIP))
            {
                sFromIP = Request.ServerVariables["REMOTE_ADDR"];
            }
            if (string.IsNullOrEmpty(sFromIP))
            {
                sFromIP = Request.UserHostAddress;
            }
            if (string.IsNullOrEmpty(sFromHost))
            {
                sFromHost = Common.GetHostName(sFromIP);
            }
            sFromMAC = Common.GetCustomerMacByArp(sFromIP);

            EmployeeInfo Employee = UserMgr.CheckLoginAuthenticate(LangHelper, userName, password, sNewPwd, sStation, sFromIP, sFromMAC, sFromHost);

            if (Employee != null)
            {
                Session["LogonEmployee"] = Employee;
                //如果父框架有方法f_LoginAuthenticated方法,则调用它
                string sHtml = "<script type=\"text/javascript\">"
                               //+ "if(parent.LoginDlg) parent.LoginDlg.close();"
                               + "if(parent.f_LoginAuthenticated) parent.f_LoginAuthenticated();"
                               + "</script>";
                errorInfoLable.Controls.Add(new LiteralControl(sHtml));

                string sTarget = Request["target"];
                if (!string.IsNullOrEmpty(sTarget))
                {
                    Response.Redirect(Server.UrlDecode(sTarget));
                }
            }
            ;
#if !WEB_DEBUG
        }
        catch (Exception excep)
        {
            sErrInfo = excep.Message;
        }
#endif
            if (sErrInfo != null)
            {
                errorInfoLable.Controls.Add(new LiteralControl(Server.HtmlEncode(sErrInfo)));
            }
        };
    }
Example #51
0
		private void AddRow(EmployeeAccessDataSet ds, EmployeeInfo employee, SKDCard card, CardDoor door, AccessTemplate template, Dictionary<Guid, Tuple<Tuple<GKSKDZone, string>, Tuple<GKSKDZone, string>>> zoneMap, List<Guid> addedZones)
		{
			if (!zoneMap.ContainsKey(door.DoorUID))
				return;
			var zones = zoneMap[door.DoorUID];
			var dataRow = ds.Data.NewDataRow();
			dataRow.Type = card.GKCardType.ToDescription();
			dataRow.Number = card.Number.ToString();
			if (employee != null)
			{
				dataRow.Employee = employee.Name;
				dataRow.Organisation = employee.Organisation;
				dataRow.Department = employee.Department;
				dataRow.Position = employee.Position;
			}
			if (template != null)
				dataRow.Template = template.Name;
			if (zones.Item1 != null && !addedZones.Contains(zones.Item1.Item1.UID))
			{
				var row1 = ds.Data.NewDataRow();
				row1.ItemArray = dataRow.ItemArray;
				row1.Zone = zones.Item1.Item2;
				row1.No = zones.Item1.Item1.No;
				ds.Data.AddDataRow(row1);
				addedZones.Add(zones.Item1.Item1.UID);
			}
			if (zones.Item2 != null && !addedZones.Contains(zones.Item2.Item1.UID))
			{
				var row2 = ds.Data.NewDataRow();
				row2.ItemArray = dataRow.ItemArray;
				row2.Zone = zones.Item2.Item2;
				row2.No = zones.Item2.Item1.No;
				ds.Data.AddDataRow(row2);
				addedZones.Add(zones.Item2.Item1.UID);
			}
		}
Example #52
0
 public void Insert(EmployeeInfo info)
 {
     _employeeInfoRepository.Insert(info);
 }
Example #53
0
      /// <summary>
      /// By convention, when VMController receives a list item from the client, it will look for the function that starts
      /// with the list property name and ends with "_get" to access the list item for the purpose of updating its value.
      /// </summary>
      /// <param name="iKey">List item key.</param>
      /// <returns>List item.</returns>
      public EmployeeInfo Employees_get(string iKey)
      {
         EmployeeInfo employeeInfo = null;

         var record = _Model.GetRecord(int.Parse(iKey));
         if (record != null)
            employeeInfo = new EmployeeInfo { Id = record.Id, FirstName = record.FirstName, LastName = record.LastName };

         // Handle the event when the employee data is changed on the client.
         if (employeeInfo != null)
            employeeInfo.PropertyChanged += Employee_PropertyChanged;

         return employeeInfo;
      }
Example #54
0
 public void Update(EmployeeInfo info)
 {
     _employeeInfoRepository.Update(info);
 }
Example #55
0
    public DataTable get_EMPDataByNames(EmployeeInfo EMPInfo)
    {
        DataTable empdata = new DataTable();
        SqlConnection sqlCon = new SqlConnection(conStr);
        string sqlQuery = "select * from Employee where Employee.Emp_LName='" + EMPInfo.EMPLName + "' and Employee.Emp_FName='" + EMPInfo.EMPFName + "'";
        SqlCommand cmd = new SqlCommand();
        cmd.CommandText = sqlQuery;
        cmd.Connection = sqlCon;

        SqlDataAdapter sqlDa = new SqlDataAdapter(cmd);
        DataSet dsEMPnames = new DataSet();
        try
        {
            sqlDa.Fill(dsEMPnames, "Names");
            int a= dsEMPnames.Tables["Names"].Rows.Count;
        }
        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);
        }
        return dsEMPnames.Tables["Names"];
    }
        /// **************************************************************
        /// <summary>
        /// 描述:为所有人补签到签退
        /// </summary>
        /// <param name="date">签到或者签退的日期</param>
        /// <param name="signInTime">签到时间</param>
        /// <param name="signOutTime">签退时间</param>
        /// <param name="appendForEmpID">被补签到人的ID</param>
        /// <param name="note">说明</param>
        /// <returns></returns>
        /// **************************************************************
        public int UpdateCheckInInfoBySystem(string date, string signInTime, string signOutTime, string note, int appendEmpID, string appendEmpName, int appendForEmpID)
        {
            string             sql             = "";
            DateTime           signInDate      = DateTime.Parse(date + " " + signInTime);
            DateTime           signOutDate     = DateTime.Parse(date + " " + signOutTime);
            TimeSpan           timeSpan        = signOutDate - signInDate;
            WorkDuration       workDuration    = WorkDurationService.Instance.GetWorkDuration();
            List <CheckInInfo> modifyedEmpList = new List <CheckInInfo>();
            int workTime = timeSpan.Hours;

            if (workTime > workDuration.WDDayDuration)
            {
                workTime = workDuration.WDDayDuration;
            }
            if (appendForEmpID == 0)
            {
                List <EmployeeInfo> empList = EmployeeService.Instance.GetList();

                if (empList != null && empList.Count > 0)
                {
                    for (int i = 0; i < empList.Count; i++)
                    {
                        //为所有人进行签到签退
                        //判断是否已经签过到/退
                        //MODIFY
                        CheckInInfo checkInfo = isCheckInInfoExisted(date, int.Parse(empList[i].EmpID));
                        if (checkInfo != null)
                        {
                            return(0);
                        }
                        #region ------------------1. 插入语句
                        //MODIFY
                        //SQL语句过长问题
                        sql = string.Format(@"Insert into T_CheckingInInfo(
                                                                F_EmpID,
                                                                F_EmpName,
                                                                F_DepID,
                                                                F_DepName,
                                                                F_CISignInDate,
                                                                F_CISignOutDate,
                                                                F_CIRealityWorkDuration,
                                                                F_AppendSignInPersonID,
                                                                F_AppendSignInPersonName,
                                                                F_AppendSignInPersonNote,
                                                                F_CIIsLate,
                                                                F_CIIsLeaveEarvly,
                                                                F_CIIsAbsenteeism,
                                                                F_CIIsNormal,
                                                                F_CICreateDate,
                                                                F_CIIsSignIn,
                                                                F_CIIsCalculate,
                                                                F_Date
                                                ) 
                                                values({0},'{1}',{2},'{3}','{4}','{5}',{6},{7},'{8}','{9}',{10}, '{11}',{12},{13},'{14}');",
                                            empList[i].EmpID,
                                            empList[i].EmpName,
                                            empList[i].DepID,
                                            empList[i].DepName,
                                            signInDate,
                                            signOutDate,
                                            workTime,
                                            appendEmpID,
                                            appendEmpName,
                                            note.Replace("'", "''"),
                                            makeSql(signOutDate, signInDate, workDuration),
                                            DateTime.Now.ToString("yyyy-MM-dd"),
                                            "0",
                                            "0",
                                            date);
                        #endregion
                        int res = MrDBAccess.ExecuteNonQuery(sql);
                        if (res == 0)
                        {
                            return(0);
                        }
                        modifyedEmpList.Add(GetCheckInfo(int.Parse(empList[i].EmpID), date));
                    }
                }
            }
            else
            {
                //为某个员工进行签到签退
                #region ---------------------------sql语句
                EmployeeInfo employeeInfo = EmployeeService.Instance.GetEmployee(appendForEmpID);
                CheckInInfo  checkInfo    = isCheckInInfoExisted(date, int.Parse(employeeInfo.EmpID));
                if (checkInfo != null)
                {
                    return(0);
                }
                sql = string.Format(@"INSERT INTO T_CheckingInInfo(F_EmpID,
                                                                F_EmpName,
                                                                F_DepID,
                                                                F_DepName,
                                                                F_CISignInDate,
                                                                F_CISignOutDate,
                                                                F_CIRealityWorkDuration,
                                                                F_AppendSignInPersonID,
                                                                F_AppendSignInPersonName,
                                                                F_AppendSignInPersonNote,
                                                                F_CIIsLate,
                                                                F_CIIsLeaveEarvly,
                                                                F_CIIsAbsenteeism,
                                                                F_CIIsNormal,
                                                                F_CICreateDate,
                                                                F_CIIsSignIn,
                                                                F_CIIsCalculate,
                                                                F_Date) 
                                                                VALUES({0},'{1}',{2},'{3}','{4}','{5}',{6},{7},'{8}','{9}',{10}, '{11}',{12},{13},'{14}')",
                                    employeeInfo.EmpID,
                                    employeeInfo.EmpName,
                                    employeeInfo.DepID,
                                    employeeInfo.DepName,
                                    signInDate,
                                    signOutDate,
                                    workTime,
                                    appendEmpID,
                                    appendEmpName,
                                    note.Replace("'", "''"),
                                    makeSql(signOutDate, signInDate, workDuration),
                                    DateTime.Now.ToString("yyyy-MM-dd"),
                                    "0",
                                    "0",
                                    date);
                #endregion
                int res = MrDBAccess.ExecuteNonQuery(sql);
                if (res == 0)
                {
                    return(0);
                }
                modifyedEmpList.Add(GetCheckInfo(int.Parse(employeeInfo.EmpID), date));
            }
            //List<CheckInInfo> modifyedEmpList = GetCheckInInfoListNoCalculate();
            MonthAttendanceService.Instance.UpdateForAppendSignEmp(modifyedEmpList, true);
            return(1);
        }
Example #57
0
    public string set_Title(EmployeeInfo EmpInfo)
    {
        SqlConnection sqlCon = new SqlConnection(conStr);
        SqlCommand sqlCmd = new SqlCommand("sp_set_Title", sqlCon);
        sqlCmd.CommandType = CommandType.StoredProcedure;

        SqlParameter Emp_Title = sqlCmd.Parameters.Add("@Title", SqlDbType.VarChar, 50);
        Emp_Title.Value = EmpInfo.Title;

        SqlParameter Emp_TDesc = sqlCmd.Parameters.Add("@TitleDesc", SqlDbType.VarChar, 255);
        Emp_TDesc.Value = EmpInfo.TitleDesc;

        SqlParameter Emp_TimeEntry = sqlCmd.Parameters.Add("@TimeEntry", SqlDbType.Char,1);
        Emp_TimeEntry.Value = EmpInfo.TimeEntry;

        try
        {
            sqlCon.Open();
            sqlCmd.ExecuteNonQuery();
            sqlCon.Close();
            return "Title added successfully ..";
        }
        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);
            return ex.Message;
        }
    }
Example #58
0
        private XElement BuildViewString(bool isAdminDepartment, string departmentId)
        {
            var             url = SPContext.Current.Web.Url;
            EmployeeInfoDAL _employeeInfoDAL    = new EmployeeInfoDAL(url);
            EmployeeInfo    currentEmployeeInfo = _employeeInfoDAL.GetByADAccount(SPContext.Current.Web.CurrentUser.ID);

            XElement filterElement = null;
            string   deptFilterStr = @"<Eq>
                                        <FieldRef Name='CommonDepartment' LookupId='TRUE'/>
                                        <Value Type='Lookup'>{DepartmentId}</Value>
                                    </Eq>";

            if (isBOD || isAdminDepartment)
            {
                if ((!string.IsNullOrEmpty(departmentId) && departmentId.Trim().Equals("0")) && (isBOD || isAdminDepartment))
                {
                    deptFilterStr = @"<IsNotNull>
                                        <FieldRef Name='CommonDepartment' />
                                    </IsNotNull>";
                }
            }

            deptFilterStr = $@"<And>
                                    {deptFilterStr}
                                    <Eq>
                                        <FieldRef Name='CommonLocation' LookupId='TRUE'/>
                                        <Value Type='Lookup'>{currentEmployeeInfo.FactoryLocation.LookupId}</Value>
                                    </Eq>
                                </And>";

            string statusQuery = @"<Gt>
                                    <FieldRef Name='ID' />
                                    <Value Type='Counter'>0</Value>
                                </Gt>";

            if (!isBOD && isAdminDepartment)
            {
                statusQuery = @"<Eq>
                                    <FieldRef Name='ApprovalStatus'  />
                                    <Value Type='Text'>Approved</Value>
                                </Eq>";
            }

            filterElement = XElement.Parse(@"<And>" + statusQuery +
                                           @"<And>" +
                                           deptFilterStr +
                                           @"<And>
                                                            <Geq>
                                                                <FieldRef Name='Created' />
                                                                <Value IncludeTimeValue='TRUE' Type='CommonFrom'>{FromDate}</Value>
                                                            </Geq>
                                                            <Leq>
                                                                <FieldRef Name='Created' />
                                                                <Value IncludeTimeValue='TRUE' Type='CommonFrom'>{ToDate}</Value>
                                                            </Leq>
                                                        </And>
                                                  </And>
                                            </And>");

            return(filterElement);
        }
Example #59
0
    public String ckRequire2; // 변경    // thay đổi

    protected void Page_Load(object sender, EventArgs e)
    {
        bllSecCardData = new SecCardData();
        bllElecApprove = new ElecApprove();

        // 로그인 체크    check login
        EmployeeInfo loginEmployee = new EmployeeInfo();

        loginEmployee = (EmployeeInfo)Session["loginMember"];
        if (loginEmployee == null)
        {
            Response.Redirect("~/login.aspx", true);
        }

        // 임직원 정보 보이기      //xem thông tin nhân viên
        lblDepartment.Text  = loginEmployee.Dep_name;
        lblUpnid.Text       = loginEmployee.Upnid;
        lblOfficeName.Text  = loginEmployee.OfficeName;
        lblDisplayName.Text = loginEmployee.DisplayName;
        lblTitle.Text       = loginEmployee.Title_name;
        if (loginEmployee.OfficePhoneNumber.Equals(" "))
        {
            if (inOfficePhone.Text.Equals(" "))
            {
                inOfficePhone.Text = "";
            }
        }
        else
        {
            if (inOfficePhone.Text.Equals(""))
            {
                inOfficePhone.Text = loginEmployee.OfficePhoneNumber;
            }
        }

        if (Page.IsPostBack)
        {
            SecCardDataInfo secCardDataInfo = new SecCardDataInfo();
            ElecApproveInfo elecApproveInfo = new ElecApproveInfo();

            secCardDataInfo.RegDate = DateTime.Now.ToString("yyyyMMdd");


            secCardDataInfo.RequestUserCode = loginEmployee.Upnid;
            secCardDataInfo.RequestUserName = loginEmployee.DisplayName;
            secCardDataInfo.RequestDepCode  = loginEmployee.Department;
            secCardDataInfo.RequestDepDesc  = loginEmployee.Dep_name;

            secCardDataInfo.RoleCode    = loginEmployee.Title;
            secCardDataInfo.RoleDesc    = loginEmployee.Title_name;
            secCardDataInfo.OfficePhone = inOfficePhone.Text;

            secCardDataInfo.Comment     = comment.Text;
            secCardDataInfo.ReqDateFrom = txtStartDate.Text;
            secCardDataInfo.ReqDateEnd  = txtEndDate.Text;

            secCardDataInfo.Flag          = Convert.ToInt32(hiddenflag.Value);
            secCardDataInfo.ApprovalState = 0;

            // 신규  mới
            if (Request.QueryString["mode"].Equals("write"))
            {
                approveDocCode = bllSecCardData.GetNewApproveCode();
                secCardDataInfo.ElecApproveCode = approveDocCode;
                elecApproveInfo.ElecApproveCode = approveDocCode;
                int result  = bllSecCardData.insertSecCardData(secCardDataInfo);
                int result2 = bllElecApprove.insertElecApprove(elecApproveInfo);
                secCardCode = bllSecCardData.selectMaxCode();
            }
            // 수정  sửa
            else
            {
                secCardDataInfo.SecDataCode = Convert.ToInt32(Request["secCardDataCode"]);
                int result = bllSecCardData.updateSecCardData(secCardDataInfo);
                secCardCode = Convert.ToInt32(Request.QueryString["secCardDataCode"]);
            }

            Response.Redirect("viewSecCardManager.aspx?secCardDataCode=" + secCardCode, true);
        }
        else
        {
            // 신규  mới
            if (Request.QueryString["mode"].Equals("write"))
            {
                // 신규 결재 코드 가져오기
                approveDocCode = bllSecCardData.GetNewApproveCode();
                //ckRequire1 = "checked";
            }
            else
            {
                SecCardDataInfo oldSecCardDataInfo = bllSecCardData.selectSecCardData(Request.QueryString["secCardDataCode"]);

                inOfficePhone.Text = oldSecCardDataInfo.OfficePhone;
                comment.Text       = oldSecCardDataInfo.Comment;
                txtStartDate.Text  = oldSecCardDataInfo.ReqDateFrom;
                txtEndDate.Text    = oldSecCardDataInfo.ReqDateEnd;

                if (oldSecCardDataInfo.Flag == 1)
                {
                    ckRequire1 = "checked";
                }
                else
                {
                    ckRequire2 = "checked";
                }
            }
        }
    }
Example #60
0
        private string encryptkey = "Oyea";             //密钥

        #region  执行“目录”控件中的项操作
        /// <summary>
        /// 执行“目录”控件中的项操作
        /// </summary>
        /// <param name="control">控件类型</param>
        /// <param name="form">所属窗体</param>
        public void ShowForm(ToolStripMenuItem control, Form form)
        {
            switch (control.Tag.ToString())
            {
            case "1":
                EmployeeInfo employee = new EmployeeInfo();
                employee.MdiParent     = form;
                employee.StartPosition = FormStartPosition.CenterScreen;
                employee.Show();
                break;

            case "2":
                CompanyInfo company = new CompanyInfo();
                company.MdiParent     = form;
                company.StartPosition = FormStartPosition.CenterScreen;
                company.Show();
                break;

            case "3":
                Login login = new Login();
                login.StartPosition = FormStartPosition.CenterScreen;
                login.ShowDialog();
                form.Dispose();       //释放窗体资源
                break;

            case "5":
                GoodsIn goodsin = new GoodsIn();
                goodsin.MdiParent     = form;
                goodsin.StartPosition = FormStartPosition.CenterScreen;
                goodsin.Show();
                break;

            case "6":
                ReGoods regoods = new ReGoods();
                regoods.MdiParent     = form;
                regoods.StartPosition = FormStartPosition.CenterScreen;
                regoods.Show();
                break;

            case "7":
                GoodsFind stockfind = new GoodsFind();
                stockfind.MdiParent     = form;
                stockfind.StartPosition = FormStartPosition.CenterScreen;
                stockfind.Show();
                break;

            case "8":
                s sellgoods = new s();
                sellgoods.MdiParent     = form;
                sellgoods.StartPosition = FormStartPosition.CenterScreen;
                sellgoods.Show();
                break;

            case "9":
                CustomerReGoods customerregoods = new CustomerReGoods();
                customerregoods.MdiParent     = form;
                customerregoods.StartPosition = FormStartPosition.CenterScreen;
                customerregoods.Show();
                break;

            case "10":
                SellFind sellfind = new SellFind();
                sellfind.MdiParent     = form;
                sellfind.StartPosition = FormStartPosition.CenterScreen;
                sellfind.Show();
                break;

            case "11":
                ChangeGoods changegoods = new ChangeGoods();
                changegoods.MdiParent     = form;
                changegoods.StartPosition = FormStartPosition.CenterScreen;
                changegoods.Show();
                break;

            case "12":
                StockAlarm stockalarm = new StockAlarm();
                stockalarm.MdiParent     = form;
                stockalarm.StartPosition = FormStartPosition.CenterScreen;
                stockalarm.Show();
                break;

            case "13":
                StockFind stockfindall = new StockFind();
                stockfindall.MdiParent     = form;
                stockfindall.StartPosition = FormStartPosition.CenterScreen;
                stockfindall.Show();
                break;

            case "14":
                EmployeeReport employeereport = new EmployeeReport();
                employeereport.MdiParent     = form;
                employeereport.StartPosition = FormStartPosition.CenterScreen;
                employeereport.Show();
                break;

            case "15":
                CompanyReport companyreport = new CompanyReport();
                companyreport.MdiParent     = form;
                companyreport.StartPosition = FormStartPosition.CenterScreen;
                companyreport.Show();
                break;

            case "16":
                GoodsInReport goodsinreport = new GoodsInReport();
                goodsinreport.MdiParent     = form;
                goodsinreport.StartPosition = FormStartPosition.CenterScreen;
                goodsinreport.Show();
                break;

            case "17":
                GoodsInAnalysisReport sellgodsreport = new GoodsInAnalysisReport();
                sellgodsreport.MdiParent     = form;
                sellgodsreport.StartPosition = FormStartPosition.CenterScreen;
                sellgodsreport.Show();
                break;

            case "18":
                EmployeeSellReport employeesellreport = new EmployeeSellReport();
                employeesellreport.MdiParent     = form;
                employeesellreport.StartPosition = FormStartPosition.CenterScreen;
                employeesellreport.Show();
                break;

            case "19":
                GoodsInAnalysisReport goodsinana = new GoodsInAnalysisReport();
                goodsinana.MdiParent     = form;
                goodsinana.StartPosition = FormStartPosition.CenterScreen;
                goodsinana.Show();
                break;

            case "20":
                SellGoodsAnalysisReport sellana = new SellGoodsAnalysisReport();
                sellana.MdiParent     = form;
                sellana.StartPosition = FormStartPosition.CenterScreen;
                sellana.Show();
                break;

            case "21":
                SetPopedom setpopedom = new SetPopedom();
                setpopedom.MdiParent     = form;
                setpopedom.StartPosition = FormStartPosition.CenterScreen;
                setpopedom.Show();
                break;

            case "22":
                ChangePwd changepwd = new ChangePwd();
                changepwd.MdiParent     = form;
                changepwd.StartPosition = FormStartPosition.CenterScreen;
                changepwd.Show();
                break;

            case "23":
                BakData bakdata = new BakData();
                bakdata.MdiParent     = form;
                bakdata.StartPosition = FormStartPosition.CenterScreen;
                bakdata.Show();
                break;

            case "24":
                ReBakData rebakdata = new ReBakData();
                rebakdata.MdiParent     = form;
                rebakdata.StartPosition = FormStartPosition.CenterScreen;
                rebakdata.Show();
                break;

            case "25":
                SysUser sysuser = new SysUser();
                sysuser.MdiParent     = form;
                sysuser.StartPosition = FormStartPosition.CenterScreen;
                sysuser.Show();
                break;

            case "30":
                CustomerInfo customer = new CustomerInfo();
                customer.MdiParent     = form;
                customer.StartPosition = FormStartPosition.CenterScreen;
                customer.Show();
                break;

            case "31":
                EmployeeSellAnalysisReport sell = new EmployeeSellAnalysisReport();
                sell.MdiParent     = form;
                sell.StartPosition = FormStartPosition.CenterScreen;
                sell.Show();
                break;

            default:
                break;
            }
        }