コード例 #1
0
 private void btnSaveCompany_Click(object sender, EventArgs e)
 {
     if (ValidationUtility.FieldNotAllowNull(txtCompanyCode) == false)
     {
         lblNotify1.SetText(UI.hasnoinfomation, LabelNotify.EnumStatus.Failed);
         return;
     }
     if (m_Company == null)
     {
         return;
     }
     CoverObjectUtility.GetAutoBindingData(this.tableLayoutPanel1, m_Company);
     if (m_Deputy.CompanyId <= 0)
     {
         lblNotify1.SetText(UI.failed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
         return;
     }
     m_Deputy.SetModify();
     try
     {
         SaveCompany(m_Company);
         lblNotify1.SetText(UI.success, ToolBoxCS.LabelNotify.EnumStatus.Success);
         gridUtility2.UpdateRow <Company>(m_Company);
         InitializeForm(m_Company);
     }
     catch
     {
         lblNotify1.SetText(UI.failed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
     }
 }
コード例 #2
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     if (ValidationUtility.FieldNotAllowNull(txtCompanyCode) == false)
     {
         lblNotify1.SetText(UI.hasnoinfomation, LabelNotify.EnumStatus.Failed);
         return;
     }
     m_Company = new Company();
     CoverObjectUtility.GetAutoBindingData(this.tableLayoutPanel1, m_Company);
     m_Company.ApproveStatusId = (int)ApproveStatus.Wait;
     m_Company.SetCreate();
     m_Company.CompanyId = 0;
     try
     {
         var count = 0;
         using (IUnitOfWork uow = new UnitOfWork())
         {
             count = uow.CompanyRepository.CheckExitCompany(m_Company);
         }
         if (count > 0)
         {
             lblNotify1.SetText(UI.CompanyisExists, ToolBoxCS.LabelNotify.EnumStatus.Failed);
             return;
         }
         SaveCompany(m_Company);
         lblNotify1.SetText(UI.success, ToolBoxCS.LabelNotify.EnumStatus.Success);
         gridUtility2.AddNewRow <Company>(m_Company);
     }
     catch
     {
         lblNotify1.SetText(UI.failed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
     }
 }
コード例 #3
0
ファイル: frmCreateSerie.cs プロジェクト: quangphat/TmTech
        private void btnSave_Click(object sender, EventArgs e)
        {
            Series serie = new Series();

            if (ValidationUtility.FieldNotAllowNull(this) == false)
            {
                return;
            }
            CoverObjectUtility.GetAutoBindingData(this, serie);
            serie.CategoryId = m_Cate.CategoryId;
            using (IUnitOfWork uow = new UnitOfWork())
            {
                uow.SeriesRepository.Add(serie);
                uow.Commit();
            }
            TreeTag newTag = new TreeTag();

            newTag.CateId    = m_Cate.CategoryId;
            newTag.CateName  = m_Cate.CategoryName;
            newTag.SerieId   = serie.SerieId;
            newTag.SerieName = serie.SerieName;
            newTag.NodeTye   = TreeTag.Types.Serie;
            TreeNode node = new TreeNode(serie.SerieName);

            node.Tag = newTag;
            if (AddNode != null)
            {
                AddNode(node);
            }
            this.Close();
        }
コード例 #4
0
 private void InitializeForm(Deputy deputy)
 {
     m_User = deputy.User;
     if (deputy.User == null)
     {
         m_User = new Users();
     }
     CoverObjectUtility.SetAutoBindingData(this.tableLayoutPanel2, m_User);
     CoverObjectUtility.SetAutoBindingData(this.tableLayoutPanel2, deputy);
     cbbIsMainDeputy.Checked = deputy.IsMain;
     cbActive.Checked        = deputy.IsActive;
     if (deputy.User.Sex == true)
     {
         rdNam.Checked = true;
     }
     else
     {
         rdNu.Checked = true;
     }
     if (deputy.DeputyId <= 0)
     {
         btnSaveDeputy.Visible = false;
     }
     else
     {
         btnSaveDeputy.Visible = true;
     }
 }
コード例 #5
0
ファイル: frmEditBankUpdate.cs プロジェクト: quangphat/TmTech
 private void btnSave_Click(object sender, EventArgs e)
 {
     //m_bank.BankCode = txtBankCode.Text;
     //m_bank.BankName = txtBankName.Text;
     //m_bank.Address = txtBankAddress.Text;
     //m_bank.Phone = txtBankPhone.Text;
     //m_bank.Fax = txtBankFax.Text;
     //m_bank.Email = txtBankEmail.Text;
     //m_bank.Note = txtBankNote.Text;
     CoverObjectUtility.GetAutoBindingData(this, m_bank);
     try
     {
         using (IUnitOfWork uow = new UnitOfWork())
         {
             uow.BankBaseRepository.Update(m_bank);
             uow.Commit();
         }
     }
     catch
     {
         labelNotify1.SetText(UI.updatefailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
         return;
     }
     if (updateBank != null)
     {
         updateBank(m_bank, CRUD.Update);
     }
     Close();
 }
コード例 #6
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (ValidationUtility.FieldNotAllowNull(this) == false)
     {
         return;
     }
     Model.CurrencyUnit cu = new Model.CurrencyUnit();
     CoverObjectUtility.GetAutoBindingData(this, cu);
     try
     {
         using (Interface.IUnitOfWork uow = new UnitOfWork())
         {
             uow.CurrencyUnitRepository.Add(cu);
             uow.Commit();
         }
     }
     catch
     {
         labelNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
         return;
     }
     if (insertCurrency != null)
     {
         insertCurrency(cu, Utility.CRUD.Insert);
     }
     Close();
 }
コード例 #7
0
 private void btnCreateAccount_Click(object sender, EventArgs e)
 {
     if (ValidationUtility.FieldNotAllowNull(groupSubsupplier) == false)
     {
         lblNotify1.SetText(UI.hasnoinfomation, LabelNotify.EnumStatus.Failed);
         return;
     }
     if (m_User == null)
     {
         m_User = new Users();
     }
     CoverObjectUtility.GetAutoBindingData(groupSubsupplier, m_User);
     if (string.IsNullOrWhiteSpace(m_User.Password))
     {
         m_User.Password = UtilityFunction.GetSHA256Hash(m_User.UserName);
     }
     m_User.UserId = 0;
     if (m_User == null)
     {
         return;
     }
     try
     {
         SaveAccount(m_User);
         lblNotify1.SetText(UI.success, LabelNotify.EnumStatus.Success);
         gridUtility1.AddNewRow <SubSupplier>(m_Subsupplier);
     }
     catch
     {
         lblNotify1.SetText(UI.failed, LabelNotify.EnumStatus.Failed);
     }
 }
コード例 #8
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     if (ValidationUtility.FieldNotAllowNull(txtsupplierCode) == false)
     {
         lblNotify1.SetText(UI.hasnoinfomation, LabelNotify.EnumStatus.Failed);
         return;
     }
     m_Suplier = new Model.Supplier();
     CoverObjectUtility.GetAutoBindingData(this, m_Suplier);
     m_Suplier.ApproveStatusId = (int)ApproveStatus.Wait;
     m_Suplier.SetCreate();
     m_Suplier.SupplierId = 0;
     try
     {
         var count = 0;
         using (IUnitOfWork uow = new UnitOfWork())
         {
             count = uow.SupplierRepository.CheckExitSuplier(m_Suplier);
         }
         if (count > 0)
         {
             lblNotify1.SetText(UI.CompanyisExists, ToolBoxCS.LabelNotify.EnumStatus.Failed);
             return;
         }
         SaveSupplier(m_Suplier);
         lblNotify1.SetText(UI.success, ToolBoxCS.LabelNotify.EnumStatus.Success);
         AddNode(m_Suplier);
     }
     catch
     {
         lblNotify1.SetText(UI.failed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
     }
 }
コード例 #9
0
 private void btnSaveCompany_Click(object sender, EventArgs e)
 {
     if (ValidationUtility.FieldNotAllowNull(txtsupplierCode) == false)
     {
         lblNotify1.SetText(UI.hasnoinfomation, LabelNotify.EnumStatus.Failed);
         return;
     }
     if (m_Suplier == null)
     {
         return;
     }
     CoverObjectUtility.GetAutoBindingData(this, m_Suplier);
     if (m_Subsupplier.SupplierId <= 0)
     {
         lblNotify1.SetText(UI.failed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
         return;
     }
     m_Subsupplier.SetModify();
     try
     {
         SaveSupplier(m_Suplier);
         lblNotify1.SetText(UI.success, ToolBoxCS.LabelNotify.EnumStatus.Success);
         UpdateNode(m_Suplier);
         FormatTreeView(m_Suplier);
         InitializeForm(m_Suplier);
     }
     catch (Exception ex)
     {
         lblNotify1.SetText(UI.failed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
     }
 }
コード例 #10
0
ファイル: frmCreateUnit.cs プロジェクト: quangphat/TmTech
        private void btnSave_Click(object sender, EventArgs e)
        {
            //Create new Unit
            Unit unit = new Unit();

            CoverObjectUtility.GetAutoBindingData(this, unit);
            unit.SetCreate();

            //ModifyDate and ModifyBy is set null
            try
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    uow.UnitRepository.Add(unit);
                    uow.Commit();
                }
            } catch
            {
                labelNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
                return;
            }

            if (addnewunit != null)
            {
                addnewunit(unit, CRUD.Insert);
            }
            Close();
        }
コード例 #11
0
 private void btnSend_Click(object sender, EventArgs e)
 {
     CoverObjectUtility.GetAutoBindingData(this, _mReq);
     _mReq.SetCreate();
     _mReq.Email = txtEmail.Text;
     try
     {
         using (IUnitOfWork uow = new UnitOfWork())
         {
             uow.RequestPaymentBaseRepository.Add(_mReq);
             uow.Commit();
         }
         InformationMailModel mail = new InformationMailModel();
         mail.Subject         = _mReq.Title;
         mail.SendersAddress  = "*****@*****.**";
         mail.SenderPassword  = "******";
         mail.Content         = _mReq.RequestContent;
         mail.ReceiverAddress = _mReq.Email;
         IMailHandler iMailHandler = new MailHandler();
         iMailHandler.SendMail(mail);
         if (AddRequestCode != null)
         {
             DebtDetail detail = new DebtDetail();
             detail.Payment            = 0;
             detail.PaymentDate        = null;
             detail.RequestPaymentCode = _mReq.RequestCode;
             AddRequestCode(detail, Utility.CRUD.Insert);
         }
         lblNotify.SetText(UI.success, ToolBoxCS.LabelNotify.EnumStatus.Success);
     }
     catch
     {
         lblNotify.SetText(UI.failed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
     }
 }
コード例 #12
0
        private void btnCreate_Click(object sender, System.EventArgs e)
        {
            if (!ValidationUtility.FieldNotAllowNull(this))
            {
                return;
            }
            PaymentMethod pm = new PaymentMethod();

            CoverObjectUtility.GetAutoBindingData(this, pm);
            try
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    uow.PaymentMethodRepository.Add(pm);
                    uow.Commit();
                }
            } catch
            {
                labelNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
                return;
            }
            if (insert != null)
            {
                insert(pm, CRUD.Insert);
            }
            Close();
        }
コード例 #13
0
ファイル: frmEditDepartment.cs プロジェクト: quangphat/TmTech
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (m_dep == null)
            {
                return;
            }

            CoverObjectUtility.GetAutoBindingData(this, m_dep);
            m_dep.SetModify();
            try
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    uow.DepartmentRepository.Update(m_dep);
                    uow.Commit();
                }
            } catch
            {
                labelNotify1.SetText(UI.updatefailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
                return;
            }
            if (UpdateRow != null)
            {
                UpdateRow(m_dep);
            }
            this.Close();
        }
