Exemple #1
0
        protected void btnDoiMatKhau_OnClick(object sender, EventArgs e)
        {
            if (Sessions.UserID > 0)
            {
                User user = UserServices.GetUser(Sessions.User.UserName);

                if (user.Password.Equals(MatKhauCu.Text.Encrypt(AppSettings.Pasword)))
                {
                    user.Password = MatKhauMoi.Text.Encrypt(AppSettings.Pasword);
                    UserServices.Update(user);
                    lblMessage.Text = "Đổi mật khẩu thành công";
                }
                else
                {
                    lblMessage.Text = "Mật khẩu cũ không đúng";
                }
            }
            else if (Sessions.AgencyID > 0)
            {
                Department department = DepartmentServices.GetById(Sessions.DepartmentID);

                if (department.Password.Equals(MatKhauCu.Text.Encrypt(AppSettings.Pasword)))
                {
                    department.Password = MatKhauMoi.Text.Encrypt(AppSettings.Pasword);
                    DepartmentServices.Update(department);
                    lblMessage.Text = "Đổi mật khẩu thành công";
                }
                else
                {
                    lblMessage.Text = "Mật khẩu cũ không đúng";
                }
            }
        }
Exemple #2
0
        public ResponseDTO UpdateDepartmentStructure()
        {
            DepartmentServices departmentService = new DepartmentServices();
            var response = new ResponseDTO();

            try
            {
                var ret = departmentService.SincronizeDepartmentWithBitrix();

                if (ret == 1)
                {
                    response.Data = new { sucesso = 1, message = "Departamentos atualizados com sucesso!" };
                }
                else
                {
                    response.Data = new { sucesso = 0, message = "Não foi possível atualizar os departamentos!" };
                }
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
            }

            return(response);
        }
Exemple #3
0
        public ActionResult Edit([Bind(Include = "Id, Name, SalaryWorkPlace")] Department department)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    DepartmentServices.Update(CurrentUser.Id, department, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "UpdateConfirmed");
                    return(RedirectToAction("Index"));
                }
                catch (CfException cfex)
                {
                    TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
                }
                catch (Exception ex)
                {
                    TempData["Failure"] = ex.Message;
                }
            }

            ViewBag.SalaryWorkPlaceList = new SelectList(SalaryWorkPlaceServices.List(db), "Id", "Name", department.SalaryWorkPlace);
            return(View(department));
        }
        public ActionResult Edit([Bind(Include = "Id, FirstName, LastName, FatherName, MotherName, BirthDate, ExpectedEndDate, CersStartDate, CfStartDate, LeaveDate, LeaveReason, EmployeeStatus, Department, Notes, Category")] Employee employee)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    EmployeeServices.Update(CurrentUser.Id, employee, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "UpdateConfirmed");
                    return(RedirectToAction("Index"));
                }
                catch (CfException cfex)
                {
                    TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
                }
                catch (Exception ex)
                {
                    TempData["Failure"] = ex.Message;
                }
            }

            ViewBag.CategoryList       = new SelectList(CategoryServices.List(db), "Id", "Name", employee.Category);
            ViewBag.DepartmentList     = new SelectList(DepartmentServices.List(db), "Id", "Name", employee.Department);
            ViewBag.EmployeeStatusList = new SelectList(EmployeeStatusServices.List(db), "Id", "Name", employee.EmployeeStatus);
            return(View(employee));
        }
        private void LoadPeople()
        {
            var list = new DepartmentServices().GetAll();

            dlPeople.DataSource = list;
            dlPeople.DataBind();
        }
Exemple #6
0
 public PatientsController(AppDb newDb)
 {
     Db         = newDb;
     orgService = new OrganisationServices(Db);
     depService = new DepartmentServices(Db);
     patService = new PatientServices(Db);
 }
