示例#1
0
文件: Employee.cs 项目: cy2296/coding
 public Employee(string Name, EmployeeType employeeType, double HoursWorked)
 {
     _hoursWorked = HoursWorked;
     _name = Name;
     _employeeType = employeeType;
     _overTimeHours = 0;
 }
        public ActionResult CreateModal([Bind(Include = "ParentID,ChildID,EmployeeTypeID,RatingID,Employee,NewEmployeeType")] RestaurantEmployee restaurantEmployee)
        {
            if (restaurantEmployee.ChildID == 0 && !string.IsNullOrEmpty( restaurantEmployee.Employee))
            {
                Employee emp = new Employee() { Name = restaurantEmployee.Employee, Description = string.Empty };
                db.Employees.Add(emp);
                db.SaveChanges();
                ModelState["ChildID"].Errors.Clear();
                restaurantEmployee.ChildID = emp.ID;
            }
            if (restaurantEmployee.EmployeeTypeID == 0 && !string.IsNullOrEmpty(restaurantEmployee.NewEmployeeType))
            {
                EmployeeType type = new EmployeeType() { Name = restaurantEmployee.Employee, Description = string.Empty };
                db.EmployeeTypes.Add(type);
                db.SaveChanges();
                ModelState["EmployeeTypeID"].Errors.Clear();
                restaurantEmployee.EmployeeTypeID = type.ID;
            }
            if (ModelState.IsValid)
            {
                db.RestaurantEmployees.Add(restaurantEmployee);
                db.SaveChanges();
                return RedirectToAction("Details", "Restaurants", new { id = restaurantEmployee.ParentID });
            }

            ViewBag.ParentID = ViewBag.ParentID;
            ViewBag.RatingID = new SelectList(db.Ratings, "ID", "Name", restaurantEmployee.RatingID);
            return View(restaurantEmployee);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            DBConnection bindComboBox = new DBConnection();
            City cities = new City();
            DataTable DT = new DataTable();
            DT = bindComboBox.BindDropdown(cities.SearchCities(), "City_Name", "City_Number");
            CityDDL.DataSource = DT;
            CityDDL.DataValueField = "City_Number";
            CityDDL.DataTextField = "City_Name";

            CityDDL.DataBind();

            GenderDDL.Items.Add("Male");
            GenderDDL.Items.Add("Female");

            //EmployeeType
            EmployeeType empType = new EmployeeType();
            DT = bindComboBox.BindDropdown(empType.SearchEmployeeTypes(), "Employee_Type_Name", "Employee_Type_Number");

            EmployeeTypeDDL.DataSource = DT;
            EmployeeTypeDDL.DataValueField = "Employee_Type_Name";
            EmployeeTypeDDL.DataTextField = "Employee_Type_Number";

            EmployeeTypeDDL.DataBind();
        }
示例#4
0
 public Employee(int id, string username, string name, DateTime birthday, EmployeeType type)
 {
     Id = id;
     Username = username;
     Name = name;
     Birthday = birthday;
     Type = type;
 }
        public static string GenerateLink(EmployeeType employeeType)
        {
            var type = ConfirmType.LinkInvite.ToString();
            var emplType = (int) employeeType;

            var validationKey = EmailValidationKeyProvider.GetEmailKey(type + emplType);

            return CommonLinkUtility.GetFullAbsolutePath(String.Format("~/confirm.aspx?type={0}&key={1}&uid={2}&emplType={3}", type, validationKey, SecurityContext.CurrentAccount.ID, emplType));
        }
示例#6
0
文件: Program.cs 项目: cy2296/coding
        public void _calcOT(string Name, EmployeeType empType, double HoursWorked, double ExpectedOT)
        {
            Employee emp = new Employee(Name, empType, HoursWorked);
            TheRuleList trl = new TheRuleList(emp);
            trl.Invoke();

            Console.WriteLine("Name: {0}\tEmployeeType: {1}\tHoursWorked: {2}\tOverTime: {3}\tExpected OverTime: {4}"
            , Name, empType.ToString(), HoursWorked.ToString(), emp.OverTimeHours.ToString(), ExpectedOT.ToString());
        }