コード例 #14
0
ファイル: frmEditProject.cs プロジェクト: quangphat/TmTech
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (cbbCompany.SelectedValue == null || cbbSale.SelectedValue == null || cbbStatus.SelectedValue == null || !ValidationUtility.FieldNotAllowNull(this))
     {
         labelNotify1.SetText(UI.MsgMissingData, ToolBoxCS.LabelNotify.EnumStatus.Failed);
         return;
     }
     CoverObjectUtility.GetAutoBindingData(this, pro);
     //pro.ProjectName = txtProjectName.Text;
     //pro.DrawingName = txtDrawingName.Text;
     //pro.DateBegin = (DateTime)dtpDateBegin.EditValue;
     //pro.DateEnd = (DateTime)dtpDateEnd.EditValue;
     //pro.ProjectCode = txtProjectCode.Text;
     //pro.Sale = Convert.ToInt32(cbbSale.SelectedValue);
     //pro.CompanyId = Convert.ToInt32(cbbCompany.SelectedValue);
     //pro.StatusId = Convert.ToInt32(cbbStatus.SelectedValue);
     pro.SetModify();
     using (IUnitOfWork uow = new UnitOfWork())
     {
         uow.ProjectBaseRepository.Update(pro);
         uow.Commit();
     }
     if (update != null)
     {
         update(pro, CRUD.Update);
     }
     Close();
 }