Exemple #7
0
        protected static void SendSms()
        {
            SmsBrandnameSoapClient smsClient = new SmsBrandnameSoapClient();

            foreach (var agency in DepartmentServices.GetList().Where(ag => !string.IsNullOrEmpty(ag.PhoneNumber?.Trim())))
            {
                var    soLieu     = RequestServices.LaySoLieuThongKe(MaDonVi: agency.DepartmentID);
                string smsContent = $"[YKCD] {agency.DepartmentName.ToUnsign()} co : {soLieu.NotPerform} ykcd chua thuc hien ({soLieu.NotPerformOutTerm} qua han); {soLieu.Performing} ykcd dang thuc hien ({soLieu.PerformingOutTerm} qua han).";

                foreach (var phoneNumber in agency.PhoneNumber.Split(';'))
                {
                    if (!string.IsNullOrEmpty(phoneNumber))
                    {
                        smsClient.GuiMotNoiDungNhieuSo(string.Empty, phoneNumber, smsContent, "ubnd_pdien", "Pd@3552374", 43);

                        SmsServices.Create(new Sms
                        {
                            ReceiverNumber = phoneNumber,
                            SmsContent     = smsContent,
                            SendTime       = DateTime.Now
                        });
                    }
                }
            }
        }
Exemple #8
0
        public ActionResult Create([Bind(Include = "Id, Employee, Month, Department, SubscriptionType, Amount, Notes, IsFixed")] Subscription subscription)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    SubscriptionServices.Insert(CurrentUser.Id, subscription, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed");
                    return(RedirectToAction("Index"));
                }
                catch (CfException cfex)
                {
                    TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
                }
                catch (Exception ex)
                {
                    TempData["Failure"] = ex.Message;
                }
            }

            ViewBag.DepartmentList       = new SelectList(DepartmentServices.List(db), "Id", "Name");
            ViewBag.EmployeeList         = new SelectList(EmployeeServices.List(db), "Id", "FirstName");
            ViewBag.SubscriptionTypeList = new SelectList(SubscriptionTypeServices.List(db), "Id", "Name");
            return(View(subscription));
        }
        public ActionResult Create([Bind(Include = "Payment, Department, Balance")] SalaryPayment salaryPayment)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    SalaryPaymentServices.Insert(CurrentUser.Id, salaryPayment, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed");
                    return(RedirectToAction("Index"));
                }
                catch (CfException cfex)
                {
                    TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
                }
                catch (Exception ex)
                {
                    TempData["Failure"] = ex.Message;
                }
            }

            ViewBag.PaymentList    = new SelectList(PaymentServices.List(db), "Id", "Notes");
            ViewBag.DepartmentList = new SelectList(DepartmentServices.List(db), "Id", "Name");
            return(View(salaryPayment));
        }
Exemple #10
0
        public ActionResult Create([Bind(Include = "Id, InstallmentDecreaseOrder, Employee, Department, DecreaseAmount, NewInstallmentAmount, Notes")] InstallmentDecrease installmentDecrease)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    InstallmentDecreaseServices.Insert(CurrentUser.Id, installmentDecrease, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed");
                    return(RedirectToAction("Index"));
                }
                catch (CfException cfex)
                {
                    TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
                }
                catch (Exception ex)
                {
                    TempData["Failure"] = ex.Message;
                }
            }

            ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName");
            ViewBag.InstallmentDecreaseOrderList = new SelectList(InstallmentDecreaseOrderServices.List(db), "Id", "CersNumber");
            ViewBag.DepartmentList = new SelectList(DepartmentServices.List(db), "Id", "Name");
            return(View(installmentDecrease));
        }
        public ActionResult Create()
        {
            Db db = new Db(DbServices.ConnectionString);

            ViewBag.PaymentList    = new SelectList(PaymentServices.List(db), "Id", "Notes");
            ViewBag.DepartmentList = new SelectList(DepartmentServices.List(db), "Id", "Name");
            return(View());
        }
Exemple #12
0
 public AppInfoController(AppDb newDb)
 {
     Db         = newDb;
     orgService = new OrganisationServices(Db);
     depService = new DepartmentServices(Db);
     patService = new PatientServices(Db);
     queueCalc  = new QueuePositionCalculator();
 }
Exemple #13
0
 protected override void UpdateObject()
 {
     item = (Department)ViewState["CurrentObject"];
     item.DepartmentName  = TenPhongBan.Text.Trim();
     item.DisplayOrder    = ThuTuHienThi.Text.ToInteger();
     item.IsShowStatistic = HienThiThongKe.Checked;
     DepartmentServices.Update(item);
 }