示例#7
0
        public object GeInviteLink(EmployeeType employeeType)
        {
            if (!WebItemSecurity.IsProductAdministrator(WebItemManager.PeopleProductID, AuthContext.CurrentAccount.ID))
            {
                throw new SecurityException("Method not available");
            }

            return(CommonLinkUtility.GetConfirmationUrl(string.Empty, ConfirmType.LinkInvite, (int)employeeType)
                   + $"&emplType={employeeType:d}");
        }
示例#8
0
        private void CreateEmployees(EmployeeType type, int count)
        {
            int number = 0;

            while (number < count)
            {
                var employee = new Employee(type, ++number);
                Push(employee);
            }
        }
示例#9
0
 public ActionResult Edit([Bind(Include = "id,Type,Basics,Managment,Guidence,Teaching,Observing")] EmployeeType employeeType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeeType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employeeType));
 }
        public async Task <EmployeeType> AddEmployeeType(EmployeeType employeeType)
        {
            var employeeTypeToAdd = _mapper.Map <MongoEmployeeType>(employeeType);

            var createdEmployeeType = await _employeeTypeRepository.AddEmployeeType(employeeTypeToAdd);

            var employeeTypeResult = _mapper.Map <EmployeeType>(createdEmployeeType);

            return(employeeTypeResult);
        }
示例#11
0
        public IActionResult Create(EmployeeType model)
        {
            if (ModelState.IsValid)
            {
                this.employeeTypeRepository.AddType(model);
                return(this.RedirectToAction("Index"));
            }

            return(this.View());
        }
        public ActionResult Add(EmployeeType model)
        {
            bool result = _iEmployeeTypeManager.Add(model);

            if (result)
            {
                return(RedirectToAction("EmployeeTypeList"));
            }
            return(View());
        }
示例#13
0
 public Employee(EmployeeType employeeType, bool isPPh21)
 {
     if (employeeType == EmployeeType.JenisnyaA)
     {
         if (!isPPh21)
         {
             throw new DomainException("Employee yang jenisnya A harus PPH 21");
         }
     }
 }
示例#14
0
 public Employee(string name, EmployeeType type, string title, float rate)
 {
     this.Name     = name;
     this.Type     = type;
     this.JobTitle = title;
     this.PayRate  = rate;
     Data.Employees.Add(this);
     //?Do we need to save here? I Am already saving at applicaiton close for safty.. this might be redudundent
     //Data.SaveData();
 }
示例#15
0
 public static string GenerateLink(EmployeeType employeeType)
 {
     if (CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsAdmin() ||
         WebItemSecurity.IsProductAdministrator(WebItemManager.PeopleProductID, SecurityContext.CurrentAccount.ID))
     {
         return(CommonLinkUtility.GetConfirmationUrl(string.Empty, ConfirmType.LinkInvite, (int)employeeType, SecurityContext.CurrentAccount.ID)
                + String.Format("&emplType={0}", (int)employeeType));
     }
     return(null);
 }
示例#16
0
 public ActionResult Edit([Bind(Include = "Id,Name,SortOrder")] EmployeeType employeeType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeeType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employeeType));
 }
示例#17
0
        public void TestGetSetElementsOnArrayProperty()
        {
            object employee = EmployeeType.CreateInstance();

            employee.SetPropertyValue("Subordinates", new Employee[10]);
            object subordinates = employee.GetPropertyValue("Subordinates");

            subordinates.SetElement(5, employee);
            Assert.AreEqual(employee, subordinates.GetElement(5));
        }
示例#18
0
        public static string GetEmployeeTypeName(int typeId)
        {
            var employeeType = new EmployeeType()
            {
                Id = typeId
            };

            _repositoryManager.EmployeeType.GetEmployeeTypeById(employeeType);

            return(employeeType.Name);
        }
示例#19
0
        public IActionResult DeleteEmployeeType(long id)
        {
            EmployeeType a = EmpType_repo.Find(id);

            if (a == null)
            {
                return(NotFound());
            }
            EmpType_repo.Delete(a);
            return(Ok());
        }
示例#20
0
 public override IDataReader Contacts_Filter_Deleted(int branchId, EmployeeType employeeType, int pageIndex, int pageSize)
 {
     switch (employeeType)
     {
         case EmployeeType.Collaborator:
             return SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("Contacts_Filter_Deleted"), branchId, pageIndex, pageSize);
         case EmployeeType.Consultant:
             return SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("Contacts_Filter_Deleted"), branchId, pageIndex, pageSize);
     }
     return null;
 }