コード例 #15
0
ファイル: frmCreateNote.cs プロジェクト: quangphat/TmTech
        private void btnCreate_Click(object sender, System.EventArgs e)
        {
            if (!ValidationUtility.FieldNotAllowNull(this))
            {
                return;
            }
            NoteProjectDetail note = new NoteProjectDetail();

            CoverObjectUtility.GetAutoBindingData(this, note);
            try
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    uow.NoteProjectDetailBaseRepository.Add(note);
                    uow.Commit();
                }
                if (insertnote != null)
                {
                    insertnote(note, CRUD.Insert);
                }
                Close();
            } catch
            {
                labelNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
            }
        }
コード例 #16
0
        void SaveTypePart()
        {
            if (!radioButton2.Checked)
            {
                return;
            }
            if (ValidationUtility.FieldNotAllowNull(groupGroupPart) == false)
            {
                return;
            }
            Model.TypePart typepart = _request.typePart;
            CoverObjectUtility.GetAutoBindingData(groupTypePart, typepart);
            try
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    uow.TypePartBaseRepository.Update(typepart);
                    uow.Commit();
                }

                Close();
            }
            catch
            {
                lblNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
            }
        }
コード例 #17
0
ファイル: frmEditProject.cs プロジェクト: quangphat/TmTech
        private void frmEditProject_Load(object sender, EventArgs e)
        {
            if (pro == null)
            {
                return;
            }
            IList <Staff>   lstSt  = new List <Staff>();
            IList <Company> lstCom = new List <Company>();
            IList <Status>  lstSta = new List <Status>();

            using (IUnitOfWork uow = new UnitOfWork())
            {
                lstSt  = uow.StaffRepository.All();
                lstCom = uow.CompanyRepository.All();
                lstSta = uow.ProjectBaseRepository.GetAllStatus();
                uow.Commit();
            }
            ComboboxUtility.BindData(cbbSale, lstSt, "StaffName", "StaffId");
            ComboboxUtility.BindData(cbbCompany, lstCom, "CompanyName", "CompanyId");
            ComboboxUtility.BindData(cbbStatus, lstSta, "StatusName", "StatusId");
            CoverObjectUtility.SetAutoBindingData(this, pro);
            //if (pro.Sale != null)
            //    cbbSale.SelectedValue = pro.Sale;
            //else
            //    cbbSale.SelectedValue = -1;
            //if (pro.CompanyId != null)
            //    cbbCompany.SelectedValue = pro.CompanyId;
            //else
            //    cbbCompany.SelectedValue = -1;
            //if (pro.StatusId != null)
            //    cbbStatus.SelectedValue = pro.StatusId;
            labelNotify1.Text = "";
        }