Exemple #14
0
 protected override void CreateNewObject()
 {
     item = new Department();
     item.DepartmentName  = TenPhongBan.Text.Trim();
     item.DisplayOrder    = ThuTuHienThi.Text.ToInteger();
     item.IsShowStatistic = HienThiThongKe.Checked;
     DepartmentServices.Create(item);
 }
Exemple #15
0
        // GET: Department
        public ActionResult Index()
        {
            DepartmentVM       vm          = new DepartmentVM();
            DepartmentServices deptService = new DepartmentServices(dbContext);

            vm.DepartmentList = deptService.GetAllDepartment();
            return(View(vm));
        }
Exemple #16
0
 protected override void ShowObjectInformation()
 {
     item = DepartmentServices.GetById(IntId);
     ViewState["CurrentObject"] = item;
     TenPhongBan.Text           = item.DepartmentName;
     ThuTuHienThi.Text          = item.DisplayOrder.ToString();
     HienThiThongKe.Checked     = item.IsShowStatistic ?? false;
 }
        public ActionResult Create()
        {
            Db db = new Db(DbServices.ConnectionString);

            ViewBag.CategoryList       = new SelectList(CategoryServices.List(db), "Id", "Name");
            ViewBag.DepartmentList     = new SelectList(DepartmentServices.List(db), "Id", "Name");
            ViewBag.EmployeeStatusList = new SelectList(EmployeeStatusServices.List(db), "Id", "Name");
            return(View());
        }
Exemple #18
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int Id = Convert.ToInt32(txtId.Text);

            DepartmentServices.Delete(Id);
            lblError.Text = "Designation Deleted.";
            DataGvProperties();
            Clear();
        }
Exemple #19
0
        public ActionResult Add(AddVM vm)
        {
            DepartmentServices deptService = new DepartmentServices(dbContext);

            deptService.AddDepartment(new Department {
                DeptName = vm.DeptName, DeptLoc = vm.DeptLoc
            });
            return(RedirectToAction("Index"));
        }
Exemple #20
0
        public ActionResult Create()
        {
            Db db = new Db(DbServices.ConnectionString);

            ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName");
            ViewBag.InstallmentDecreaseOrderList = new SelectList(InstallmentDecreaseOrderServices.List(db), "Id", "CersNumber");
            ViewBag.DepartmentList = new SelectList(DepartmentServices.List(db), "Id", "Name");
            return(View());
        }
        protected override void DeleteAction(string id)
        {
            foreach (var department in DepartmentServices.GetList(id.ToInteger()))
            {
                DepartmentServices.Delete(department);
            }

            DepartmentGroupServices.Delete(id.ToInteger());
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            model.DepttName = txtDepttName.Text;

            DepartmentServices.Insert(model);
            Clear();
            DataGvProperties();
            lblError.Text = "Record Inserted.";
        }
Exemple #23
0
        public ActionResult Create()
        {
            Db db = new Db(DbServices.ConnectionString);

            ViewBag.DepartmentList       = new SelectList(DepartmentServices.List(db), "Id", "Name");
            ViewBag.EmployeeList         = new SelectList(EmployeeServices.List(db), "Id", "FirstName");
            ViewBag.SubscriptionTypeList = new SelectList(SubscriptionTypeServices.List(db), "Id", "Name");
            return(View());
        }
Exemple #24
0
        protected override void BindOtherValue()
        {
            foreach (var user in UserServices.GetList(new[] { UserRole.LanhDaoVP, UserRole.LanhDaoDonVi }))
            {
                NguoiKy.AddSelectItem(user.FullName, user.UserID.ToString(), user.DepartmentName?.ToUpper());
            }

            ChuyenVien.BindData(UserServices.GetList(new[] { UserRole.ChuyenVienVP, UserRole.ChuyenVien, UserRole.TruongPhongBan, UserRole.LanhDaoVP, UserRole.Administrator }).ToList <object>(), "UserID", "FullName", "DepartmentName");
            DonViThucHien.BindData(DepartmentServices.GetList().ToList <object>(), "DepartmentID", "DepartmentName", "DepartmentGroupName");
        }
Exemple #25
0
        private void LoadDepartments(bool bindData)
        {
            var d = new DepartmentServices().GetAll();

            rgDepartment.DataSource = d;
            if (bindData)
            {
                rgDepartment.DataBind();
            }
        }