示例#21
0
        public async Task <IActionResult> Create([Bind("TypeId,TypeName")] EmployeeType employeeType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employeeType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employeeType));
        }
示例#22
0
        //default user constructor
        public User(string newName, EmployeeType empType)
        {
            userID    = noOfUsers++;
            this.name = newName;
            EmpType   = empType;

            meetingList   = new List <Meeting>();
            exclusionSet  = new bool[6];
            preferenceSet = new bool[6];
            userList.Add(this);
        }
        public async Task <ActionResult> Edit([Bind(Include = "EmployeeTypeId,EmployeeTyp,Desc,Is_Actv,Is_Del,Crtd_by,Crtd_ts,Mod_by,Mod_ts,RowVersion")] EmployeeType employeeType)
        {
            if (ModelState.IsValid)
            {
                db.Entry(employeeType).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(employeeType));
        }
示例#24
0
        public async Task <IActionResult> Create(EmployeeType employeeType)
        {
            if (ModelState.IsValid)
            {
                db.Add(employeeType);
                await db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employeeType));
        }
        public bool isPayDay(DateTime startDate, EmployeeType employeeType)
        {
            switch (employeeType)
            {
            case EmployeeType.Contractor:
                return(IsContractorPayday(startDate));

            default:
                return(IsPermPayday(startDate));
            }
        }
        public string GeInviteLink(EmployeeType employeeType)
        {
            if (!CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsAdmin() &&
                !WebItemSecurity.IsProductAdministrator(WebItemManager.PeopleProductID, SecurityContext.CurrentAccount.ID))
            {
                throw new SecurityException("Method not available");
            }

            return(CommonLinkUtility.GetConfirmationUrl(string.Empty, ConfirmType.LinkInvite, (int)employeeType, SecurityContext.CurrentAccount.ID)
                   + String.Format("&emplType={0}", (int)employeeType));
        }
示例#27
0
 public bool TakeCall(Call call, EmployeeType employeeType)
 {
     if (call.EmployeeType == employeeType)
     {
         IsFree       = false;
         call.IsTaken = true;
         IsFree       = true;
         return(true);
     }
     return(false);
 }
        public IHttpActionResult GetEmployeeType(string id)
        {
            EmployeeType employeeType = db.EmployeeTypes.Find(id);

            if (employeeType == null)
            {
                return(NotFound());
            }

            return(Ok(employeeType));
        }
示例#29
0
        public ActionResult Create([Bind(Include = "EmployeeTypeID,EmployeeTypeName")] EmployeeType employeeType)
        {
            if (ModelState.IsValid)
            {
                db.EmployeeTypes.Add(employeeType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employeeType));
        }
示例#30
0
        public IHttpActionResult PutEmployeeType(EmployeeType employeeType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            repository.UpdateEntity(employeeType);

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#31
0
        public IHttpActionResult PostEmployeeType(EmployeeType employeeType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            repository.InsertEntity(employeeType);

            return(CreatedAtRoute("ShopApi", new { id = employeeType.EmployeeTypeId }, employeeType));
        }
        public async Task <IHttpActionResult> GetEmployeeType(int id)
        {
            EmployeeType employeeType = await db.EmployeeTypes.FindAsync(id);

            if (employeeType == null)
            {
                return(NotFound());
            }

            return(Ok(employeeType));
        }
示例#33
0
        public ActionResult Create([Bind(new string[] { "Id,Name,SortOrder" })] EmployeeType employeeType)
        {
            if (ModelState.IsValid)
            {
                db.EmployeeTypes.Add(employeeType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employeeType));
        }
示例#34
0
        public ActionResult Create(EmployeeType employeetype)
        {
            if (ModelState.IsValid)
            {
                db.EmployeeType.Add(employeetype);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employeetype));
        }
 public EmployeeTypeData Map(EmployeeType ent)
 {
     return(new EmployeeTypeData
     {
         EmployeeTypeId = ent.EmployeeTypeId,
         EmployeeTypeCode = ent.EmployeeTypeCode,
         EmployeeTypeName = ent.EmployeeTypeName,
         EmployeeTypeDesc = ent.EmployeeTypeDesc,
         EmployeeTypeCategory = ent.EmployeeTypeCategory
     });
 }