コード例 #18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //Create new Unit
            ProductType ProductType = new ProductType();

            CoverObjectUtility.GetAutoBindingData(this, ProductType);
            ProductType.SetCreate();

            try
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    uow.ProductTypeRepository.Insert(ProductType);
                    uow.Commit();
                }
            } catch (Exception ex)
            {
                labelNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
                return;
            }

            if (addNewProductType != null)
            {
                addNewProductType(ProductType, CRUD.Insert);
            }
            Close();
        }
コード例 #19
0
ファイル: frmEditSerie.cs プロジェクト: quangphat/TmTech
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (ValidationUtility.FieldNotAllowNull(this) == false)
     {
         return;
     }
     CoverObjectUtility.GetAutoBindingData(this, m_Serie);
     try
     {
         using (IUnitOfWork uow = new UnitOfWork())
         {
             uow.SeriesRepository.Update(m_Serie);
             uow.Commit();
         }
         TreeNode node = new TreeNode(m_Serie.SerieName);
         node.Name = m_Serie.SerieName;
         node.Text = m_Serie.SerieName;
         TreeTag tag = new TreeTag();
         tag.NodeTye   = TreeTag.Types.Serie;
         tag.CateId    = m_Serie.CategoryId;
         tag.CateName  = m_Tag.CateName;
         tag.SerieId   = m_Serie.SerieId;
         tag.SerieName = m_Serie.SerieName;
         node.Tag      = tag;
         if (UpdateNode != null)
         {
             UpdateNode(node);
         }
         lblNotify1.SetText(UI.updatesuccess, ToolBoxCS.LabelNotify.EnumStatus.Success);
     }
     catch
     {
         lblNotify1.SetText(UI.failed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
     }
 }