Exemple #26
0
        public ActionResult Edit(EditVM vm)
        {
            DepartmentServices deptService = new DepartmentServices(dbContext);

            deptService.UpdateDepartment(new Department {
                Id = vm.Id, DeptName = vm.DeptName, DeptLoc = vm.DeptLoc
            });

            return(RedirectToAction("Index"));
        }
        public ActionResult Add(AddVM vm)
        {
            EmployeeServices   empServices = new EmployeeServices(dbContext);
            DepartmentServices deptService = new DepartmentServices(dbContext);

            empServices.AddEmployee(new Employee {
                EmpName = vm.EmpName, EmpJob = vm.EmpJob, EmpSalary = vm.EmpSalary, Department = deptService.SeacrhDepartment(vm.SelectedDept)
            });
            return(RedirectToAction("Index"));
        }
        public ActionResult Add()
        {
            AddVM              vm          = new AddVM();
            EmployeeServices   empServices = new EmployeeServices(dbContext);
            DepartmentServices deptService = new DepartmentServices();

            vm.DeptLsit = deptService.GetAllDepartment();

            return(View(vm));
        }
Exemple #29
0
        protected override void BindOtherValue()
        {
            foreach (var user in UserServices.GetList(new[] { 6, 9 }))
            {
                NguoiKy.AddSelectItem(user.FullName, user.UserID.ToString(), user.DepartmentName.ToUpper());
            }

            ChuyenVienTheoDoi.BindData(UserServices.GetList(new[] { 10 }).ToList <object>(), "UserID", "FullName", "DepartmentName");
            DonViThucHien.BindData(DepartmentServices.GetList().ToList <object>(), "DepartmentID", "DepartmentName", "DepartmentGroupName");
        }
        public ActionResult Login(LoginModel loginModel)
        {
            Char charRange = '/';

            //STEP1: GOI HAM LOGIN TOI CSDL *****************************************************
            this.SetConnectionDB();
            BI_Project.Services.User.UserServices userServices = new UserServices(this.DBConnection);
            BI_Project.Services.Departments.DepartmentServices departmentServices = new DepartmentServices(this.DBConnection);

            EntityUserModel       entityUser       = userServices.CheckLogin(loginModel);
            EntityDepartmentModel entityDepartment = departmentServices.GetEntityById(entityUser.DeptId);
            SetDefaultPageService setDefault       = new SetDefaultPageService(DBConnection);

            if (entityUser.UserName != null)
            {
                Session["UserName"] = entityUser.UserName;
                Session["FullName"] = entityUser.FullName;
                Session[this.SESSION_NAME_USER_NAME] = entityUser.UserName;
                Session[this.SESSION_NAME_USERID]    = entityUser.UserId;
                Session["DepartIdUserLogin"]         = entityUser.DeptId;
                Session["IsAdmin"]         = entityUser.IsAdmin;
                Session["IsSuperAdmin"]    = entityUser.IsSuperAdmin;
                Session["CodeIsAdmin"]     = entityDepartment.Code;
                Session["Filter01IsAdmin"] = entityDepartment.Filter01;
                List <EntityUserMenuModel> entityUserMenuModel = setDefault.GetListDefaultPage(entityUser.UserId);
                foreach (EntityUserMenuModel item in entityUserMenuModel)
                {
                    if (item.IsDefaultPage == true)
                    {
                        var    _path       = item.Path;
                        string _controller = _path.Split(charRange)[0];
                        string _action     = _path.Split(charRange)[1];
                        int    _menuId     = item.MenuId;

                        return(RedirectToAction(_action + "/" + _menuId, _controller));
                    }
                }
                return(RedirectToAction("Index"));
            }
            if (userServices.ERROR != null)
            {
                Session["msgcode"] = MessageType.ServerError;
                FileHelper.SaveFile(userServices.ERROR, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + BI_Project.Helpers.Utility.APIStringHelper.GenerateFileId() + ".txt");
            }
            else
            {
                Session["msgcode"] = MessageType.BusinessError;
            }

            this.GetLanguage();
            ViewData["VIEWDATA_LANGUAGE"] = this.LANGUAGE_OBJECT;
            return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/login.cshtml", loginModel));

            //STEP2: NEU DANG NHAP KHONG THANH CONG
        }