示例#36
0
 /// <summary>
 /// Constructs an employee
 /// </summary>
 /// <param name="firstName">First name of an employee</param>
 /// <param name="lastName">Last name of an employee</param>
 /// <param name="city">City of an employee</param>
 /// <param name="type">EmployeeType of an employee</param>
 /// <param name="task">CompanyTask's ID of an employee</param>
 public Employee(string firstName, string lastName, string city, EmployeeType type, int?task = null)
 {
     Checks.CheckLength(firstName, "First Name", 0, 30);
     Checks.CheckLength(lastName, "Last Name", 0, 30);
     Checks.CheckLength(city, "City", 0, 30);
     FirstName = firstName;
     LastName  = lastName;
     City      = city;
     Type      = type;
     TaskID    = task;
 }
示例#37
0
        public Employee MakeEmployee(DateTime startDate, EmployeeType employeeType)
        {
            switch (employeeType)
            {
            case EmployeeType.Contractor:
                return(new Contractor(startDate));

            default:
                return(new Perm(startDate));
            }
        }
 public IEmployee CreateEmployee(EmployeeType type)
 {
     switch (type)
     {
         case EmployeeType.Salary:
             return new SalaryEmployee();
         case EmployeeType.Hourly:
             return new HourlyEmployee();
         default:
             throw new InvalidOperationException(string.Format("Couldn't create employee of type: {0}", type.ToString("G")));
     }
 }
示例#39
0
 //public override IDataReader Contacts_Filter_Search_Advance_Indanhsach(int branchId, string userIds, int statusMapId, int statusCareId, string levels, DateTime? handoverFromDate, DateTime? handoverToDate, DateTime? callFromDate, DateTime? callToDate, int qualityId, int productSellId, EmployeeType employeeType)
 //{
 //    switch (employeeType)
 //    {
 //        case EmployeeType.Collaborator:
 //            {
 //                const int statusIds = (int)StatusType.HandoverCollaborator;
 //                return SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("Contacts_Filter_Search_Advance_Collaborator_Indanhsach"), branchId, userIds, statusIds, statusMapId, statusCareId, levels, handoverFromDate, handoverToDate, callFromDate, callToDate, qualityId, productSellId);
 //            }
 //        case EmployeeType.Consultant:
 //            {
 //                const int statusIds = (int)StatusType.HandoverConsultant;
 //                return SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("Contacts_Filter_Search_Advance_Consultant_Indanhsach"), branchId, userIds, statusIds, statusMapId, statusCareId, levels, handoverFromDate, handoverToDate, callFromDate, callToDate, qualityId, productSellId);
 //            }
 //    }
 //    return null;
 //}
 // Delete
 public override void Contacts_Delete(int id, int contactId, int branchId, int userId, string phone, string email, int deletedBy, DateTime? deletedTime, string json, EmployeeType employeeType)
 {
     switch (employeeType)
     {
         case EmployeeType.Collaborator:
             SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("Contacts_Delete_Collaborator"), id, contactId, branchId, userId, phone, email, deletedBy, deletedTime, json);
             break;
         case EmployeeType.Consultant:
             SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("Contacts_Delete_Consultant"), id, contactId, branchId, userId, phone, email, deletedBy, deletedTime, json);
             break;
     }
 }
示例#40
0
 public override IDataReader Channels_Filter_Count_ForHandover(int branchId, string typeIds, string levelIds, string importIds, string statusIds, string containerIds, EmployeeType type)
 {
     switch (type)
     {
         case EmployeeType.All:
             return SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("Channels_Filter_Count_ForHandover_All"), branchId, typeIds, levelIds, importIds, statusIds, containerIds);
         case EmployeeType.Collaborator:
             return SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("Channels_Filter_Count_ForHandover_Collaborator"), branchId, typeIds, levelIds, importIds, statusIds, containerIds);
         case EmployeeType.Consultant:
             return SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("Channels_Filter_Count_ForHandover_Consultant"), branchId, typeIds, levelIds, importIds, statusIds, containerIds);
     }
     return null;
 }
 public UserInfo[] GetUsers(EmployeeStatus status, EmployeeType type)
 {
     var users = GetUsersInternal().Where(u => (u.Status & status) == u.Status);
     switch (type)
     {
         case EmployeeType.User:
             users = users.Where(u => !u.IsVisitor());
             break;
         case EmployeeType.Visitor:
             users = users.Where(u => u.IsVisitor());
             break;
     }
     return users.ToArray();
 }