コード例 #20
0
ファイル: frmEditQuotation.cs プロジェクト: quangphat/TmTech
 private void InititalizeForm(Quotation quotation)
 {
     if (quotation == null)
     {
         return;
     }
     CoverObjectUtility.SetAutoBindingData(this, quotation);
     if (quotation.ApproveStatusId == (int)ApproveStatus.Approved)
     {
         colQuantity.OptionsColumn.AllowEdit = false;
         foreach (GridColumn col in gridView1.Columns)
         {
             col.OptionsColumn.AllowEdit = false;
         }
         btnRemove.Visible         = false;
         txtQuotationCode.ReadOnly = true;
         txtQuotationCode.Display(quotation.ApproveStatusId);
     }
     if (m_Company != null)
     {
         if (m_Company.MainDeputy == null)
         {
             m_Company.MainDeputy = new Deputy();
         }
         CoverObjectUtility.SetAutoBindingData(this, m_Company);
     }
 }
コード例 #21
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     if (!ValidationUtility.FieldNotAllowNull(this))
     {
         return;
     }
     Model.BrankBank branch = new BrankBank();
     CoverObjectUtility.GetAutoBindingData(this, branch);
     branch.BankId = bank.BankId;
     branch.SetCreate();
     try
     {
         using (IUnitOfWork uow = new UnitOfWork())
         {
             uow.BrankBankBaseRepository.Add(branch);
             uow.Commit();
         }
         labelNotify1.SetText(UI.createsuccess, ToolBoxCS.LabelNotify.EnumStatus.Success);
         if (AddnewBranch != null)
         {
             AddnewBranch(bank, CRUD.Insert, branch);
         }
         Close();
     }
     catch
     {
         labelNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
     }
 }
コード例 #22
0
ファイル: frmEditStaff.cs プロジェクト: quangphat/TmTech
 private void InitializeForm(Staff staff)
 {
     //txtFullName.Text = staff.StaffName;
     //txtEmail.Text = staff.Email;
     //txtCode.Text = staff.StaffCode;
     //txtUserName.Text = staff.User!=null?staff.User.UserName:string.Empty;
     //txtPhone.Text = staff.Phone;
     //dtpBirthday.DateTime = staff.Birthday != null ? staff.Birthday.Value : DateTime.Today;
     //dtpBeginDate.DateTime = staff.BeginDate!=null? staff.BeginDate.Value:DateTime.Today;
     //txtAddress.Text = staff.Address;
     //cbbDepartment.SelectedValue = m_Staff.DepartmentId;
     //cbbUserGroup.SelectedValue = staff.UserGroup != null ? staff.UserGroup.UserGroupId : 0;
     //cbbPosition.SelectedValue = m_Staff.StaffPosition != null ? staff.StaffPosition.StaffPositionId : 0;
     CoverObjectUtility.SetAutoBindingData(this, staff);
     if (staff.Sex)
     {
         rbtnMale.Checked = true;
     }
     else
     {
         rbtnFemale.Checked = true;
     }
     if (!ValidationUtility.StringIsNull(staff.Avatar))
     {
         PictureUtility.BindImage(ptAvatar, staff.Avatar);
     }
     if (!ValidationUtility.StringIsNull(staff.SignaturePhoto))
     {
         PictureUtility.BindImage(ptSignature, staff.SignaturePhoto);
     }
 }
