public void Reload()
        {
            try
            {
                CalculatorSalariesBO aCalculatorSalariesBO = new CalculatorSalariesBO();
                SystemUsersBO aSystemUsersBO = new SystemUsersBO();
                List<CalculatorSalaryEN> aListCalculatorSalary = new List<CalculatorSalaryEN>();
                List<CalculatorSalaries> aListTemp = aCalculatorSalariesBO.Select_All();

                CalculatorSalaryEN aCalculatorSalary;

                for( int i =1; i<aListTemp.Count;i++)
                {
                    aCalculatorSalary = new CalculatorSalaryEN();
                    aCalculatorSalary.SetValue(aListTemp[i]);
                    aCalculatorSalary.SystemUser = aSystemUsersBO.Select_ByID(aListTemp[i].IDSystemUser).Name;
                    aListCalculatorSalary.Add(aCalculatorSalary);
                }
                dgvCalculatorSalaries.DataSource = aListCalculatorSalary.Where(a=>a.Disable == false).ToList();
                dgvCalculatorSalaries.RefreshDataSource();
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmLst_CalculatorSalaries.Reload\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }
        }
Example #2
0
        public void Del(HttpContext context)
        {
            String jSonString = "";
            try
            {

                int IDSystemUsers = Convert.ToInt32(context.Request.QueryString["IDSystemUsers"]);

                SystemUsersBO aSystemUsersBO = new SystemUsersBO();
                int ret = aSystemUsersBO.Del_ByID(IDSystemUsers);

                    if (ret == 0)
                    { jSonString = "{\"status\": \"success\"}"; }
                    if (ret != 0)
                    { jSonString = "{\"status\":\"error|" + ret.ToString() + "\"}"; }
            }
            catch (Exception ex)
            {
                jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message.ToString() + "\"}";
            }
            finally
            {
                context.Response.Write(jSonString);
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SystemUsersBO aSystemUsersBO = new SystemUsersBO();
            PermitsBO aPermitsBO = new PermitsBO();

            if (IsPostBack == true)
            {
                string Pass = Library.StringUtility.md5(Page.Request.Form["txtPassword"].ToString());
                string User = Page.Request.Form["txtUsername"].ToString();
                bool disable = false;
                SystemUsers aSystemUsers = aSystemUsersBO.Sel_ByUsername_ByPassword(User, Pass,disable);

                if (aSystemUsers != null)
                {
                    Session["LoginAccount"] = aSystemUsers;
                    List<vw_PermitsViewAll> ListPermitViewAll = aPermitsBO.GetAllInfoLogin_ByUsername(aSystemUsers.Username);
                    Session["LoginPermitViewAll"] = ListPermitViewAll;

                    Response.Redirect("Main.aspx");
                }
                else
                {

                    Response.Redirect("Default.aspx");
                }

            }
        }
        private void btnDisable_Click(object sender, EventArgs e)
        {
            int ID = Convert.ToInt32(viewSystemUsers_Divisions.GetFocusedRowCellValue("SystemUsers_Divisions_ID"));
            DialogResult result = MessageBox.Show("Bạn có chắc chắn muốn thực hiện ???", "Câu hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (DialogResult.Yes == result)
            {
                try
                {
                    SystemUsers_DivisionsBO aSystemUsers_DivisionsBO = new SystemUsers_DivisionsBO();
                    SystemUsers_Divisions aSystemUsers_Divisions = aSystemUsers_DivisionsBO.Select_ByID(ID);
                    aSystemUsers_Divisions.Disable = true;
                    SystemUsersBO aSystemUsersBO = new SystemUsersBO();
                    SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aSystemUsers_Divisions.IDSystemUser);
                    aSystemUsers.Disable = false;
                    aSystemUsers_DivisionsBO.Update(aSystemUsers_Divisions);
                    aSystemUsersBO.Update(aSystemUsers);

                    MessageBox.Show("Bạn đã thực hiện thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("frmLst_SystemUsers_Divisions.btnDisable_Click\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            ReloadData();
        }
        //hiennv
        public void Reload()
        {
            try
            {
                SystemUsersBO aSysUserBO = new SystemUsersBO();
                List<SystemUsers> aListTemp = aSysUserBO.Select_ByDisable(false);
                List<SystemUsers> aListSystemUsers = new List<SystemUsers>();

                foreach (SystemUsers item in aListTemp)
                {
                    SystemUsers aSystemUsers = aSysUserBO.Select_ByID(item.ID);
                    if (aSystemUsers.Image !=null)
                    {
                        if (aSystemUsers.Image.Length > 0)
                        {
                            Image image = ConvertByteArrayToImage(aSystemUsers.Image);
                            //image = image.GetThumbnailImage(60, (60 * image.Height) / image.Width, null, IntPtr.Zero);
                            image = image.GetThumbnailImage(50, 50, null, IntPtr.Zero);
                            Byte[] aImageByte = ConvertImageToByteArray(image);
                            aSystemUsers.Image = aImageByte;
                        }
                        else
                        {
                            //Image image =Image.FromFile("D:\\14-04-2014-NhaKhachChinhPhu\\HumanResource\\Images\\IconUser0.jpg");
                            Image image = Properties.Resources.IconUser0;
                            image = image.GetThumbnailImage(50, 50, null, IntPtr.Zero);
                            Byte[] aImageByte = ConvertImageToByteArray(image);
                            aSystemUsers.Image = aImageByte;
                        }
                    }
                    else
                    {

                            //Image image =Image.FromFile("D:\\14-04-2014-NhaKhachChinhPhu\\HumanResource\\Images\\IconUser0.jpg");
                            Image image = Properties.Resources.IconUser0;
                            image = image.GetThumbnailImage(50, 50, null, IntPtr.Zero);
                            Byte[] aImageByte = ConvertImageToByteArray(image);
                            aSystemUsers.Image = aImageByte;

                    }
                    aListSystemUsers.Add(aSystemUsers);
                }
                dgvSysUsers.DataSource = aListSystemUsers;
                dgvSysUsers.RefreshDataSource();
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmLst_SystemUsers.Reload\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void ReloadData()
        {
            try
            {
                SystemUsersBO aSystemUsersBO = new SystemUsersBO();
                ContractsBO aContractsBO = new ContractsBO();
                colContractDate.DisplayFormat.FormatType = FormatType.DateTime;
                colContractDate.DisplayFormat.FormatString = "{0:dd/MM/yyyy}";
                colFrom.DisplayFormat.FormatType = FormatType.DateTime;
                colFrom.DisplayFormat.FormatString = "{0:dd/MM/yyyy}";
                colTo.DisplayFormat.FormatType = FormatType.DateTime;
                colTo.DisplayFormat.FormatString = "{0:dd/MM/yyyy}";

                colCoefficent.DisplayFormat.FormatType = FormatType.Numeric;
                colCoefficent.DisplayFormat.FormatString = "{0:0,0}";
                colSalaryNet.DisplayFormat.FormatType = FormatType.Numeric;
                colSalaryNet.DisplayFormat.FormatString = "{0:0,0}";
                colSalaryCross.DisplayFormat.FormatType = FormatType.Numeric;
                colSalaryCross.DisplayFormat.FormatString = "{0:0,0}";

                // Load data cho gridview
                List<ContractsEN> aListContractsEN = new List<ContractsEN>();
                List<Contracts> aListTemp = aContractsBO.Select_All();
                ContractsEN aContractsEN;
                for (int i = 0; i < aListTemp.Count; i++)
                {
                    aContractsEN = new ContractsEN();
                    aContractsEN.SetValue(aListTemp[i]);
                    aContractsEN.Name = aSystemUsersBO.Select_ByID(aListTemp[i].IDSystemUser).Name;
                    aListContractsEN.Add(aContractsEN);
                }
                dgvContracts.DataSource = aListContractsEN;
                dgvContracts.RefreshDataSource();

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmLst_Contracts.ReloadData\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        //Author : Hiennv
        public void UpdateSystemUserInformation(SystemUsersEN aSystemUsersEN)
        {
            int status = -1;
            SystemUsersBO aSystemUsersBO = new SystemUsersBO();
            SystemUsers aSystemUsers_Old = new SystemUsers();
            SystemUsers aSystemUsers = new SystemUsers();

            SystemUserExtsBO aSystemUserExtsBO = new SystemUserExtsBO();
            //SystemUserExts aSystemUserExts = new SystemUserExts();
            SystemUserExts aSystemUserExts_Old = new SystemUserExts();
            try
            {

                aSystemUsers = aSystemUsersBO.Select_ByID(aSystemUsersEN.ID);
                aSystemUsers_Old = aSystemUsers;

                aSystemUsers.UserGroup = aSystemUsersEN.UserGroup;
                aSystemUsers.Email = aSystemUsersEN.Email;
                aSystemUsers.Username = aSystemUsersEN.Username;
                aSystemUsers.Name = aSystemUsersEN.Name;
                aSystemUsers.Password = aSystemUsersEN.Password;
                aSystemUsers.Birthday = aSystemUsersEN.Birthday;
                aSystemUsers.Identifier1 = aSystemUsersEN.Identifier1;
                aSystemUsers.Identifier2 = aSystemUsersEN.Identifier2;
                aSystemUsers.Identifier3 = aSystemUsersEN.Identifier3;
                aSystemUsers.Image = aSystemUsersEN.Image;
                aSystemUsers.Gender = aSystemUsersEN.Gender;
                aSystemUsers.IDRefAnotherSystem = aSystemUsersEN.IDRefAnotherSystem;
                aSystemUsers.IDRefMailSystem = aSystemUsersEN.IDRefMailSystem;
                aSystemUsers.Type = aSystemUsersEN.Type;
                aSystemUsers.Status = aSystemUsersEN.Status;
                aSystemUsers.Disable = aSystemUsersEN.Disable;
                aSystemUsers.Identifier1CreatedDate = aSystemUsersEN.Identifier1CreatedDate;
                aSystemUsers.Identifier2CreatedDate = aSystemUsersEN.Identifier2CreatedDate;
                aSystemUsers.Identifier3CreatedDate = aSystemUsersEN.Identifier3CreatedDate;
                aSystemUsers.PlaceOfIssue1 = aSystemUsersEN.PlaceOfIssue1;
                aSystemUsers.PlaceOfIssue2 = aSystemUsersEN.PlaceOfIssue2;
                aSystemUsers.PlaceOfIssue3 = aSystemUsersEN.PlaceOfIssue3;

                status = aSystemUsersBO.Update(aSystemUsers);

                if (status > 0)
                {

                    SystemUserExts aSystemUserExts = aSystemUserExtsBO.Select_ByID(aSystemUsersEN.aSystemUserExts.ID);
                    //aSystemUserExts_Old = aSystemUserExts;

                    if (aSystemUserExts != null)
                    {
                        aSystemUserExts.BirthPlace = aSystemUsersEN.aSystemUserExts.BirthPlace;
                        aSystemUserExts.Hometown = aSystemUsersEN.aSystemUserExts.Hometown;
                        aSystemUserExts.Address = aSystemUsersEN.aSystemUserExts.Address;
                        aSystemUserExts.InsuranceNumber = aSystemUsersEN.aSystemUserExts.InsuranceNumber;
                        aSystemUserExts.YearJob = aSystemUsersEN.aSystemUserExts.YearJob;
                        aSystemUserExts.YearDepartment = aSystemUsersEN.aSystemUserExts.YearDepartment;
                        aSystemUserExts.YearPayroll = aSystemUsersEN.aSystemUserExts.YearPayroll;
                        aSystemUserExts.YearUnemploymentInsurance = aSystemUsersEN.aSystemUserExts.YearUnemploymentInsurance;
                        aSystemUserExts.DifferenceContact = aSystemUsersEN.aSystemUserExts.DifferenceContact;
                        aSystemUserExts.Type = aSystemUsersEN.aSystemUserExts.Type;
                        aSystemUserExts.Status = aSystemUsersEN.aSystemUserExts.Status;
                        aSystemUserExts.Disable = aSystemUsersEN.aSystemUserExts.Disable;
                        aSystemUserExts.IDSystemUser = aSystemUsers.ID;
                        aSystemUserExts.Recruitment = aSystemUsersEN.aSystemUserExts.Recruitment;
                        aSystemUserExts.PermanentResidence = aSystemUsersEN.aSystemUserExts.PermanentResidence;
                        aSystemUserExts.CommunistPartyDate = aSystemUsersEN.aSystemUserExts.CommunistPartyDate;
                        aSystemUserExts.YouthUnionDate = aSystemUsersEN.aSystemUserExts.YouthUnionDate;
                        aSystemUserExts.EnlistmentDate = aSystemUsersEN.aSystemUserExts.EnlistmentDate;
                        aSystemUserExts.DemobilizedDate = aSystemUsersEN.aSystemUserExts.DemobilizedDate;
                        aSystemUserExts.MartyrsFamily = aSystemUsersEN.aSystemUserExts.MartyrsFamily;
                        aSystemUserExts.WoundedFamily = aSystemUsersEN.aSystemUserExts.WoundedFamily;
                        aSystemUserExts.LaborFamily = aSystemUsersEN.aSystemUserExts.LaborFamily;
                        aSystemUserExts.HightestAppellation = aSystemUsersEN.aSystemUserExts.HightestAppellation;
                        status = aSystemUserExtsBO.Update(aSystemUserExts);

                    }
                    else
                    {
                        aSystemUserExts = new SystemUserExts();
                        aSystemUserExts.BirthPlace = aSystemUsersEN.aSystemUserExts.BirthPlace;
                        aSystemUserExts.Hometown = aSystemUsersEN.aSystemUserExts.Hometown;
                        aSystemUserExts.Address = aSystemUsersEN.aSystemUserExts.Address;
                        aSystemUserExts.InsuranceNumber = aSystemUsersEN.aSystemUserExts.InsuranceNumber;
                        aSystemUserExts.YearJob = aSystemUsersEN.aSystemUserExts.YearJob;
                        aSystemUserExts.YearDepartment = aSystemUsersEN.aSystemUserExts.YearDepartment;
                        aSystemUserExts.YearPayroll = aSystemUsersEN.aSystemUserExts.YearPayroll;
                        aSystemUserExts.YearUnemploymentInsurance = aSystemUsersEN.aSystemUserExts.YearUnemploymentInsurance;
                        aSystemUserExts.DifferenceContact = aSystemUsersEN.aSystemUserExts.DifferenceContact;
                        aSystemUserExts.Type = aSystemUsersEN.aSystemUserExts.Type;
                        aSystemUserExts.Status = aSystemUsersEN.aSystemUserExts.Status;
                        aSystemUserExts.Disable = aSystemUsersEN.aSystemUserExts.Disable;
                        aSystemUserExts.IDSystemUser = aSystemUsers.ID;
                        aSystemUserExts.Recruitment = aSystemUsersEN.aSystemUserExts.Recruitment;
                        aSystemUserExts.PermanentResidence = aSystemUsersEN.aSystemUserExts.PermanentResidence;
                        aSystemUserExts.CommunistPartyDate = aSystemUsersEN.aSystemUserExts.CommunistPartyDate;
                        aSystemUserExts.YouthUnionDate = aSystemUsersEN.aSystemUserExts.YouthUnionDate;
                        aSystemUserExts.EnlistmentDate = aSystemUsersEN.aSystemUserExts.EnlistmentDate;
                        aSystemUserExts.DemobilizedDate = aSystemUsersEN.aSystemUserExts.DemobilizedDate;
                        aSystemUserExts.MartyrsFamily = aSystemUsersEN.aSystemUserExts.MartyrsFamily;
                        aSystemUserExts.WoundedFamily = aSystemUsersEN.aSystemUserExts.WoundedFamily;
                        aSystemUserExts.LaborFamily = aSystemUsersEN.aSystemUserExts.LaborFamily;
                        aSystemUserExts.HightestAppellation = aSystemUsersEN.aSystemUserExts.HightestAppellation;
                        status = aSystemUserExtsBO.Insert(aSystemUserExts);
                    }

                    FamilyMembersBO aFamilyMembersBO = new FamilyMembersBO();
                    foreach (FamilyMembers familyMembers in aSystemUsersEN.aListFamilyMembersExtEN)
                    {
                        FamilyMembers aFamilyMembers = aFamilyMembersBO.Select_ByID(familyMembers.ID);
                        if (aFamilyMembers == null)
                        {
                            aFamilyMembers = new FamilyMembers();
                            aFamilyMembers.Name = familyMembers.Name;
                            aFamilyMembers.Birthday = familyMembers.Birthday;
                            aFamilyMembers.RelationType = familyMembers.RelationType;
                            aFamilyMembers.Info = familyMembers.Info;
                            aFamilyMembers.IDSystemUser = aSystemUsers.ID;

                            int a = aFamilyMembersBO.Insert(aFamilyMembers);
                            if (a <= 0)
                            {
                                throw new Exception("Lỗi khi thêm dữ liệu thành viên gia đình");
                            }
                        }
                        else
                        {
                            aFamilyMembers.Name = familyMembers.Name;
                            aFamilyMembers.Birthday = familyMembers.Birthday;
                            aFamilyMembers.RelationType = familyMembers.RelationType;
                            aFamilyMembers.Info = familyMembers.Info;
                            aFamilyMembers.IDSystemUser = familyMembers.IDSystemUser;
                            aFamilyMembersBO.Update(aFamilyMembers);
                        }
                    }
                    SystemUsers_CertificatesBO aSystemUsers_CertificatesBO = new SystemUsers_CertificatesBO();
                    foreach (SystemUsers_Certificates systemUsers_Certificates in aSystemUsersEN.aListSystemUsers_CertificatesEN)
                    {
                        SystemUsers_Certificates aSystemUsers_Certificates = aSystemUsers_CertificatesBO.Select_ByID(systemUsers_Certificates.ID);
                        if (aSystemUsers_Certificates == null)
                        {
                            aSystemUsers_Certificates = new SystemUsers_Certificates();
                            aSystemUsers_Certificates.Level = systemUsers_Certificates.Level;
                            aSystemUsers_Certificates.CreatedDate = systemUsers_Certificates.CreatedDate;
                            aSystemUsers_Certificates.ExpirationDate = systemUsers_Certificates.ExpirationDate;
                            aSystemUsers_Certificates.Organization = systemUsers_Certificates.Organization;
                            aSystemUsers_Certificates.TrainingType = systemUsers_Certificates.TrainingType;
                            aSystemUsers_Certificates.IDCertificate = systemUsers_Certificates.IDCertificate;
                            aSystemUsers_Certificates.IDSystemUser = aSystemUsers.ID;
                            aSystemUsers_CertificatesBO.Insert(aSystemUsers_Certificates);
                        }
                        else
                        {
                            aSystemUsers_Certificates.Level = systemUsers_Certificates.Level;
                            aSystemUsers_Certificates.CreatedDate = systemUsers_Certificates.CreatedDate;
                            aSystemUsers_Certificates.ExpirationDate = systemUsers_Certificates.ExpirationDate;
                            aSystemUsers_Certificates.Organization = systemUsers_Certificates.Organization;
                            aSystemUsers_Certificates.TrainingType = systemUsers_Certificates.TrainingType;
                            aSystemUsers_Certificates.IDCertificate = systemUsers_Certificates.IDCertificate;
                            aSystemUsers_Certificates.IDSystemUser = systemUsers_Certificates.IDSystemUser;
                            aSystemUsers_CertificatesBO.Update(aSystemUsers_Certificates);
                        }
                    }

                    AuditHistoriesBO aAuditHistoriesBO = new AuditHistoriesBO();

                    foreach (AuditHistories auditHistories in aSystemUsersEN.aListAuditHistories)
                    {
                        AuditHistories aAuditHistories = aAuditHistoriesBO.Select_ByID(auditHistories.ID);
                        if (aAuditHistories == null)
                        {
                            aAuditHistories = new AuditHistories();
                            aAuditHistories.From = auditHistories.From;
                            aAuditHistories.To = auditHistories.To;
                            aAuditHistories.Note = auditHistories.Note;
                            aAuditHistories.Type = auditHistories.Type;
                            aAuditHistories.IDSystemUser = aSystemUsers.ID;
                            aAuditHistoriesBO.Insert(aAuditHistories);
                        }
                        else
                        {
                            aAuditHistories.From = auditHistories.From;
                            aAuditHistories.To = auditHistories.To;
                            aAuditHistories.Note = auditHistories.Note;
                            aAuditHistories.Type = auditHistories.Type;
                            aAuditHistories.IDSystemUser = auditHistories.IDSystemUser;
                            aAuditHistoriesBO.Update(aAuditHistories);
                        }

                    }

                    RewardAndPunishmentsBO aRewardAndPunishmentsBO = new RewardAndPunishmentsBO();

                    foreach (RewardAndPunishments rewardAndPunishments in aSystemUsersEN.aListRewardAndPunishments)
                    {
                        RewardAndPunishments aRewardAndPunishments = aRewardAndPunishmentsBO.Select_ByID(rewardAndPunishments.ID);
                        if (aRewardAndPunishments == null)
                        {
                            aRewardAndPunishments = new RewardAndPunishments();
                            aRewardAndPunishments.Type = rewardAndPunishments.Type;
                            aRewardAndPunishments.Subject = rewardAndPunishments.Subject;
                            aRewardAndPunishments.Description = rewardAndPunishments.Description;
                            aRewardAndPunishments.CreatedDate = rewardAndPunishments.CreatedDate;
                            aRewardAndPunishments.DecisionDate = rewardAndPunishments.DecisionDate;
                            aRewardAndPunishments.NumberDecision = rewardAndPunishments.NumberDecision;
                            aRewardAndPunishments.DecisionLevel = rewardAndPunishments.DecisionLevel;
                            aRewardAndPunishments.Status = rewardAndPunishments.Status;
                            aRewardAndPunishments.Disable = rewardAndPunishments.Disable;
                            aRewardAndPunishments.IDSystemUser = aSystemUsers.ID;
                            aRewardAndPunishmentsBO.Insert(aRewardAndPunishments);
                        }
                        else
                        {
                            aRewardAndPunishments.Type = rewardAndPunishments.Type;
                            aRewardAndPunishments.Subject = rewardAndPunishments.Subject;
                            aRewardAndPunishments.Description = rewardAndPunishments.Description;
                            aRewardAndPunishments.CreatedDate = rewardAndPunishments.CreatedDate;
                            aRewardAndPunishments.DecisionDate = rewardAndPunishments.DecisionDate;
                            aRewardAndPunishments.NumberDecision = rewardAndPunishments.NumberDecision;
                            aRewardAndPunishments.DecisionLevel = rewardAndPunishments.DecisionLevel;
                            aRewardAndPunishments.Status = rewardAndPunishments.Status;
                            aRewardAndPunishments.Disable = rewardAndPunishments.Disable;
                            aRewardAndPunishments.IDSystemUser = rewardAndPunishments.IDSystemUser;
                            aRewardAndPunishmentsBO.Update(aRewardAndPunishments);
                        }
                    }

                    DocumentSystemUsersBO aDocumentSystemUsersBO = new DocumentSystemUsersBO();
                    foreach (DocumentSystemUsers documentSystemUsers in aSystemUsersEN.aListDocumentSystemUsers)
                    {
                        DocumentSystemUsers aDocumentSystemUsers = aDocumentSystemUsersBO.Select_ByID(documentSystemUsers.ID);
                        if (aDocumentSystemUsers == null)
                        {
                            aDocumentSystemUsers = new DocumentSystemUsers();
                            aDocumentSystemUsers.Name = documentSystemUsers.Name;
                            aDocumentSystemUsers.FileData = documentSystemUsers.FileData;
                            aDocumentSystemUsers.Note = documentSystemUsers.Note;
                            aDocumentSystemUsers.Type = documentSystemUsers.Type;
                            aDocumentSystemUsers.Status = documentSystemUsers.Status;
                            aDocumentSystemUsers.Disable = documentSystemUsers.Disable;
                            aDocumentSystemUsers.IDSystemUser = aSystemUsers.ID;
                            aDocumentSystemUsersBO.Insert(aDocumentSystemUsers);
                        }
                        else
                        {
                            aDocumentSystemUsers.Name = documentSystemUsers.Name;
                            aDocumentSystemUsers.FileData = documentSystemUsers.FileData;
                            aDocumentSystemUsers.Note = documentSystemUsers.Note;
                            aDocumentSystemUsers.Type = documentSystemUsers.Type;
                            aDocumentSystemUsers.Status = documentSystemUsers.Status;
                            aDocumentSystemUsers.Disable = documentSystemUsers.Disable;
                            aDocumentSystemUsers.IDSystemUser = documentSystemUsers.IDSystemUser;
                            aDocumentSystemUsersBO.Update(aDocumentSystemUsers);
                        }
                    }

                }

            }
            catch (Exception ex)
            {

                aSystemUsersBO.Update(aSystemUsers_Old);
                aSystemUserExtsBO.Update(aSystemUserExts_Old);

                throw new Exception(string.Format("ReceptionTaskBO.UpdateSystemUserInformation :" + ex.Message.ToString()));
            }
        }
        private void frmUpd_AlternateMissions_Load(object sender, EventArgs e)
        {
            try
            {
                AlternateMissionsBO aAlternateMissionsBO = new AlternateMissionsBO();
                AlternateMissions aAlternateMissions = aAlternateMissionsBO.Select_ByID(ID_Old);
                if(aAlternateMissions !=null)
                {
                    SystemUsersBO aSystemUsersBO = new SystemUsersBO();
                    lueIDSystemUser.Properties.DataSource = aSystemUsersBO.Select_All();
                    lueIDSystemUser.Properties.DisplayMember = "Name";
                    lueIDSystemUser.Properties.ValueMember = "ID";

                    lueIDSystemUser.EditValue = aAlternateMissions.IDSystemUser;

                    lueCountry.Properties.DataSource = CORE.CONSTANTS.ListCountries;
                    lueCountry.Properties.DisplayMember = "Name";
                    lueCountry.Properties.ValueMember = "Code";

                    lueCountry.EditValue = CORE.CONSTANTS.SelectedCountry(aAlternateMissions.Country).Code;

                    if (aAlternateMissions.CreatedDate != null)
                    {
                        dtpCreatedDate.DateTime = aAlternateMissions.CreatedDate.GetValueOrDefault();
                    }
                    if (aAlternateMissions.DecisionDate != null)
                    {
                        dtpDecisionDate.DateTime = aAlternateMissions.DecisionDate.GetValueOrDefault();
                    }
                    if (aAlternateMissions.FromDate != null)
                    {
                        dtpFromDate.DateTime = aAlternateMissions.FromDate.GetValueOrDefault();
                    }
                    if (aAlternateMissions.ToDate != null)
                    {
                        dtpToDate.DateTime = aAlternateMissions.ToDate.GetValueOrDefault();
                    }

                    txtDecisionLevel.Text = aAlternateMissions.DecisionLevel;
                    txtDescription.Text = aAlternateMissions.Description;
                    txtNumberDecision.Text = aAlternateMissions.NumberDecision;
                    txtSubject.Text = aAlternateMissions.Subject;

                    cbbDisable.Text = Convert.ToString(aAlternateMissions.Disable);
                    cbbStatus.Text = Convert.ToString(aAlternateMissions.Status);
                    cbbType.Text = Convert.ToString(aAlternateMissions.Type);
                    lblID.Text = Convert.ToString(this.ID_Old);
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmUpd_AlternateMissions_Load\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }
        }
        private void frmIns_AlternateMissions_Load(object sender, EventArgs e)
        {
            try
            {
                SystemUsersBO aSystemUsersBO = new SystemUsersBO();
                lueIDSystemUser.Properties.DataSource = aSystemUsersBO.Select_All();
                lueIDSystemUser.Properties.DisplayMember = "Name";
                lueIDSystemUser.Properties.ValueMember = "ID";

                lueCountry.Properties.DataSource = CORE.CONSTANTS.ListCountries;
                lueCountry.Properties.DisplayMember = "Name";
                lueCountry.Properties.ValueMember = "Code";
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmIns_AlternateMissions.frmIns_AlternateMissions_Load\n" + ex.ToString(), "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }
        }
        private void btnAddNew_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.CheckDataBeforeInsert() == true)
                {
                    DateTime? NullDatetime = null;

                    //thong tin SystemUsers
                    aSystemUsersEN.UserGroup = cboUserGroup.SelectedIndex + 1;
                    aSystemUsersEN.Email = txtEmail.Text;
                    aSystemUsersEN.Username = txtUsername.Text;
                    aSystemUsersEN.Name = txtName.Text;
                    aSystemUsersEN.Phone = txtMobile.Text;
                    aSystemUsersEN.Password = StringUtility.md5(txtUsername.Text + "12345678");
                    aSystemUsersEN.Birthday = dtpBirthday.EditValue == null ? NullDatetime : dtpBirthday.DateTime;
                    aSystemUsersEN.Identifier1 = txtIdentifier1.Text;
                    aSystemUsersEN.Identifier2 = txtIdentifier2.Text;
                    aSystemUsersEN.Identifier3 = txtIdentifier3.Text;
                    aSystemUsersEN.Image = (Byte[])new ImageConverter().ConvertTo(pbxImage.Image, typeof(Byte[]));
                    aSystemUsersEN.Gender = Convert.ToInt32(lueGender.EditValue);
                    aSystemUsersEN.IDRefAnotherSystem = 1;// de tam
                    aSystemUsersEN.IDRefMailSystem = 1; //de tam
                    aSystemUsersEN.Type = cboType.SelectedIndex + 1;
                    aSystemUsersEN.Status = cboStatus.SelectedIndex + 1;
                    aSystemUsersEN.Disable = Convert.ToBoolean(cboDisable.Text);
                    aSystemUsersEN.Identifier1CreatedDate = dtpIdentifier1.EditValue == null ? NullDatetime : dtpIdentifier1.DateTime;
                    aSystemUsersEN.Identifier2CreatedDate = dtpIdentifier2.EditValue == null ? NullDatetime : dtpIdentifier2.DateTime;
                    aSystemUsersEN.Identifier3CreatedDate = dtpIdentifier3.EditValue == null ? NullDatetime : dtpIdentifier3.DateTime;
                    aSystemUsersEN.PlaceOfIssue1 = txtPlaceOfIssue1.Text;
                    aSystemUsersEN.PlaceOfIssue2 = txtPlaceOfIssue2.Text;
                    aSystemUsersEN.PlaceOfIssue3 = txtPlaceOfIssue3.Text;

                    //thong tin SystemUserExts

                    aSystemUsersEN.aSystemUserExts.BirthPlace = txtBirthPlace.Text;
                    aSystemUsersEN.aSystemUserExts.Hometown = txtHometown.Text;
                    aSystemUsersEN.aSystemUserExts.Address = txtAddress.Text;
                    aSystemUsersEN.aSystemUserExts.InsuranceNumber = txtInsuranceNumber.Text;
                    aSystemUsersEN.aSystemUserExts.YearJob = dtpYearJob.EditValue == null ? NullDatetime : dtpYearJob.DateTime;
                    aSystemUsersEN.aSystemUserExts.YearPayroll = dtpYearPayroll.EditValue == null ? NullDatetime : dtpYearPayroll.DateTime;
                    aSystemUsersEN.aSystemUserExts.YearUnemploymentInsurance = dtpYearUnemploymentInsuarance.EditValue == null ? NullDatetime : dtpYearUnemploymentInsuarance.DateTime;
                    aSystemUsersEN.aSystemUserExts.DifferenceContact = "";
                    aSystemUsersEN.aSystemUserExts.Type = cboSystemUserExtsType.SelectedIndex + 1;
                    aSystemUsersEN.aSystemUserExts.Status = cboSystemUserExtsStatus.SelectedIndex + 1;
                    aSystemUsersEN.aSystemUserExts.Disable = Convert.ToBoolean(cboSystemUserExtsDisable.Text);
                    aSystemUsersEN.aSystemUserExts.Recruitment = txtRecruitment.Text;
                    aSystemUsersEN.aSystemUserExts.PermanentResidence = txaPermanentResidence.Text;
                    aSystemUsersEN.aSystemUserExts.CommunistPartyDate = dtpCommunistPartyDate.EditValue == null ? NullDatetime : dtpCommunistPartyDate.DateTime;
                    aSystemUsersEN.aSystemUserExts.YouthUnionDate = dtpYouthUnionDate.EditValue == null ? NullDatetime : dtpYouthUnionDate.DateTime;
                    aSystemUsersEN.aSystemUserExts.EnlistmentDate = dtpEnlistmentDate.EditValue == null ? NullDatetime : dtpEnlistmentDate.DateTime;
                    aSystemUsersEN.aSystemUserExts.DemobilizedDate = dtpDemobilizedDate.EditValue == null ? NullDatetime : dtpDemobilizedDate.DateTime;
                    aSystemUsersEN.aSystemUserExts.YearDepartment = dtpYearDepartment.EditValue == null ? NullDatetime : dtpYearDepartment.DateTime;

                    bool martyrsFamily = chkMartysFamily.Checked == true ? true : false;
                    bool woundedFamily = chkWoundedFamily.Checked == true ? true : false;
                    bool laborFamily = chkLaborFamily.Checked == true ? true : false;

                    aSystemUsersEN.aSystemUserExts.MartyrsFamily = martyrsFamily;
                    aSystemUsersEN.aSystemUserExts.WoundedFamily = woundedFamily;
                    aSystemUsersEN.aSystemUserExts.LaborFamily = laborFamily;
                    aSystemUsersEN.aSystemUserExts.HightestAppellation = txtHightestAppellation.Text;

                    ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO();
                    aReceptionTaskBO.AddSystemUserInformation(aSystemUsersEN);

                    if (ckbIsEmailSync.Checked == true)
                    {
                        SystemUsersBO aSystemUsersBO = new SystemUsersBO();
                        int ret = aSystemUsersBO.InsertEmailToDatabase(txtUsername.Text, txtPassword.Text, Properties.Resources.Domain1);
                        if (ret <= 0)
                        {
                            MessageBox.Show("Chưa tạo đồng bộ được email");
                        }

                    }
                    MessageBox.Show("Thêm mới thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmTsk_SystemUser_Infromation.btnAddNew_Click\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #11
0
        public void Sel(HttpContext context)
        {
            String jSonString = "";
            SystemUsersBO aSystemUsersBO = new SystemUsersBO();
            List<SystemUsers> obj = aSystemUsersBO.Sel();

            if (obj != null)
            {
                _converter.DateTimeFormat = "dd/MM/yyyy";
                jSonString = JsonConvert.SerializeObject(obj, _converter);
            }
            jSonString = "{" + jSonString + "}";
            context.Response.Write(jSonString);
        }
        //hiennv
        public void InitData(PaymentHallsEN aPaymentHallsEN, int IDBookingH)
        {
            try
            {
                HallsBO aHallsBO = new HallsBO();
                BookingHallsBO aBookingHallsBO = new BookingHallsBO();
                FoodsBO aFoodsBO = new FoodsBO();
                ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO();
                CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO();
                CustomersBO aCustomersBO = new CustomersBO();
                BookingHsBO aBookingHsBO = new BookingHsBO();
                CompaniesBO aCompaniesBO = new CompaniesBO();
                SystemUsersBO aSystemUsersBO = new SystemUsersBO();

                BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH);
                if (aBookingHs != null)
                {
                    aPaymentHallsEN.IDBookingH = aBookingHs.ID;
                    aPaymentHallsEN.IDCustomerGroup = aBookingHs.IDCustomerGroup;
                    CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingHs.IDCustomerGroup);
                    if (aCustomerGroups != null)
                    {
                        aPaymentHallsEN.NameCustomerGroup = aCustomerGroups.Name;
                        aPaymentHallsEN.IDCompany = aCustomerGroups.IDCompany;
                        Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany);
                        if (aCompanies != null)
                        {
                            aPaymentHallsEN.NameCompany = aCompanies.Name;
                            aPaymentHallsEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode;
                        }
                    }
                    aPaymentHallsEN.IDCustomer = aBookingHs.IDCustomer;
                    Customers aCustomers = aCustomersBO.Select_ByID(aBookingHs.IDCustomer);
                    if (aCustomers != null)
                    {
                        aPaymentHallsEN.NameCustomer = aCustomers.Name;

                    }
                    aPaymentHallsEN.IDSystemUser = aBookingHs.IDSystemUser;
                    SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingHs.IDSystemUser);
                    if (aSystemUsers != null)
                    {
                        aPaymentHallsEN.NameSystemUser = aSystemUsers.Name;
                    }
                    aPaymentHallsEN.CreatedDate_BookingH = aBookingHs.CreatedDate;
                    aPaymentHallsEN.CustomerType = aBookingHs.CustomerType;
                    aPaymentHallsEN.BookingType = aBookingHs.BookingType;
                    aPaymentHallsEN.PayMenthod = aBookingHs.PayMenthod;
                    aPaymentHallsEN.StatusPay = aBookingHs.StatusPay;
                    aPaymentHallsEN.Status_BookingH = aBookingHs.Status;
                    aPaymentHallsEN.ExchangeRate = aBookingHs.ExchangeRate;
                    aPaymentHallsEN.Level = aBookingHs.Level;
                    aPaymentHallsEN.BookingMoney = aBookingHs.BookingMoney;
                }

                List<BookingHalls> aListBookingHalls = new List<BookingHalls>();
                aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(IDBookingH);
                InfoDetailPaymentHallsEN aInfoDetailPaymentHallsEN;
                for (int i = 0; i < aListBookingHalls.Count; i++)
                {
                    aInfoDetailPaymentHallsEN = new InfoDetailPaymentHallsEN();
                    Halls aHalls = aHallsBO.Select_ByCodeHall(aListBookingHalls[i].CodeHall, 1);
                    if (aHalls != null)
                    {
                        aInfoDetailPaymentHallsEN.Sku = aHalls.Sku;
                    }
                    else
                    {
                        aInfoDetailPaymentHallsEN.Sku = string.Empty;
                    }
                    aInfoDetailPaymentHallsEN.aBookingHalls = aListBookingHalls[i];
                    aInfoDetailPaymentHallsEN.aMenusEN = aReceptionTaskBO.GetDetailMenu_ByIDBookingHall(aListBookingHalls[i].ID);
                    aInfoDetailPaymentHallsEN.aListServicesHallsEN = aReceptionTaskBO.GetListServicesHallsEN_ByIDBookingHall(aListBookingHalls[i].ID);

                    aPaymentHallsEN.aListInfoDetailPaymentHallsEN.Insert(i, aInfoDetailPaymentHallsEN);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmTsk_PaymentHall.InitData\n" + ex.ToString());
            }
        }
        private void frmIns_Contracts_Load(object sender, EventArgs e)
        {
            try
            {
                SystemUsersBO aSystemUsersBO = new SystemUsersBO();
                List<SystemUsers> aListSystemUser = aSystemUsersBO.Select_All();
                dgvSysUsers.DataSource = aListSystemUser;
                dgvSysUsers.RefreshDataSource();

                lueContractType.Properties.DataSource = CORE.CONSTANTS.ListContractTypes;//Load contractType
                lueContractType.Properties.DisplayMember = "Name";
                lueContractType.Properties.ValueMember = "ID";

                lueType.Properties.DataSource = CORE.CONSTANTS.ListSalaryTypes;//Load SalaryType
                lueType.Properties.DisplayMember = "Name";
                lueType.Properties.ValueMember = "ID";

                lueStatutoryRepresentGender.Properties.DataSource = CORE.CONSTANTS.ListGenders;//Load Gender
                lueStatutoryRepresentGender.Properties.DisplayMember = "Name";
                lueStatutoryRepresentGender.Properties.ValueMember = "ID";

                lueSystemUser.Properties.DataSource = aListSystemUser;
                lueSystemUser.Properties.DisplayMember = "Name";
                lueSystemUser.Properties.ValueMember = "ID";

                if (afrmMain != null)
                {
                    lueSystemUser.EditValue = IDSystemUser;
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show("frmIns_Contracts.frmIns_Contracts_Load\n" + ex.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #14
0
        public void Sel_ByID(HttpContext context)
        {
            String jSonString = "";
            int IDSystemUsers = Convert.ToInt32(context.Request.QueryString["ID"]);

            SystemUsersBO aSystemUsersBO = new SystemUsersBO();
            SystemUsers obj = aSystemUsersBO.Sel_ByID(IDSystemUsers);

            if (obj != null)
            {
                _converter.DateTimeFormat = "dd/MM/yyyy";
                jSonString = JsonConvert.SerializeObject(obj, _converter);
            }
            jSonString = "{\"data\":" + jSonString + "}";
            context.Response.Write(jSonString);
        }
Example #15
0
        public void SendMail(HttpContext context)
        {
            String jSonString = "";
            try
            {
                string HoTen = !String.IsNullOrEmpty(context.Request.Form["txtName"]) ? Convert.ToString(context.Request.Form["txtName"]) : "[Noname]";
                string FromEmail = !String.IsNullOrEmpty(context.Request.Form["txtEmail"]) ? Convert.ToString(context.Request.Form["txtEmail"]) : "*****@*****.**";
                //string Phone = !String.IsNullOrEmpty(context.Request.Form["txtPhone"]) ? Convert.ToString(context.Request.Form["txtPhone"]) : "[Unknow phone]";
                string Content = !String.IsNullOrEmpty(context.Request.Form["txtContent"]) ? Convert.ToString(context.Request.Form["txtContent"]) : "[Unknow content]";
                string Subject = !String.IsNullOrEmpty(context.Request.Form["txtSubject"]) ? Convert.ToString(context.Request.Form["txtSubject"]) : "[Unknow subject]"; ;
                string Body = "From: " + HoTen + "\n";
                Body += "Email: " + FromEmail + "\n";
                //Body += "Phone: " + Phone + "\n";
                Body += "Subject: " + Subject + "\n";
                Body += "Question: \n" + Content + "\n";

                SystemUsersBO aSystemUsersBO = new SystemUsersBO();
                //bool ret = aSystemUsersBO.SendMail(FromEmail, Subject, Body);
                bool ret = false;
                if (ret == true)
                {
                    jSonString = "{\"status\": \"success\"}";
                }
                else
                {
                    jSonString = "{\"status\": \"error\" ,\"message\": \"Có lỗi phát sinh khi gửi mail\"}";
                }
            }
            catch (Exception e)
            {
                jSonString = "{\"status\":\"error|" + e.Message.ToString() + "\"}";
            }
            finally
            {

                context.Response.Write(jSonString);
            }
        }
        private void btnPrint_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            SystemUsersBO aSysUserBO = new SystemUsersBO();
            UserInfomationEN aUserInfomationEN = new UserInfomationEN();
             int IDSystemUser = int.Parse(grvSystemUser.GetFocusedRowCellValue("ID").ToString());
            // Thong tin cua SystemUser
            SystemUsers aSystemUsers = aSysUserBO.Select_ByID(IDSystemUser);
             aUserInfomationEN.ID = IDSystemUser;
             aUserInfomationEN.Name = aSystemUsers.Name;
             aUserInfomationEN.Gender = aSystemUsers.Gender;
             aUserInfomationEN.Birthday = aSystemUsers.Birthday;
             aUserInfomationEN.Identifier1 = aSystemUsers.Identifier1;
             aUserInfomationEN.Identifier1CreatedDate = aSystemUsers.Identifier1CreatedDate;
             aUserInfomationEN.PlaceOfIssue1 = aSystemUsers.PlaceOfIssue1;
             aUserInfomationEN.Image = aSystemUsers.Image;
            // Thong tin cua SystemUserExt
             SystemUserExts aSystemUserExts = aSystemUserExtsBO.Select_ByIDSystemUser(IDSystemUser);
             aUserInfomationEN.aSystemUserExts = aSystemUserExts;

             // Thong tin bang chinh quy
             List<CertificateExtInfoEN> aListCertificateExt_Regular = new List<CertificateExtInfoEN>();
             List<vw__CertificatesInfo__SystemUsers_Certificates> aTemp_Regular = aCertificatesBO.GetRegularCertificate(IDSystemUser);
             CertificateExtInfoEN aCertificateExtInfoEN_Regular;
             for (int i = 0; i < aTemp_Regular.Count; i++)
             {
                 aCertificateExtInfoEN_Regular = new CertificateExtInfoEN();
                 aCertificateExtInfoEN_Regular.Certificates_Organization = aTemp_Regular[i].Certificates_Organization;
                 aCertificateExtInfoEN_Regular.Certificates_Certificates = aTemp_Regular[i].Certificates_Certificates;
                 if (aTemp_Regular[i].SystemUsers_Certificates_Level == "1")
                 {
                     aCertificateExtInfoEN_Regular.SystemUsers_Certificates_Level = "Giỏi";
                 }
                 else if (aTemp_Regular[i].SystemUsers_Certificates_Level == "2")
                 {
                     aCertificateExtInfoEN_Regular.SystemUsers_Certificates_Level = "Khá";
                 }
                 else
                 {
                     aCertificateExtInfoEN_Regular.SystemUsers_Certificates_Level = "Trung bình";
                 }
                 aCertificateExtInfoEN_Regular.SystemUsers_Certificates_CreatedDate = aTemp_Regular[i].SystemUsers_Certificates_CreatedDate;
                 aCertificateExtInfoEN_Regular.SystemUsers_Certificates_ExpirationDate = aTemp_Regular[i].SystemUsers_Certificates_ExpirationDate;

                 if (aTemp_Regular[i].SystemUsers_Certificates_TrainingType == "1")
                 {
                     aCertificateExtInfoEN_Regular.TrainingTypeDisplay = "Chính Quy";
                 }
                 else if (aTemp_Regular[i].SystemUsers_Certificates_TrainingType == "2")
                 {
                     aCertificateExtInfoEN_Regular.TrainingTypeDisplay = "Tại chức";
                 }
                 else if (aTemp_Regular[i].SystemUsers_Certificates_TrainingType == "3")
                 {
                     aCertificateExtInfoEN_Regular.TrainingTypeDisplay = "Văn bằng 2";
                 }
                 else if (aTemp_Regular[i].SystemUsers_Certificates_TrainingType == "4")
                 {
                     aCertificateExtInfoEN_Regular.TrainingTypeDisplay = "Liên thông";
                 }
                 else if (aTemp_Regular[i].SystemUsers_Certificates_TrainingType == "5")
                 {
                     aCertificateExtInfoEN_Regular.TrainingTypeDisplay = "Chứng chỉ";
                 }
                 else
                 {
                     aCertificateExtInfoEN_Regular.TrainingTypeDisplay = "Từ xa";
                 }

                 aListCertificateExt_Regular.Add(aCertificateExtInfoEN_Regular);
             }
             aUserInfomationEN.aListCertificateExt_Regular = aListCertificateExt_Regular;
             // Thong tin chung chi phu
             List<CertificateExtInfoEN> aListCertificateExt_Sub = new List<CertificateExtInfoEN>();
             List<vw__CertificatesInfo__SystemUsers_Certificates> aTemp_Sub = aCertificatesBO.GetSubCertificate(IDSystemUser);
             CertificateExtInfoEN aCertificateExtInfoEN_Sub;
             for (int i = 0; i < aTemp_Sub.Count; i++)
             {
                 aCertificateExtInfoEN_Sub = new CertificateExtInfoEN();
                 aCertificateExtInfoEN_Sub.Certificates_Organization = aTemp_Sub[i].Certificates_Organization;
                 aCertificateExtInfoEN_Sub.Certificates_Certificates = aTemp_Sub[i].Certificates_Certificates;
                 if (aTemp_Sub[i].SystemUsers_Certificates_Level == "1")
                 {
                     aCertificateExtInfoEN_Sub.SystemUsers_Certificates_Level = "Giỏi";
                 }
                 else if (aTemp_Sub[i].SystemUsers_Certificates_Level == "2")
                 {
                     aCertificateExtInfoEN_Sub.SystemUsers_Certificates_Level = "Khá";
                 }
                 else
                 {
                     aCertificateExtInfoEN_Sub.SystemUsers_Certificates_Level = "Trung bình";
                 }
                 aCertificateExtInfoEN_Sub.SystemUsers_Certificates_CreatedDate = aTemp_Sub[i].SystemUsers_Certificates_CreatedDate;
                 aCertificateExtInfoEN_Sub.SystemUsers_Certificates_ExpirationDate = aTemp_Sub[i].SystemUsers_Certificates_ExpirationDate;
                 aCertificateExtInfoEN_Sub.SystemUsers_Certificates_TrainingType = aTemp_Sub[i].SystemUsers_Certificates_TrainingType;
                 if (aTemp_Sub[i].SystemUsers_Certificates_TrainingType == "1")
                 {
                     aCertificateExtInfoEN_Sub.TrainingTypeDisplay = "Chính Quy";
                 }
                 else if (aTemp_Sub[i].SystemUsers_Certificates_TrainingType == "2")
                 {
                     aCertificateExtInfoEN_Sub.TrainingTypeDisplay = "Tại chức";
                 }
                 else if (aTemp_Sub[i].SystemUsers_Certificates_TrainingType == "3")
                 {
                     aCertificateExtInfoEN_Sub.TrainingTypeDisplay = "Văn bằng 2";
                 }
                 else if (aTemp_Sub[i].SystemUsers_Certificates_TrainingType == "4")
                 {
                     aCertificateExtInfoEN_Sub.TrainingTypeDisplay = "Liên thông";
                 }
                 else if (aTemp_Sub[i].SystemUsers_Certificates_TrainingType == "5")
                 {
                     aCertificateExtInfoEN_Sub.TrainingTypeDisplay = "Chứng chỉ";
                 }
                 else
                 {
                     aCertificateExtInfoEN_Sub.TrainingTypeDisplay = "Từ xa";
                 }
                 aListCertificateExt_Sub.Add(aCertificateExtInfoEN_Sub);
             }
             aUserInfomationEN.aListCertificateExt_Sub = aListCertificateExt_Sub;
             // Thong tin chung chi Ly luan chinh tri + Quan ly nha nuoc
             List<CertificateExtInfoEN> aListCertificateExt_PoliticGorvenmentManager = new List<CertificateExtInfoEN>();
             List<vw__CertificatesInfo__SystemUsers_Certificates> aTemp_PoliticGorvenmentManager = aCertificatesBO.GetPoliticalGorvenmentManagerCertificate(IDSystemUser);
             CertificateExtInfoEN aCertificateExtInfoEN_PoliticGorvenmentManager;
             for (int i = 0; i < aTemp_PoliticGorvenmentManager.Count; i++)
             {
                 aCertificateExtInfoEN_PoliticGorvenmentManager = new CertificateExtInfoEN();
                 aCertificateExtInfoEN_PoliticGorvenmentManager.Certificates_Organization = aTemp_PoliticGorvenmentManager[i].Certificates_Organization;
                 aCertificateExtInfoEN_PoliticGorvenmentManager.Certificates_Certificates = aTemp_PoliticGorvenmentManager[i].Certificates_Certificates;
                 if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_Level == "1")
                 {
                     aCertificateExtInfoEN_PoliticGorvenmentManager.SystemUsers_Certificates_Level = "Giỏi";
                 }
                 else if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_Level == "2")
                 {
                     aCertificateExtInfoEN_PoliticGorvenmentManager.SystemUsers_Certificates_Level = "Khá";
                 }
                 else
                 {
                     aCertificateExtInfoEN_PoliticGorvenmentManager.SystemUsers_Certificates_Level = "Trung bình";
                 }
                 aCertificateExtInfoEN_PoliticGorvenmentManager.SystemUsers_Certificates_CreatedDate = aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_CreatedDate;
                 aCertificateExtInfoEN_PoliticGorvenmentManager.SystemUsers_Certificates_ExpirationDate = aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_ExpirationDate;
                 aCertificateExtInfoEN_PoliticGorvenmentManager.SystemUsers_Certificates_TrainingType = aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_TrainingType;
                 if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_TrainingType == "1")
                 {
                     aCertificateExtInfoEN_PoliticGorvenmentManager.TrainingTypeDisplay = "Chính Quy";
                 }
                 else if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_TrainingType == "2")
                 {
                     aCertificateExtInfoEN_PoliticGorvenmentManager.TrainingTypeDisplay = "Tại chức";
                 }
                 else if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_TrainingType == "3")
                 {
                     aCertificateExtInfoEN_PoliticGorvenmentManager.TrainingTypeDisplay = "Văn bằng 2";
                 }
                 else if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_TrainingType == "4")
                 {
                     aCertificateExtInfoEN_PoliticGorvenmentManager.TrainingTypeDisplay = "Liên thông";
                 }
                 else if (aTemp_PoliticGorvenmentManager[i].SystemUsers_Certificates_TrainingType == "5")
                 {
                     aCertificateExtInfoEN_PoliticGorvenmentManager.TrainingTypeDisplay = "Chứng chỉ";
                 }
                 else
                 {
                     aCertificateExtInfoEN_PoliticGorvenmentManager.TrainingTypeDisplay = "Từ xa";
                 }
                 aListCertificateExt_PoliticGorvenmentManager.Add(aCertificateExtInfoEN_PoliticGorvenmentManager);
             }
             aUserInfomationEN.aListCertificateExt_PoliticGorvenmentManager = aListCertificateExt_PoliticGorvenmentManager;
            // Thong tin gia dinh
             List<FamilyMembersExtEN> aListFamilyMembersExtEN = new List<FamilyMembersExtEN>();
             List<FamilyMembers> aTemp_FamilyMembers = aFamilyMembersBO.Select_ByIDSystemUser(IDSystemUser);
             FamilyMembersExtEN aFamilyMembersExtEN;
             for (int i = 0; i < aTemp_FamilyMembers.Count; i++)
             {
                 aFamilyMembersExtEN = new FamilyMembersExtEN();
                 aFamilyMembersExtEN.Name = aTemp_FamilyMembers[i].Name;
                 aFamilyMembersExtEN.Birthday = aTemp_FamilyMembers[i].Birthday;
                 aFamilyMembersExtEN.Info = aTemp_FamilyMembers[i].Info;
                 if (aTemp_FamilyMembers[i].RelationType == 1)
                 {
                     aFamilyMembersExtEN.RelationDisplay = "Bố";
                 }
                 else if (aTemp_FamilyMembers[i].RelationType == 2)
                 {
                     aFamilyMembersExtEN.RelationDisplay = "Mẹ";
                 }
                 else if (aTemp_FamilyMembers[i].RelationType == 3)
                 {
                     aFamilyMembersExtEN.RelationDisplay = "Anh/Chị/Em";
                 }
                 else if (aTemp_FamilyMembers[i].RelationType == 4)
                 {
                     aFamilyMembersExtEN.RelationDisplay = "Con cái";
                 }
                 aListFamilyMembersExtEN.Add(aFamilyMembersExtEN);
             }
             aUserInfomationEN.aListFamilyMembers = aListFamilyMembersExtEN;
            // Thong tin qua trinh cong tac
             aUserInfomationEN.aListAuditHistories = aAuditHistoriesBO.Select_ByIDSystemUser(IDSystemUser);
            // Thong tin khen thuong
             aUserInfomationEN.aListReward = aRewardAndPunishmentsBO.Select_ByIDSystemUser_ByType(IDSystemUser,1);
             // Thong tin khen thuong
             aUserInfomationEN.aListPunishments = aRewardAndPunishmentsBO.Select_ByIDSystemUser_ByType(IDSystemUser, 2);
            // Thong tin giay to #
             aUserInfomationEN.aListDocumentSystemUsers = aDocumentSystemUsersBO.Select_ByIDSystemUser(IDSystemUser);
             frmRpt_SystemUserInfo aReport = new frmRpt_SystemUserInfo(aUserInfomationEN);
             ReportPrintTool tool = new ReportPrintTool(aReport);
             tool.ShowPreview();
        }
        private void btnDelete_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            SystemUsersBO aSysUserBO = new SystemUsersBO();
            int ID = int.Parse(grvSystemUser.GetFocusedRowCellValue("ID").ToString());
            string Name = aSysUserBO.Select_ByID(ID).Name;
            if (ID == CORE.CURRENTUSER.SystemUser.ID)
            {
                DialogResult result = MessageBox.Show("Không thể xóa User hiện tại vì User này đang đăng nhập hệ thống", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Question);

            }
            else
            {
                DialogResult result = MessageBox.Show("Bạn có muốn xóa " + Name + " này không?", "Xóa công ty", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    SystemUsers aTemp = aSysUserBO.Select_ByID(ID);
                    aTemp.Disable = true;
                    aSysUserBO.Update(aTemp);
                    MessageBox.Show("Xóa thành công");
                    this.Reload();
                }
            }
        }
Example #18
0
        public void Ins(HttpContext context)
        {
            String jSonString = "";
               try
               {
                SystemUsers aSystemUsers = new SystemUsers();

                aSystemUsers.Username = !String.IsNullOrEmpty(context.Request.Form["txtUsername"]) ? Convert.ToString(context.Request.Form["txtUsername"]) : "";

                aSystemUsers.UserGroup = !String.IsNullOrEmpty(context.Request.Form["txtUserGroup"]) ? Convert.ToInt32(context.Request.Form["txtUserGroup"]) : 0;

                aSystemUsers.Email = !String.IsNullOrEmpty(context.Request.Form["txtEmail"]) ? Convert.ToString(context.Request.Form["txtEmail"]) : "";

                aSystemUsers.Password = !String.IsNullOrEmpty(context.Request.Form["txtPassword"]) ? Library.StringUtility.md5(Convert.ToString(context.Request.Form["txtPassword"])) : Library.StringUtility.md5(aSystemUsers.Username + "12345678");

                aSystemUsers.IDRefMailSystem = !String.IsNullOrEmpty(context.Request.Form["txtIDRefMailSystem"]) ? Convert.ToInt32(context.Request.Form["txtIDRefMailSystem"]) : 0;

                aSystemUsers.IDRefAnotherSystem = !String.IsNullOrEmpty(context.Request.Form["txtIDRefAnotherSystem"]) ? Convert.ToInt32(context.Request.Form["txtIDRefAnotherSystem"]) : 0;

                aSystemUsers.Type = !String.IsNullOrEmpty(context.Request.Form["txtTypeSystemUsers"]) ? Convert.ToInt32(context.Request.Form["txtTypeSystemUsers"]) : 0;

                aSystemUsers.Status = !String.IsNullOrEmpty(context.Request.Form["txtStatusSystemUsers"]) ? Convert.ToInt32(context.Request.Form["txtStatusSystemUsers"]) : 0;
                aSystemUsers.Name = !String.IsNullOrEmpty(context.Request.Form["txtName"]) ? Convert.ToString(context.Request.Form["txtName"]) :"";

                SystemUsersBO aSystemUsersBO = new SystemUsersBO();
                int ret = aSystemUsersBO.Ins(aSystemUsers);

                    if (ret == 0)
                    { jSonString = "{\"status\": \"success\"}"; }
                    if (ret != 0)
                    { jSonString = "{\"status\":\"error|" + ret.ToString() + "\"}"; }
            }
            catch (Exception ex)
            {
                jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message.ToString() + "\"}";
            }
            finally
            {
                context.Response.Write(jSonString);
            }
        }
        // ===============================================================================
        // Khoi tao doi tuong Payment
        private void InitData(int IDBookingR, int IDBookingH)
        {
            CompaniesBO aCompaniesBO = new CompaniesBO();
            CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO();
            SystemUsersBO aSystemUsersBO = new SystemUsersBO();
            BookingHsBO aBookingHsBO = new BookingHsBO();
            BookingRsBO aBookingRsBO = new BookingRsBO();
            BookingRoomsBO aBookingRoomBO = new BookingRoomsBO();
            CustomersBO aCustomersBO = new CustomersBO();
            ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO();
            RoomsBO aRoomsBO = new RoomsBO();
            HallsBO aHallsBO = new HallsBO();
            BookingHallsBO aBookingHallsBO = new BookingHallsBO();
            FoodsBO aFoodsBO = new FoodsBO();
            ExtraCostBO aExtraCostBO = new ExtraCostBO();
            List<int> aListIndexTemp = new List<int>();
            BookingHs aBookingHs = new BookingHs();
            BookingRs aBookingRs = aBookingRsBO.Select_ByID(IDBookingR);
            if (this.IDBookingH > 0)
            {
                aBookingHs = aBookingHsBO.Select_ByID(this.IDBookingH);
            }
            else
            {
                BookingRs_BookingHs aItem = (new BookingRs_BookingHsBO()).Select_ByIDBookingR(this.IDBookingR);
                if (aItem != null)
                {
                    this.IDBookingH = aItem.IDBookingH.GetValueOrDefault(0);
                    aBookingHs = aBookingHsBO.Select_ByID(this.IDBookingH);
                }

            }

            // Truyen du lieu chung cua NewPayment
            if (aBookingRs != null)
            {
                aNewPaymentEN.IDBookingR = aBookingRs.ID;
                aNewPaymentEN.IDCustomer = aBookingRs.IDCustomer;
                Customers aCustomers = aCustomersBO.Select_ByID(aBookingRs.IDCustomer);
                if (aCustomers != null)
                {
                    aNewPaymentEN.NameCustomer = aCustomers.Name;
                }
                aNewPaymentEN.IDSystemUser = aBookingRs.IDSystemUser;
                SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingRs.IDSystemUser);
                if (aSystemUsers != null)
                {
                    aNewPaymentEN.NameSystemUser = aSystemUsers.Name;
                }
                aNewPaymentEN.IDCustomerGroup = aBookingRs.IDCustomerGroup;
                CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingRs.IDCustomerGroup);
                if (aCustomerGroups != null)
                {
                    aNewPaymentEN.NameCustomerGroup = aCustomerGroups.Name;
                    aNewPaymentEN.IDCompany = aCustomerGroups.IDCompany;
                    Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany);
                    if (aCompanies != null)
                    {
                        aNewPaymentEN.NameCompany = aCompanies.Name;
                        aNewPaymentEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode;
                        aNewPaymentEN.AddressCompany = aCompanies.Address;
                    }
                }
                aNewPaymentEN.PayMenthodR = aBookingRs.PayMenthod;
                aNewPaymentEN.CreatedDate_BookingR = aBookingRs.CreatedDate;
                aNewPaymentEN.CustomerType = aBookingRs.CustomerType;
                aNewPaymentEN.Status_BookingR = aBookingRs.Status;
                aNewPaymentEN.StatusPay = aBookingRs.StatusPay;
                aNewPaymentEN.BookingRMoney = aBookingRs.BookingMoney;
                aNewPaymentEN.Status_BookingR = aBookingRs.Status;
                aNewPaymentEN.AcceptDate = aBookingRs.AcceptDate;
                aNewPaymentEN.InvoiceDate = aBookingRs.InvoiceDate;
                aNewPaymentEN.InvoiceNumber = aBookingRs.InvoiceNumber;

                // Truyen du lieu cho List BookingRoom cua NewPayment
                List<BookingRooms> aListBookingRooms = aBookingRoomBO.Select_ByIDBookingRs(this.IDBookingR);
                if (aListBookingRooms.Count > 0)
                {
                    BookingRoomUsedEN aBookingRoomUsedEN;

                    foreach (BookingRooms item in aListBookingRooms)
                    {
                        aBookingRoomUsedEN = new BookingRoomUsedEN();
                        aBookingRoomUsedEN.SetValue(item);
                        aBookingRoomUsedEN.ListCustomer = aCustomersBO.SelectListCustomer_ByIDBookingRoom(item.ID);
                        Rooms aRooms = aRoomsBO.Select_ByCodeRoom(item.CodeRoom, 1);
                        if (aRooms != null)
                        {
                            aBookingRoomUsedEN.RoomSku = aRooms.Sku;
                        }
                        else
                        {
                            aBookingRoomUsedEN.RoomSku = string.Empty;
                        }
                        if (item.Status == 8 || item.Status == 7)
                        {
                            aBookingRoomUsedEN.AddTimeStart = Convert.ToDouble(aReceptionTaskBO.GetAddTimeStart(Convert.ToInt32(item.Type), item.CheckInActual));
                            aBookingRoomUsedEN.AddTimeEnd = Convert.ToDouble(aReceptionTaskBO.GetAddTimeEnd(Convert.ToInt32(item.Type), item.CheckOutActual));
                            aBookingRoomUsedEN.TimeInUse = Convert.ToDecimal(aReceptionTaskBO.GetTimeInUsed(item.CheckInActual, item.CheckOutActual) * 24 * 60);
                        }
                        else
                        {
                            aBookingRoomUsedEN.AddTimeStart = Convert.ToDouble(aReceptionTaskBO.GetAddTimeStart(Convert.ToInt32(item.Type), item.CheckInActual));
                            aBookingRoomUsedEN.AddTimeEnd = Convert.ToDouble(aReceptionTaskBO.GetAddTimeEnd(Convert.ToInt32(item.Type), item.CheckOutPlan));
                            aBookingRoomUsedEN.TimeInUse = Convert.ToDecimal(aReceptionTaskBO.GetTimeInUsed(item.CheckInActual, item.CheckOutPlan) * 24 * 60);

                        }
                        decimal? cost = 0;
                        if (item.Cost == null)
                        {
                            cost = item.CostRef_Rooms;
                            aBookingRoomUsedEN.Cost = cost + Convert.ToDecimal(aExtraCostBO.Select_BySku_ByPriceType_ByNumberPeople(aRooms.Sku, aBookingRoomUsedEN.PriceType, aBookingRoomUsedEN.ListCustomer.Count).ExtraValue);
                        }
                        else
                        {
                            cost = item.Cost;
                            aBookingRoomUsedEN.Cost = cost;
                        }
                        List<ServiceUsedEN> aListServiceRTemp = aReceptionTaskBO.GetListServiceUsedInRoom_ByIDBookingRoom(item.ID);
                        foreach (ServiceUsedEN aTemp in aListServiceRTemp)
                        {
                            aBookingRoomUsedEN.ListServiceUsed.Add(aTemp);
                            aListIndexTemp.Add(Convert.ToInt32(aTemp.IndexSubPayment));
                        }
                        aListIndexTemp.Add(Convert.ToInt32(aBookingRoomUsedEN.IndexSubPayment));
                        aNewPaymentEN.aListBookingRoomUsed.Add(aBookingRoomUsedEN);
                    }
                }

                //====================================================================================================
                //====================================================================================================
                //====================================================================================================
                // Brucelee Thanh sửa ngày 04/06/2015
                //
                //---------------
                // Lỗi sai điều kiện câu lệnh if khiến aBookingHs truyền dữ liệu CustomerType sai cho NewPaymentEN
                //---------------
                // Ban đầu : if (aBookingHs != null)
                //-------------------------------------
                if (aBookingHs.ID > 0)
                {
                    aNewPaymentEN.IDBookingH = aBookingHs.ID;
                    aNewPaymentEN.PayMenthodH = aBookingHs.PayMenthod;
                    aNewPaymentEN.CreatedDate_BookingH = aBookingHs.CreatedDate;
                    aNewPaymentEN.CustomerType = aBookingHs.CustomerType;
                    aNewPaymentEN.Status_BookingH = aBookingHs.Status;
                    aNewPaymentEN.BookingHMoney = aBookingHs.BookingMoney;
                    // Truyen du lieu cho List BookingHall cua NewPayment
                    List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(this.IDBookingH);
                    if (aListBookingHalls != null)
                    {
                        BookingHallUsedEN aBookingHallUsedEN;
                        foreach (BookingHalls item in aListBookingHalls)
                        {
                            aBookingHallUsedEN = new BookingHallUsedEN();
                            aBookingHallUsedEN.SetValue(item);
                            Halls aHalls = aHallsBO.Select_ByCodeHall(item.CodeHall, 1);
                            if (aHalls != null)
                            {
                                aBookingHallUsedEN.HallSku = aHalls.Sku;
                            }
                            else
                            {
                                aBookingHallUsedEN.HallSku = string.Empty;
                            }
                            aBookingHallUsedEN.CustomerType = aBookingHs.CustomerType;
                            aBookingHallUsedEN.BookingTypeBookingH = aBookingHs.BookingType;
                            aBookingHallUsedEN.StatusPayBookingH = aBookingHs.StatusPay;
                            aBookingHallUsedEN.LevelBookingH = aBookingHs.Level;
                            aBookingHallUsedEN.aListMenuEN = aReceptionTaskBO.GetListMenus_ByIDBookingHall(item.ID);

                            aListIndexTemp.Add(Convert.ToInt32(aBookingHallUsedEN.IndexSubPayment));
                            List<ServiceUsedEN> aListServiceTemp = aReceptionTaskBO.GetListServiceUsedInHall_ByIDBookingHall(item.ID);
                            foreach (ServiceUsedEN aTemp in aListServiceTemp)
                            {
                                aBookingHallUsedEN.aListServiceUsed.Add(aTemp);
                                aListIndexTemp.Add(Convert.ToInt32(aTemp.IndexSubPayment));
                            }
                            aNewPaymentEN.aListBookingHallUsed.Add(aBookingHallUsedEN);
                        }
                    }
                }
                aNewPaymentEN.ListIndex = aListIndexTemp.Distinct().ToList();
            }
        }
        private void frmIns_SystemUsers_Divisions_Load(object sender, EventArgs e)
        {
            try
            {
                DivisionsBO aDivisionsBO = new DivisionsBO();
                List<Divisions> aListDivisions = aDivisionsBO.Select_All();
                lueIDDivision.Properties.DataSource = aListDivisions;
                lueIDDivision.Properties.DisplayMember = "Name";
                lueIDDivision.Properties.ValueMember = "ID";

                if (aListDivisions.Count > 0)
                {
                    lueIDDivision.EditValue = aListDivisions[0].ID;
                }
                SystemUsersBO aSystemUsersBO = new SystemUsersBO();
                this.aListAvailableSystemUsers = aSystemUsersBO.Select_ByDisable(false); //Disable = false
                this.LoadListAvailableSystemUsers();
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmIns_SystemUsers_Divisions.frmIns_SystemUsers_Divisions_Load\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void InitData(int IDBookingH)
        {
            CompaniesBO aCompaniesBO = new CompaniesBO();
            CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO();
            SystemUsersBO aSystemUsersBO = new SystemUsersBO();
            BookingHsBO aBookingHsBO = new BookingHsBO();
            ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO();
            HallsBO aHallsBO = new HallsBO();
            BookingHallsBO aBookingHallsBO = new BookingHallsBO();
            FoodsBO aFoodsBO = new FoodsBO();
            List<int> aListIndexTemp = new List<int>();

            BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH);
            if (aBookingHs != null)
            {
                aNewPaymentHEN.IDCustomer = aBookingHs.IDCustomer;
                Customers aCustomers = aCustomersBO.Select_ByID(aBookingHs.IDCustomer);
                if (aCustomers != null)
                {
                    aNewPaymentHEN.NameCustomer = aCustomers.Name;
                }
                aNewPaymentHEN.IDSystemUser = aBookingHs.IDSystemUser;
                SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingHs.IDSystemUser);
                if (aSystemUsers != null)
                {
                    aNewPaymentHEN.NameSystemUser = aSystemUsers.Name;
                }
                aNewPaymentHEN.IDCustomerGroup = aBookingHs.IDCustomerGroup;
                CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingHs.IDCustomerGroup);
                if (aCustomerGroups != null)
                {
                    aNewPaymentHEN.NameCustomerGroup = aCustomerGroups.Name;
                    aNewPaymentHEN.IDCompany = aCustomerGroups.IDCompany;
                    Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany);
                    if (aCompanies != null)
                    {
                        aNewPaymentHEN.NameCompany = aCompanies.Name;
                        aNewPaymentHEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode;
                        aNewPaymentHEN.AddressCompany = aCompanies.Address;
                    }
                }
                aNewPaymentHEN.Subject = aBookingHs.Subject;
                aNewPaymentHEN.PayMenthodH = aBookingHs.PayMenthod;
                aNewPaymentHEN.CreatedDate_BookingH = aBookingHs.CreatedDate;
                aNewPaymentHEN.CustomerType = aBookingHs.CustomerType;
                aNewPaymentHEN.Status_BookingH = aBookingHs.Status;
                aNewPaymentHEN.StatusPay = aBookingHs.StatusPay;
                aNewPaymentHEN.BookingHMoney = aBookingHs.BookingMoney;
                aNewPaymentHEN.AcceptDate = aBookingHs.AcceptDate;
                aNewPaymentHEN.InvoiceDate = aBookingHs.InvoiceDate;
                aNewPaymentHEN.InvoiceNumber = aBookingHs.InvoiceNumber;
                this.aNewPaymentHEN.IDBookingH = aBookingHs.ID;
                this.aNewPaymentHEN.PayMenthodH = aBookingHs.PayMenthod;
                this.aNewPaymentHEN.CreatedDate_BookingH = aBookingHs.CreatedDate;
                this.aNewPaymentHEN.CustomerType = aBookingHs.CustomerType;
                this.aNewPaymentHEN.Status_BookingH = aBookingHs.Status;
                this.aNewPaymentHEN.BookingHMoney = aBookingHs.BookingMoney;
                // Truyen du lieu cho List BookingHall cua NewPayment
                List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(this.IDBookingH);
                if (aListBookingHalls != null)
                {
                    BookingHallUsedEN aBookingHallUsedEN;
                    foreach (BookingHalls item in aListBookingHalls)
                    {
                        aBookingHallUsedEN = new BookingHallUsedEN();
                        aBookingHallUsedEN.SetValue(item);
                        Halls aHalls = aHallsBO.Select_ByCodeHall(item.CodeHall, 1);
                        if (aHalls != null)
                        {
                            aBookingHallUsedEN.HallSku = aHalls.Sku;
                        }
                        else
                        {
                            aBookingHallUsedEN.HallSku = string.Empty;
                        }
                        aBookingHallUsedEN.CustomerType = aBookingHs.CustomerType;
                        aBookingHallUsedEN.BookingTypeBookingH = aBookingHs.BookingType;
                        aBookingHallUsedEN.StatusPayBookingH = aBookingHs.StatusPay;
                        aBookingHallUsedEN.LevelBookingH = aBookingHs.Level;
                        aBookingHallUsedEN.aListMenuEN = aReceptionTaskBO.GetListMenus_ByIDBookingHall(item.ID);

                        aListIndexTemp.Add(Convert.ToInt32(aBookingHallUsedEN.IndexSubPayment));
                        List<ServiceUsedEN> aListServiceTemp = aReceptionTaskBO.GetListServiceUsedInHall_ByIDBookingHall(item.ID);
                        foreach (ServiceUsedEN aTemp in aListServiceTemp)
                        {
                            aBookingHallUsedEN.aListServiceUsed.Add(aTemp);
                            aListIndexTemp.Add(Convert.ToInt32(aTemp.IndexSubPayment));
                        }
                        aNewPaymentHEN.aListBookingHallUsed.Add(aBookingHallUsedEN);

                    }
                }
            }
            aNewPaymentHEN.ListIndex = aListIndexTemp.Distinct().ToList();
        }
        private void lueIDDivision_EditValueChanged(object sender, EventArgs e)
        {
            try
            {
                this.IDDivision = Convert.ToInt32(lueIDDivision.EditValue);
                DivisionsBO aDivisionsBO = new DivisionsBO();

                Divisions aDivisions = aDivisionsBO.Select_ByID(this.IDDivision);

                DivisionsEN aTemp = new DivisionsEN();
                aTemp.ID = aDivisions.ID;

                if (this.aSystemUsers_DivisionsEN.aListDivisionsEN.Where(d=>d.ID == this.IDDivision).ToList().Count == 0)
                {
                    this.aSystemUsers_DivisionsEN.aListDivisionsEN.Add(aTemp);
                }

                SystemUsersBO aSystemUsersBO = new SystemUsersBO();
                List<SystemUsers> aListTemp = aSystemUsersBO.SelectListAllSystemUsers_ByIDDivision(this.IDDivision);
                SystemUsers aSystemUsers;

                foreach (DivisionsEN aDivisionsEN in this.aSystemUsers_DivisionsEN.aListDivisionsEN)
                {
                    if(aDivisionsEN.ID == this.IDDivision)
                    {
                        if (aDivisionsEN.aListSystemUsers.Count <= 0)
                        {
                            foreach (SystemUsers item in aListTemp)
                            {
                                aSystemUsers = new SystemUsers();
                                aSystemUsers.ID = item.ID;
                                aSystemUsers.Username = item.Username;
                                aSystemUsers.Name = item.Name;
                                aSystemUsers.Identifier1 = item.Identifier1;
                                aDivisionsEN.aListSystemUsers.Add(aSystemUsers);
                            }
                        }
                    }
                }

                List<DivisionsEN> aListTemps = this.aSystemUsers_DivisionsEN.aListDivisionsEN.Where(d => d.ID == this.IDDivision).ToList();
                if (aListTemps.Count > 0)
                {
                    DivisionsEN aDivisionsEN = this.aSystemUsers_DivisionsEN.aListDivisionsEN.Where(d => d.ID == this.IDDivision).ToList()[0];
                    int Index = this.aSystemUsers_DivisionsEN.aListDivisionsEN.IndexOf(aDivisionsEN);
                    dgvSelectSystemUsers.DataSource = this.aSystemUsers_DivisionsEN.aListDivisionsEN[Index].aListSystemUsers.Distinct();
                    dgvSelectSystemUsers.RefreshDataSource();
                    this.aSystemUsers_DivisionsEN.aListDivisionsEN.Clear();
                }
                else
                {
                    dgvSelectSystemUsers.DataSource = null;
                    dgvSelectSystemUsers.RefreshDataSource();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("frmIns_SystemUsers_Divisions.lueIDDivision_EditValueChanged\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void ReloadGridView(int IDSystemUser)
 {
     ContractsBO aContractsBO = new ContractsBO();
     SystemUsersBO aSystemUsersBO = new SystemUsersBO();
     List<ContractsEN> aListContractsEN = new List<ContractsEN>();
     List<Contracts> aListTemp = aContractsBO.Select_ByIDSystemUser(IDSystemUser);
     ContractsEN aContractsEN;
     if (aListTemp != null)
     {
         for (int i = 0; i < aListTemp.Count; i++)
         {
             aContractsEN = new ContractsEN();
             aContractsEN.SetValue(aListTemp[i]);
             aContractsEN.Name = aSystemUsersBO.Select_ByID(aListTemp[i].IDSystemUser).Name;
             aListContractsEN.Add(aContractsEN);
         }
     }
     dgvContracts.DataSource = aListContractsEN;
     dgvContracts.RefreshDataSource();
 }
        private void txtName_Leave(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtName.Text) == true)
                {

                    txtName.Focus();
                    MessageBox.Show("Vui lòng nhập tên nhân viên.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    SystemUsersBO aSystemUsersBO = new SystemUsersBO();

                    string domain = Properties.Resources.Domain1;
                    txtUsername.Text = aSystemUsersBO.GetAvaiableUsername(txtName.Text, domain);
                    txtPassword.Text = txtUsername.Text + "12345678";

                }
            }
            catch (Exception ex)
            {
               // MessageBox.Show("frmTsk_SystemUser_Infromation.txtName_Leave\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
              DialogResult a= MessageBox.Show("Email của người dùng không tồn tại! Bạn có muốn nhập lại","Thông báo",MessageBoxButtons.YesNo);
              if (a == DialogResult.Yes)
              {
                  txtName.Focus();

              }
              else if (a == DialogResult.No)
              {
                  this.Close();
              }
            }
        }
        // Author : Linhting
        public void InitData( int IDBookingH)
        {
            try
            {
                CompaniesBO aCompaniesBO = new CompaniesBO();
                CustomerGroupsBO aCustomerGroupsBO = new CustomerGroupsBO();
                SystemUsersBO aSystemUsersBO = new SystemUsersBO();
                BookingHsBO aBookingHsBO = new BookingHsBO();
                CustomersBO aCustomersBO = new CustomersBO();
                ReceptionTaskBO aReceptionTaskBO = new ReceptionTaskBO();
                HallsBO aHallsBO = new HallsBO();
                BookingHallsBO aBookingHallsBO = new BookingHallsBO();
                FoodsBO aFoodsBO = new FoodsBO();

                BookingHs aBookingHs = aBookingHsBO.Select_ByID(IDBookingH);

                    // Truyen du lieu cho List BookingRoom cua NewPayment

                    if (aBookingHs != null)
                    {
                         aNewPaymentEN.IDCustomer = aBookingHs.IDCustomer;
                    Customers aCustomers = aCustomersBO.Select_ByID(aBookingHs.IDCustomer);
                    if (aCustomers != null)
                    {
                        aNewPaymentEN.NameCustomer = aCustomers.Name;
                    }
                    aNewPaymentEN.IDSystemUser = aBookingHs.IDSystemUser;
                    SystemUsers aSystemUsers = aSystemUsersBO.Select_ByID(aBookingHs.IDSystemUser);
                    if (aSystemUsers != null)
                    {
                        aNewPaymentEN.NameSystemUser = aSystemUsers.Name;
                    }
                    aNewPaymentEN.IDCustomerGroup = aBookingHs.IDCustomerGroup;
                    CustomerGroups aCustomerGroups = aCustomerGroupsBO.Select_ByID(aBookingHs.IDCustomerGroup);
                    if (aCustomerGroups != null)
                    {
                        aNewPaymentEN.NameCustomerGroup = aCustomerGroups.Name;
                        aNewPaymentEN.IDCompany = aCustomerGroups.IDCompany;
                        Companies aCompanies = aCompaniesBO.Select_ByID(aCustomerGroups.IDCompany);
                        if (aCompanies != null)
                        {
                            aNewPaymentEN.NameCompany = aCompanies.Name;
                            aNewPaymentEN.TaxNumberCodeCompany = aCompanies.TaxNumberCode;
                            aNewPaymentEN.AddressCompany = aCompanies.Address;
                        }
                    }
                        aNewPaymentEN.IDBookingH = aBookingHs.ID;
                        aNewPaymentEN.CreatedDate_BookingH = aBookingHs.CreatedDate;
                        aNewPaymentEN.CustomerType = aBookingHs.CustomerType;
                        aNewPaymentEN.Status_BookingH = aBookingHs.Status;
                        aNewPaymentEN.BookingHMoney = aBookingHs.BookingMoney;

                        // Truyen du lieu cho List BookingHall cua NewPayment
                        List<BookingHalls> aListBookingHalls = aBookingHallsBO.Select_ByIDBookigH(this.IDBookingH);
                        if (aListBookingHalls != null)
                        {
                            BookingHallUsedEN aBookingHallUsedEN;
                            foreach (BookingHalls item in aListBookingHalls)
                            {
                                aBookingHallUsedEN = new BookingHallUsedEN();
                                aBookingHallUsedEN.SetValue(item);
                                Halls aHalls = aHallsBO.Select_ByCodeHall(item.CodeHall, 1);
                                if (aHalls != null)
                                {
                                    aBookingHallUsedEN.HallSku = aHalls.Sku;
                                }
                                else
                                {
                                    aBookingHallUsedEN.HallSku = string.Empty;
                                }
                                aBookingHallUsedEN.CustomerType = aBookingHs.CustomerType;
                                aBookingHallUsedEN.BookingTypeBookingH = aBookingHs.BookingType;
                                aBookingHallUsedEN.StatusPayBookingH = aBookingHs.StatusPay;
                                aBookingHallUsedEN.LevelBookingH = aBookingHs.Level;
                                aBookingHallUsedEN.aListMenuEN = aReceptionTaskBO.GetListMenus_ByIDBookingHall(item.ID);

                                List<ServiceUsedEN> aListServiceTemp = aReceptionTaskBO.GetListServiceUsedInHall_ByIDBookingHall(item.ID);
                                foreach (ServiceUsedEN aTemp in aListServiceTemp)
                                {
                                    aBookingHallUsedEN.aListServiceUsed.Add(aTemp);
                                }
                                aNewPaymentEN.aListBookingHallUsed.Add(aBookingHallUsedEN);
                            }
                        }
                    }

                }

            catch (Exception ex)
            {
                MessageBox.Show("frmTsk_PaymentHall.InitData\n" + ex.ToString());
            }
        }
Example #26
0
        private static bool Login(string UserName, string Password)
        {
            try
            {
                SystemUsersBO aSystemUsersBO = new SystemUsersBO();

                SystemUsers aSystemUsers = aSystemUsersBO.CheckAccount(UserName, Password);

                if (aSystemUsers != null)
                {
                    if (aSystemUsers.Disable == true)
                    {
                        throw new Exception("Bạn đang bị tạm khóa toàn hệ thống với lý do:[Chưa rõ]");
                    }
                    else
                    {

                        PermitsBO aPermitsBO = new PermitsBO();
                        CORE.CURRENTUSER.ListPermitViewAll = aPermitsBO.GetAllInfoLogin_ByUsername(aSystemUsers.Username)
                            .Where(p => p.Permits_SystemUsers_Disable == false)
                            .Where(p => p.Permits_Disable == false)
                            .Where(p => p.PermitDetails_Disable == false)
                            .Where(p => p.Permits_SystemKey == CORE.SYSTEM.SystemKey).ToList();

                        if (CORE.CURRENTUSER.ListPermitViewAll.Count == 0)
                        {
                            throw new Exception("Bạn không đủ quyền vào phần mềm này");
                        }
                        else
                        {
                            CORE.CURRENTUSER.SystemUser = aSystemUsers;
                            return true;
                        }

                    }

                }
                else
                {
                    throw new Exception("Sai username hoặc password");
                }
            }
            catch (Exception eee)
            {
                throw eee;
            }
        }