示例#42
0
 public override IDataReader Levels_GetAll_WithContactCount(string userIds, int branchId, EmployeeType employeeType)
 {
     switch (employeeType)
     {
         case EmployeeType.Collaborator:
         {
             const int statusIds = (int) StatusType.HandoverCollaborator;
             return SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("Levels_GetAll_WithContactCount_Collaborator"), userIds, branchId, statusIds);
         }
         case EmployeeType.Consultant:
         {
             const int statusIds = (int) StatusType.HandoverConsultant;
             return SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("Levels_GetAll_WithContactCount_Consultant"), userIds, branchId, statusIds);
         }
     }
     return null;
 }
        static Employee GetEmployee(EmployeeType employeeType)
        {
            Employee employee;

            switch (employeeType)
            {
                case EmployeeType.Salaried:
                    employee = new SalariedEmployee(52000);
                    break;
                case EmployeeType.HourlyExcempt:
                    employee = new HourlyExemptEmployee(25);
                    break;
                default:
                    employee = new HourlyNonExemptEmployee(20);
                    break;
            }

            return employee;
        }
        public int ComputePayFor(EmployeeType employeeType)
        {
            var payment = 0;

            switch (employeeType)
            {
                case EmployeeType.Engineer :
                    payment = Salaries.EngineerBasePay;
                    break;
                case EmployeeType.Salesman :
                    payment = Salaries.SalesmanBasePay + Salaries.Commission;
                    break;
                case EmployeeType.Manager :
                    payment = Salaries.ManagerBasePay + Salaries.Bonus;
                    break;
            }

            return payment;
        }
示例#45
0
        public decimal PayAmount(EmployeeType type, decimal salary)
        {
            const int freeLanceRisk = 1000;
            switch (type)
            {
                case EmployeeType.Intern:
                    return PayAmount(salary);

                case EmployeeType.Architect:
                    return salary * 2;

                case EmployeeType.Consultant:
                    // Death Or Glory
                    return salary * 4 + freeLanceRisk;

                case EmployeeType.Developer:
                    return salary;
                default:
                    throw new WrongEmployeeComplaint();
            }
        }
示例#46
0
 public static void ContactRecovery(string ids, int userId, DateTime recoveryDate, EmployeeType employeeType, int createdBy)
 {
     DataProvider.Instance().Contacts_Update_Recovery(ids, userId, recoveryDate, employeeType, createdBy);
 }
示例#47
0
 public static List<ContactInfo> FilterSearchAdvance(int branchId, string userIds, int statusMapId, int statusCareId, string levels, DateTime? handoverFromDate, DateTime? handoverToDate, DateTime? callFromDate, DateTime? callToDate, int qualityId, int productSellId, EmployeeType employeeType, int pageIndex, int pageSize, out int totalRecord)
 {
     if (callFromDate.HasValue && !callToDate.HasValue) callToDate = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
     if (handoverFromDate.HasValue && !handoverToDate.HasValue) handoverToDate = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
     return FillContactCollection(DataProvider.Instance().Contacts_Filter_Search_Advance(branchId, userIds, statusMapId, statusCareId, levels, handoverFromDate, handoverToDate, callFromDate, callToDate, qualityId, productSellId, employeeType, pageIndex, pageSize), out totalRecord);
 }