コード例 #23
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (!ValidationUtility.FieldNotAllowNull(this))
     {
         return;
     }
     CoverObjectUtility.GetAutoBindingData(this, staffPosition);
     try
     {
         using (IUnitOfWork uow = new UnitOfWork())
         {
             uow.StaffPositionRepository.Update(staffPosition);
             uow.Commit();
         }
         if (update != null)
         {
             update(staffPosition, CRUD.Update);
         }
         Close();
     }
     catch
     {
         labelNotify1.SetText(UI.updatefailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
     }
 }
コード例 #24
0
        public void LoadData(ImportMaterial _import)
        {
            CoverObjectUtility.SetAutoBindingData(panel5, _import);
            //var Status = cboStatus.SelectedItem as ApproveStatusModel;
            bool isEditImportMaterial = false;

            gridView2.OptionsView.NewItemRowPosition = NewItemRowPosition.None;
            if (_import.ApproveStatusId == 2)
            {
                gridView2.OptionsView.NewItemRowPosition = NewItemRowPosition.None;
                gridView2.OptionsBehavior.Editable       = false;
                isEditImportMaterial = false;
            }
            else
            {
                gridView2.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom;
                gridView2.OptionsBehavior.Editable       = true;

                isEditImportMaterial = true;
            }
            cboStock.Enabled   = isEditImportMaterial;
            cboStatus.Enabled  = isEditImportMaterial;
            btnSave.Visible    = isEditImportMaterial;
            btnApprove.Visible = isEditImportMaterial;
        }
コード例 #25
0
 private void InitializeForm(SubSupplier subsupplier)
 {
     m_User = subsupplier.User;
     if (subsupplier.User == null)
     {
         m_User = new Users();
     }
     CoverObjectUtility.SetAutoBindingData(this, m_User);
     CoverObjectUtility.SetAutoBindingData(this, subsupplier);
     cbbIsMainDeputy.Checked = subsupplier.IsMain;
     cbActive.Checked        = subsupplier.IsActive;
     if (subsupplier.User.Sex == true)
     {
         rdNam.Checked = true;
     }
     else
     {
         rdNu.Checked = true;
     }
     if (subsupplier.SubSupplierId <= 0)
     {
         btnSaveDeputy.Visible = false;
     }
     else
     {
         btnSaveDeputy.Visible = true;
     }
 }
コード例 #26
0
ファイル: frmCreatePo.cs プロジェクト: quangphat/TmTech
 private void InitializeForm(Po po)
 {
     if (po == null)
     {
         return;
     }
     CoverObjectUtility.SetAutoBindingData(this.tableLayoutPanel3, po);
     if (po.Quotation != null)
     {
         CoverObjectUtility.SetAutoBindingData(this.tableLayoutPanel3, po.Quotation);
     }
     if (m_Comapny != null)
     {
         CoverObjectUtility.SetAutoBindingData(this.tableLayoutPanel3, m_Comapny);
         if (m_Comapny.MainDeputy != null)
         {
             CoverObjectUtility.SetAutoBindingData(this.tableLayoutPanel3, m_Comapny.MainDeputy);
         }
         if (m_Comapny.CompanyId > 0)
         {
             using (IUnitOfWork uow = new UnitOfWork())
             {
                 m_Po.PoCode = uow.PoRepository.GetPOCode(m_Comapny.CompanyId, DateTime.Today);
                 uow.Commit();
             }
             txtPoCode.Text = m_Po.PoCode;
         }
     }
 }