示例#48
0
 // Search
 public static List<ContactInfo> FilterSearchManager(int branchId, string name, string mobile, string email, EmployeeType employeeType, int pageIndex, int pageSize, out int totalRecord)
 {
     return FillContactCollection(DataProvider.Instance().Contacts_Filter_Search_Manager(branchId, name, mobile, email, employeeType, pageIndex, pageSize), out totalRecord);
 }
        private void SendInvite(UserInfo user, string inviteMessage, bool join, EmployeeType emplType)
        {
            var inviteUrl = CommonLinkUtility.GetConfirmationUrl(user.Email, ConfirmType.EmpInvite, (int)emplType, SecurityContext.CurrentAccount.ID)
                            + String.Format("&firstname={0}&lastname={1}&emplType={2}",
                                            HttpUtility.UrlEncode(user.FirstName),
                                            HttpUtility.UrlEncode(user.LastName),
                                            (int)emplType);

            client.SendNoticeToAsync(
                        join ? Constants.ActionJoinUsers : Constants.ActionInviteUsers,
                        null,
                        RecipientFromEmail(new string[] { user.Email }, join),/*if it's invite - don't check activation status*/
                        new[] { EMailSenderName },
                        null,
                        new TagValue(Constants.TagUserName, SecurityContext.IsAuthenticated ? DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID) : ((HttpContext.Current != null) ? HttpContext.Current.Request.UserHostAddress : null)),
                        new TagValue(Constants.TagInviteLink, inviteUrl),
                        new TagValue(Constants.TagBody, inviteMessage ?? string.Empty),
                        Constants.TagTableTop(),
                        Constants.TagTableItem(1),
                        Constants.TagTableItem(2),
                        Constants.TagTableItem(3),
                        Constants.TagTableBottom(),
                        new TagValue(CommonTags.WithPhoto, "links"),
                        new TagValue(Constants.TagUserDisplayName, (user.DisplayUserName() ?? "").Trim()),
                        CreateSendFromTag());
        }
        public void InviteUsers(string emailList, string inviteMessage, bool join, EmployeeType emplType)
        {
            if (string.IsNullOrWhiteSpace(emailList))
            {
                return;
            }

            foreach (var email in emailList.Split(new[] { " ", ",", ";", Environment.NewLine, "\n", "\n\r" }, StringSplitOptions.RemoveEmptyEntries))
            {
                SendInvite(new UserInfo() { Email = email }, inviteMessage, join, emplType);
            }
        }
        private static UserInfo CreateNewUser(string firstName, string lastName, string email, string pwd, EmployeeType employeeType, bool fromInviteLink)
        {
            var isVisitor = employeeType == EmployeeType.Visitor;

            string secretEmailPattern = ConfigurationManager.AppSettings["web.autotest.secret-email"];
            if (!string.IsNullOrEmpty(secretEmailPattern) && Regex.IsMatch(email, secretEmailPattern, RegexOptions.Compiled))
            {
                fromInviteLink = false;
            }

            var newUser = UserManagerWrapper.AddUser(new UserInfo
                {
                    FirstName = firstName,
                    LastName = lastName,
                    Email = email,
                    WorkFromDate = TenantUtil.DateTimeNow()
                }, pwd, true, true, isVisitor, fromInviteLink);

            return newUser;
        }
示例#52
0
 public static List<ContactInfo> FilterTodayAppointment(string userIds, DateTime fromDate, DateTime toDate, string levels, int branchId, EmployeeType type, int pageIndex, int pageSize, out int totalRecord)
 {
     if (levels == null) levels = string.Empty;
     return FillContactCollection(DataProvider.Instance().Contacts_Filter_Today_Appointment(userIds, fromDate, toDate, levels, branchId, type, pageIndex, pageSize), out totalRecord);
 }
示例#53
0
        private static void UpdateContactLevelInfo(ContactAllInfo entity, ContactLevelInfoModel model, EmployeeType type)
        {
            if (model == null ||
                entity == null ||
                entity.ContactInfo == null ||
                entity.ContactLevelInfo == null)
                return;

            entity.ContactLevelInfo.ContactId = entity.ContactInfo.Id;
            if (!string.IsNullOrEmpty(model.AppointmentTime))
                entity.ContactLevelInfo.AppointmentTime = model.AppointmentTime.ToDateTime();
            switch (type)
            {
                case EmployeeType.Consultant:
                    if (!entity.ContactLevelInfo.HasAppointmentInterview)
                        entity.ContactLevelInfo.HasAppointmentInterview = entity.ContactLevelInfo.HasAppointmentInterviewHidden;
                    if (!entity.ContactLevelInfo.HasPointTestCasec)
                        entity.ContactLevelInfo.HasPointTestCasec = entity.ContactLevelInfo.HasPointTestCasecHidden;
                    if (!entity.ContactLevelInfo.HasPointInterview)
                        entity.ContactLevelInfo.HasPointInterview = entity.ContactLevelInfo.HasPointInterviewHidden;
                    if (!entity.ContactLevelInfo.HasCasecAccount)
                        entity.ContactLevelInfo.HasCasecAccount = entity.ContactLevelInfo.HasCasecAccountHidden;
                    if (!entity.ContactLevelInfo.HasLinkSb100)
                        entity.ContactLevelInfo.HasLinkSb100 = entity.ContactLevelInfo.HasLinkSb100Hidden;
                    if (!entity.ContactLevelInfo.HasSetSb100)
                        entity.ContactLevelInfo.HasSetSb100 = entity.ContactLevelInfo.HasSetSb100Hidden;
                    break;
            }
        }
示例#54
0
        private static void UpdateContactInfo(ContactAllInfo entity, ContactLevelInfoModel model, StatusMapInfo statusMapInfo, EmployeeType type)
        {
            // Check
            if (model == null || entity == null || entity.ContactInfo == null)
                return;
            if (entity.ContactLevelInfo == null) entity.ContactLevelInfo = new ContactLevelInfo();

            // Get in Db
            entity.ContactInfo = ContactRepository.GetInfo(model.ContactInfo.Id);

            // AppointmentDate
            var datetime = string.IsNullOrEmpty(model.RecallTime) ? string.Empty : model.RecallTime;
            if (!datetime.IsStringNullOrEmpty())
                datetime += string.IsNullOrEmpty(model.RecallTime24h) ? " 00:00:00" : " " + model.RecallTime24h;
            var appointmentDate = string.IsNullOrEmpty(datetime) ? null : datetime.ToDateTime("dd/MM/yyyy HH:mm:ss");

            switch (type)
            {
                case EmployeeType.Collector:
                    break;
                case EmployeeType.Collaborator:
                    entity.ContactInfo.StatusCareCollaboratorId = statusMapInfo.StatusCareId;
                    entity.ContactInfo.CallCollaboratorDate = entity.CallHistoryInfo.CallTime;
                    entity.ContactInfo.CallInfoCollaborator = model.ContactInfo.CallInfoCollaborator;
                    entity.ContactInfo.StatusMapCollaboratorId = model.ContactInfo.StatusMapCollaboratorId;
                    entity.ContactInfo.CallCount = entity.ContactInfo.StatusCareCollaboratorId == (int)StatusCareType.UnKnown
                                        ? entity.ContactInfo.CallCount + 1
                                        : 0;
                    entity.ContactInfo.AppointmentCollaboratorDate = appointmentDate;
                    break;
                case EmployeeType.Consultant:
                    entity.ContactInfo.StatusCareConsultantId = statusMapInfo.StatusCareId;
                    entity.ContactInfo.CallConsultantDate = entity.CallHistoryInfo.CallTime;
                    entity.ContactInfo.CallInfoConsultant = model.ContactInfo.CallInfoConsultant;
                    entity.ContactInfo.StatusMapConsultantId = model.ContactInfo.StatusMapConsultantId;
                    entity.ContactInfo.CallCount = entity.ContactInfo.StatusCareConsultantId == (int)StatusCareType.UnKnown
                                        ? entity.ContactInfo.CallCount + 1
                                        : 0;
                    entity.ContactInfo.AppointmentConsultantDate = appointmentDate;
                    entity.ContactInfo.ProductSoldId = model.ContactInfo.ProductSoldId;
                    break;
            }
            entity.ContactInfo.Id = model.ContactInfo.Id;
            entity.ContactInfo.Email = model.ContactInfo.Email;
            entity.ContactInfo.Notes = model.ContactInfo.Notes;
            entity.ContactInfo.Email2 = model.ContactInfo.Email2;
            entity.ContactInfo.Gender = model.ContactInfo.Gender;
            entity.ContactInfo.Address = model.ContactInfo.Address;
            entity.ContactInfo.StatusId = statusMapInfo.StatusIdNext;
            entity.ContactInfo.Fullname = model.ContactInfo.Fullname;
            entity.ContactInfo.Birthday = model.Birthday.ToDateTime();
            entity.ContactInfo.CallCount = model.ContactInfo.CallCount;
            entity.ContactInfo.QualityId = model.ContactInfo.QualityId;
            entity.ContactInfo.ProductSellId = model.ContactInfo.ProductSellId;
            entity.ContactInfo.CreatedBy = UserContext.GetCurrentUser().UserID;
            if (statusMapInfo.LevelIdNext > 0) entity.ContactInfo.LevelId = statusMapInfo.LevelIdNext;
            entity.ContactInfo.HandoverHistoryConsultantId = model.ContactInfo.HandoverHistoryConsultantId;
        }