コード例 #27
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidationUtility.FieldNotAllowNull(this) == false)
            {
                return;
            }
            Department department = new Department();

            CoverObjectUtility.GetAutoBindingData(this, department);
            department.SetCreate();
            try
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    uow.DepartmentRepository.Add(department);
                    uow.Commit();
                }
                if (Addrow != null)
                {
                    Addrow(department);
                }
                this.Close();
            }
            catch
            {
                labelNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
            }
        }
コード例 #28
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            if (ValidationUtility.FieldNotAllowNull(this) == false)
            {
                return;
            }

            Model.Category cate = new Model.Category();
            CoverObjectUtility.GetAutoBindingData(this, cate);
            try
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    uow.CategoryRepository.Add(cate);
                    uow.Commit();
                }
                TreeTag treeTag = new TreeTag();
                treeTag.NodeTye  = TreeTag.Types.Category;
                treeTag.CateId   = cate.CategoryId;
                treeTag.CateName = cate.CategoryName;
                TreeNode node = new TreeNode(cate.CategoryName);
                node.Tag = treeTag;
                if (AddNode != null)
                {
                    AddNode(node);
                }
                Close();
            }
            catch
            {
                lblNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
            }
        }
コード例 #29
0
ファイル: frmEditPO.cs プロジェクト: quangphat/TmTech
        private void btnApprove_Click_1(object sender, EventArgs e)
        {
            DialogResult result = FormUtility.MsgApprove();

            if (result == System.Windows.Forms.DialogResult.No)
            {
                return;
            }
            if (m_Po.ApproveStatusId == (int)ApproveStatus.Approved)
            {
                lblNotify1.SetText(UI.itemwasapproved, ToolBoxCS.LabelNotify.EnumStatus.Failed);
                return;
            }
            //create delivery.
            Delivery delivery = new Delivery();

            delivery.SetCreate();
            delivery.POCode    = m_Po.PoCode;
            delivery.CompanyId = m_Company.CompanyId;
            //update po
            CoverObjectUtility.GetAutoBindingData(this.tableLayoutPanel3, m_Po);

            //create debt

            Debt debt = new Debt();

            debt.POCode = m_Po.PoCode;
            try
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    delivery.DeliveryCode = uow.DeliveryRepository.CreateCode(m_Company, DateTime.Today);
                    uow.DeliveryRepository.Add(delivery);
                    if (m_Po.CreateDebt == true)
                    {
                        debt.DeliveryCode = delivery.DeliveryCode;
                        uow.DebtRepository.Add(debt);
                    }
                    m_Po.ApproveStatusId = (int)ApproveStatus.Approved;
                    m_Po.ApproveBy       = UserManagement.UserSession.UserName;
                    m_Po.ApproveDate     = DateTime.Now;
                    Quotation quotation = new Quotation();
                    quotation.ApproveStatusId = (int)ApproveStatus.Approved;
                    quotation.QuotationCode   = m_Po.QuotationCode;
                    uow.PoRepository.Update(m_Po);
                    uow.QuotationRepository.Lock(quotation);
                    uow.PlanningRepository.CreateFromPO(m_Po);
                    LogUtility.WriteLog(m_Po.PoCode, m_Po.ApproveStatusId, uow);
                    uow.Commit();
                }
                txtPoCode.Display(m_Po.ApproveStatusId);
                lblNotify1.SetText(UI.success, ToolBoxCS.LabelNotify.EnumStatus.Success);
                InitializeForm(m_Po);
            }
            catch
            {
                lblNotify1.SetText(UI.failed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
            }
        }
コード例 #30
0
 private void metroSearchComboBox2_SelectedValueChanged(object sender, EventArgs e)
 {
     //m_QuotationDetail.ClassSafety = metroSearchComboBox2.Text;
     //metroSearchComboBox2.SelectedValue = 0;
     //CoverObjectUtility.SetSingleCtrlAutoBindingData(metroSearchComboBox2, m_QuotationDetail);
     CoverObjectUtility.GetSingleCtrlAutoBindingData(metroSearchComboBox2, m_QuotationDetail);
     InititalizeForm(m_QuotationDetail);
 }