示例#55
0
        private static void UpdateCallHistoryInfo(ContactAllInfo entity, ContactLevelInfoModel model, StatusMapInfo statusMapInfo, EmployeeType type)
        {
            if (model == null || entity == null || entity.ContactInfo == null)
                return;
            if (entity.ContactLevelInfo == null) entity.ContactLevelInfo = new ContactLevelInfo();

            var user = UserContext.GetCurrentUser();

            // Datetime
            var datetime = string.IsNullOrEmpty(model.RecallTime)
                               ? DateTime.Now.ToString("dd/MM/yyyy")
                               : model.RecallTime;
            datetime += string.IsNullOrEmpty(model.RecallTime24h)
                            ? " 00:00:00"
                            : " " + model.RecallTime24h;

            // CallInfo
            var callInfo = string.Empty;
            switch (type)
            {
                case EmployeeType.Collector:
                    break;
                case EmployeeType.Collaborator:
                    callInfo = model.ContactInfo.CallInfoCollaborator;
                    break;
                case EmployeeType.Consultant:
                    callInfo = model.ContactInfo.CallInfoConsultant;
                    break;
            }
            entity.CallHistoryInfo = new CallHistoryInfo
                                         {
                                             StatusUpdate = 1,
                                             UserLogType = (int)type,
                                             CreatedBy = user.UserID,
                                             CallTime = DateTime.Now,
                                             CallCenterInfo = callInfo,
                                             CreatedDate = DateTime.Now,
                                             StatusMapId = statusMapInfo.Id,
                                             ContactId = model.ContactInfo.Id,
                                             CallType = (int)CallType.Outcoming,
                                             LevelId = statusMapInfo.LevelIdNext,
                                             CallHistoryId = model.CallHistoryId,
                                             StatusCareId = statusMapInfo.StatusCareId,
                                             RecallTime = datetime.ToDateTime("dd/MM/yyyy HH:mm:ss"),
                                         };
        }
示例#56
0
 private static StatusMapInfo GetStatusMap(ContactLevelInfoModel model, EmployeeType type)
 {
     if (model.ContactInfo == null) return null;
     var statusMaps = StoreData.ListStatusMap.Count == 0
                          ? StatusMapRepository.GetAll() ?? new List<StatusMapInfo>()
                          : StoreData.ListStatusMap;
     switch (type)
     {
         case EmployeeType.Collector:
             break;
         case EmployeeType.Collaborator:
             return statusMaps.FirstOrDefault(c => c.Id == model.ContactInfo.StatusMapCollaboratorId);
         case EmployeeType.Consultant:
             return statusMaps.FirstOrDefault(c => c.Id == model.ContactInfo.StatusMapConsultantId);
     }
     return null;
 }
示例#57
0
 public static List<ContactInfo> FilterTodayNewAndAppointment(string userIds, DateTime fromDate, DateTime toDate, int branchId, EmployeeType type, int pageIndex, int pageSize, out int totalRecord)
 {
     return FillContactCollection(DataProvider.Instance().Contacts_Filter_Today_NewAndAppointment(userIds, fromDate, toDate, branchId, type, pageIndex, pageSize), out totalRecord);
 }
示例#58
0
 public static List<ContactInfo> GetBC42(int branchId, string userIds, int statusMapId, int statusCareId, string levels, DateTime? handoverFromDate, DateTime? handoverToDate, DateTime? callFromDate, DateTime? callToDate, int qualityId, int productSellId, EmployeeType employeeType)
 {
     return ObjectHelper.FillCollection<ContactInfo>(DataProvider.Instance().Contacts_GetBC42( branchId,  userIds,  statusMapId,  statusCareId,  levels, handoverFromDate,  handoverToDate,  callFromDate,  callToDate,  qualityId,  productSellId,  employeeType));
 }
示例#59
0
 public static void ContactHandoverFast(string ids, EmployeeType employeeType, int targetUserId, int targetBranchId, DateTime handoverDate,int createdBy)
 {
     DataProvider.Instance().Contacts_HandoverContactFast(ids, employeeType, targetUserId, targetBranchId, handoverDate, createdBy);
 }
示例#60
0
 public static int ContactRecoveryAll(string userIds, string levelIds, int statusMapId, int statusCareId, int day, int branchId, TodayType todayType, EmployeeType employeeType, int userId, DateTime recoveryDate, int createdBy)
 {
     return DataProvider.Instance().Contacts_Recovery_All(userIds, levelIds, statusMapId, statusCareId, day, branchId, todayType, employeeType, userId, recoveryDate, createdBy);
 }