コード例 #1
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);
            }
        }
コード例 #2
0
        private void AddImportMaterial(object sender, EventArgs e)
        {
            if (ValidationUtility.FieldNotAllowNull(this) == false)
            {
                return;
            }
            Boolean isSuccess = false;

            using (IUnitOfWork uow = new UnitOfWork())
            {
                if (AddMaterialImport(importMaterial, uow))
                {
                    if (AddMaterialDetail(listImportMaterialDetail, importMaterial, uow))
                    {
                        uow.Commit();
                        isSuccess = true;
                    }
                }
            }

            if (isSuccess)
            {
                _importMaterialRequestDataBase.Model = importMaterial;
                _importMaterialRequestDataBase.AddOrUpdateRow(_importMaterialRequestDataBase.Model, CRUD.Insert);
                this.Close();
            }
            else
            {
                labelNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
            }
        }
コード例 #3
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);
     }
 }
コード例 #4
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);
     }
 }
コード例 #5
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();
 }
コード例 #6
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();
        }
コード例 #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
        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);
            }
        }
コード例 #11
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);
            }
        }
コード例 #12
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);
     }
 }
コード例 #13
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);
     }
 }
コード例 #14
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);
     }
 }
コード例 #15
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);
            }
        }
コード例 #16
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();
        }
コード例 #17
0
        //void Initdata()
        //{
        //    if (_requestPaymentParameter.IsEdit)
        //    {
        //        var requestPayment = _requestPaymentParameter.RequestPayment;
        //        txtCode.Text = requestPayment.RequestCode;
        //        txtContent.Text = requestPayment.RequestContent;
        //        txtEmail.Text = requestPayment.Email;
        //        txtTitle.Text = requestPayment.Title;
        //        lblTitleForm.Text = "Chỉnh sửa " + "Yêu cầu hình thức thanh toán";
        //    }
        //    else
        //    {

        //        lblTitleForm.Text = "Tạo mới" + "Yêu cầu hình thức thanh toán";
        //        FormUtility.ResetAllControls(this); txtCode.Text = "xxxxxxxxxxxx";

        //    }
        //}

        private void btnSave_Click(object sender, System.EventArgs e)
        {
            if (ValidationUtility.FieldNotAllowNull(this) == false)
            {
                return;
            }
        }
コード例 #18
0
ファイル: frmEditMaterial.cs プロジェクト: quangphat/TmTech
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidationUtility.FieldNotAllowNull(this) == false)
            {
                return;
            }
            CoverObjectUtility.GetAutoBindingData(this, m_Material);
            m_Material.Supplier             = cbbSupplier.SelectedItem != null ? cbbSupplier.SelectedItem as Model.Supplier : new Model.Supplier();
            m_Material.GropsupplierMaterial = cbbGroupPart.SelectedItem != null ? cbbGroupPart.SelectedItem as GroupPart : new GroupPart();
            m_Material.TypePartMaterial     = cbbTypePart.SelectedItem != null ? cbbTypePart.SelectedItem as TypePart : new TypePart();
            m_Material.SeriesPartMaterial   = cbbSeriesPart.SelectedItem != null ? cbbSeriesPart.SelectedItem as SeriesPart : new SeriesPart();
            m_Material.UnitMaterial         = cbbUnit.SelectedItem != null ? cbbUnit.SelectedItem as Unit : new Unit();
            m_Material.SupplierId           = m_Material.Supplier.SupplierId;
            m_Material.GroupPartId          = m_Material.GropsupplierMaterial.GroupPartId;
            m_Material.TypePartId           = m_Material.TypePartMaterial.TypePartID;
            m_Material.SeriesPartId         = m_Material.SeriesPartMaterial.SeriesPartId;
            m_Material.UnitId = m_Material.UnitMaterial.UnitId;

            m_Material.MaterialCode = GenericCodeMaterial(m_Material);
            if (materialRequestDataBase.IsEdit)
            {
                try
                {
                    using (IUnitOfWork uow = new UnitOfWork())
                    {
                        uow.MaterialRepository.Update(m_Material);
                        uow.Commit();
                    }
                    if (materialRequestDataBase.gridview != null)
                    {
                        materialRequestDataBase.gridview.RefreshData();
                    }
                    this.Close();
                }
                catch (Exception ex)
                {
                    lblNotify1.SetText(UI.updatefailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
                }
            }
            else
            {
                try
                {
                    using (IUnitOfWork uow = new UnitOfWork())
                    {
                        uow.MaterialRepository.Add(m_Material);
                        uow.Commit();
                    }
                    materialRequestDataBase.AddOrUpdateRow(m_Material, CRUD.Insert);

                    this.Close();
                }
                catch (Exception ex)
                {
                    lblNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
                }
            }
        }
コード例 #19
0
ファイル: FrmInputBank.cs プロジェクト: quangphat/TmTech
 private void AddItemBank(object sender, EventArgs e)
 {
     if (ValidationUtility.FieldNotAllowNull(this) == false)
     {
         lableMessage.SetText(UI.hasnoinfomation, ToolBoxCS.LabelNotify.EnumStatus.Failed);
         return;
     }
     m_texbox.Text += txtBankName.Text + "_" + txtAccountName.Text + "_" + txtAccountNumber.Text + ";";
 }
コード例 #20
0
ファイル: FrmSourcing.cs プロジェクト: quangphat/TmTech
        private void bootstrapButton1_Click(object sender, EventArgs e)
        {
            if (isInsert == false && isUpdate == false)
            {
                lblNotify1.SetText("không có thao tác", LabelNotify.EnumStatus.Failed);
                return;
            }

            if (isInsert)
            {
                if (ValidationUtility.FieldNotAllowNull(this) == false)
                {
                    return;
                }
                if (isCreateNew.SeriesPartID < 0)
                {
                    lblNotify1.SetText("thiếu thông tin về series ID", LabelNotify.EnumStatus.Failed);
                    return;
                }


                if (txtPricePart.Text == string.Empty)
                {
                }

                try
                {
                    decimal.Parse(txtPricePart.Text);
                }
                catch (Exception)
                {
                    lblNotify1.SetText("Chưa nhập giá hoặc giá không chính x", LabelNotify.EnumStatus.Failed);
                    txtPricePart.Focus();
                    return;
                }


                if (cboSupplier.SelectedValue == null)
                {
                    lblNotify1.SetText("Chưa nhập thông tin nhà cung cấp", LabelNotify.EnumStatus.Failed);
                }

                if (PictureImage.Tag != null)
                {
                    isCreateNew.ImagePath = PictureUtility.SaveImg(PictureImage.Tag.ToString());
                }



                SaveSourcing(isCreateNew);
            }
            else if (isUpdate)
            {
                Update();
            }
        }
コード例 #21
0
 private void bootstrapButton1_Click_1(object sender, EventArgs e)
 {
     if (ValidationUtility.FieldNotAllowNull(this) == false)
     {
         return;
     }
     if (m_Product == null)
     {
         return;
     }
     CoverObjectUtility.GetAutoBindingData(this, m_Product);
     SaveProduct();
 }
コード例 #22
0
ファイル: frmEditQuotation.cs プロジェクト: quangphat/TmTech
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidationUtility.FieldNotAllowNull(this) == false)
            {
                return;
            }
            if (m_Quotation == null)
            {
                return;
            }
            CoverObjectUtility.GetAutoBindingData(this, m_Quotation);
            if (m_Quotation.ApproveStatusId == (int)ApproveStatus.Approved)
            {
                lblNotify1.SetText(UI.itemwasapproved, ToolBoxCS.LabelNotify.EnumStatus.Failed);
                return;
            }
            m_Quotation.SetModify();
            IList <QuotationDetail> lstQuotationDetail = gridControl1.DataSource as IList <QuotationDetail>;

            try
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    uow.QuotationRepository.Update(m_Quotation);
                    foreach (QuotationDetail p in lstQuotationDetail)
                    {
                        p.QuotationCode = m_Quotation.QuotationCode;
                        if (p.QuotationDetailId != Guid.Empty)
                        {
                            uow.QuotationDetailRepository.Update(p);
                        }
                        else
                        {
                            uow.QuotationDetailRepository.Add(p);
                        }
                    }
                    uow.Commit();
                }
                m_Quotation.TotalValue = CurrencyUtility.ToDecimal(colThanhtien.SummaryText);
                isEdited = false;
                if (UpdateRow != null)
                {
                    UpdateRow(m_Quotation);
                }
                lblNotify1.SetText(UI.success, ToolBoxCS.LabelNotify.EnumStatus.Success);
            }
            catch
            {
                lblNotify1.SetText(UI.failed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
            }
        }
コード例 #23
0
ファイル: frmEditGroupPart.cs プロジェクト: quangphat/TmTech
 private void btnSave_Click_1(object sender, EventArgs e)
 {
     if (ValidationUtility.FieldNotAllowNull(this) == false)
     {
         return;
     }
     m_GroupPart.GroupPartName = txtName.Text;
     m_GroupPart.GroupPartCode = txtCode.Text;
     m_GroupPart.Note          = txtNote.Text;
     m_GroupPart.ModifyDate    = DateTime.Now;
     m_GroupPart.ModifyBy      = UserManagement.UserSession.UserName;
     try
     {
         using (IUnitOfWork uow = new UnitOfWork())
         {
             if (uow.GroupPartBaseRepository.FindExist(m_GroupPart) == true)
             {
                 lblNotify1.SetText(UI.codehasexist, ToolBoxCS.LabelNotify.EnumStatus.Failed);
                 return;
             }
             else
             {
                 uow.GroupPartBaseRepository.Update(m_GroupPart);
                 TreeNode node = new TreeNode(m_GroupPart.GroupPartName);
                 node.Name = m_GroupPart.GroupPartName;
                 node.Text = m_GroupPart.GroupPartName;
                 TreeTagPart tag = new TreeTagPart();
                 tag.NodeTye        = TreeTagPart.Types.GroupPart;
                 tag.GroupPartIDTag = m_GroupPart.GroupPartId;
                 node.Tag           = tag;
                 if (UpdateNode != null)
                 {
                     UpdateNode(node);
                 }
                 lblNotify1.SetText(UI.updatesuccess, ToolBoxCS.LabelNotify.EnumStatus.Success);
                 Close();
             }
             uow.Commit();
         }
         return;
     }
     catch
     {
         lblNotify1.SetText(UI.updatefailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
         return;
     }
 }
コード例 #24
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidationUtility.FieldNotAllowNull(this) == false)
            {
                return;
            }
            if (m_Quotation == null)
            {
                return;
            }
            CoverObjectUtility.GetAutoBindingData(this.tableLayoutPanel1, m_Quotation);
            IList <QuotationDetail> lstQuottionDetail = gridControl1.DataSource as IList <QuotationDetail>;

            if (lstQuottionDetail == null)
            {
                return;
            }

            m_Quotation.Company    = m_Company;
            m_Quotation.TotalValue = CurrencyUtility.ToDecimal(colThanhtien.SummaryText);
            try
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    uow.QuotationRepository.Add(m_Quotation);
                    foreach (QuotationDetail quotationDetail in lstQuottionDetail)
                    {
                        quotationDetail.QuotationCode = m_Quotation.QuotationCode;
                        uow.QuotationDetailRepository.Add(quotationDetail);
                    }
                    uow.Commit();
                }
                if (AddRow != null)
                {
                    AddRow(m_Quotation, CRUD.Insert);
                }
                lblNotify1.SetText(UI.createsuccess, ToolBoxCS.LabelNotify.EnumStatus.Success);
                //();
                isEdited = false;
                this.Close();
            }
            catch
            {
                lblNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
            }
        }
コード例 #25
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (m_User == null)
     {
         return;
     }
     if (m_User.UserId <= 0)
     {
         return;
     }
     if (ValidationUtility.FieldNotAllowNull(this) == false)
     {
         lblNotify.SetText(UI.hasnoinfomation, ToolBoxCS.LabelNotify.EnumStatus.Failed);
         return;
     }
     if (ValidationUtility.ContainsUnicodeCharacter(txtPass.Text) == true)
     {
         lblNotify.SetText(UI.passwordnotallowspace, ToolBoxCS.LabelNotify.EnumStatus.Failed);
         return;
     }
     if (txtPass.Text != txtRePass.Text)
     {
         lblNotify.SetText(UI.passwordnotsame, ToolBoxCS.LabelNotify.EnumStatus.Failed);
         return;
     }
     if (txtPass.TextLength < 8)
     {
         lblNotify.SetText(UI.passwordtooshort, ToolBoxCS.LabelNotify.EnumStatus.Failed);
         return;
     }
     m_User.Password = UtilityFunction.GetSHA256Hash(txtPass.Text);
     try
     {
         using (IUnitOfWork uow = new UnitOfWork())
         {
             uow.UsersRepository.Update(m_User);
             uow.Commit();
         }
         lblNotify.SetText(UI.success, ToolBoxCS.LabelNotify.EnumStatus.Success);
     }
     catch
     {
     }
 }
コード例 #26
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidationUtility.FieldNotAllowNull(this) == false)
            {
                return;
            }
            var deputy = objEdit;

            deputy.Skype      = txtSkype.Text;
            deputy.Address    = txtDiaChi.Text;
            deputy.Email      = txtEmail.Text;
            deputy.DeputyName = txtNameContact.Text;
            deputy.Phone      = txtPhone.Text;
            deputy.CompanyId  = objEdit.CompanyId;
            deputy.IsActive   = checkIsActive.Checked;
            deputy.ModifyBy   = UserManagement.UserSession.UserName;
            deputy.ModifyDate = DateTime.Now;
            deputy.Note       = txtNote.Text;
            deputy.Sex        = (cbSex.SelectedIndex < 1);
            deputy.IsMain     = cbMain.Checked;

            if (userEdit != null)
            {
                userEdit.UserName   = txtAccount.Text;
                userEdit.FullName   = txtNameContact.Text;
                userEdit.ModifyBy   = UserManagement.UserSession.UserName;
                userEdit.ModifyDate = DateTime.Now;
            }
            using (IUnitOfWork uow = new UnitOfWork())
            {
                uow.DeputyRepository.Update(deputy);
                uow.UsersRepository.Update(userEdit);
                uow.Commit();
            }
            UtilityMessageBox.ShowText("cập nhật thành công");

            if (_XuLySauKhiUpdate != null)
            {
                _XuLySauKhiUpdate(deputy);
            }

            Close();
        }
コード例 #27
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            if (ValidationUtility.FieldNotAllowNull(this) == false)
            {
                return;
            }

            Model.GroupPart cate = new Model.GroupPart();
            cate.GroupPartName = txtName.Text;
            cate.GroupPartCode = txtCode.Text;
            cate.Note          = txtNote.Text;
            cate.CreateBy      = UserManagement.UserSession.UserName;
            cate.CreateDate    = DateTime.Now;
            cate.ModifyDate    = DateTime.Now;
            cate.ModifyBy      = UserManagement.UserSession.UserName;
            try
            {
                int Id = 0;
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    Id = uow.GroupPartBaseRepository.AddandGetRequestPaymentId(cate);
                    uow.Commit();
                }
                TreeTagPart treeTag = new TreeTagPart();
                treeTag.NodeTye        = TreeTagPart.Types.GroupPart;
                treeTag.GroupPartIDTag = Id;
                TreeNode node = new TreeNode(cate.GroupPartName);
                node.Tag = treeTag;
                if (AddNode != null)
                {
                    AddNode(node);
                }

                lblNotify1.SetText(UI.createsuccess, ToolBoxCS.LabelNotify.EnumStatus.Success);
                Close();
            }
            catch
            {
                lblNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
            }
        }
コード例 #28
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (!ValidationUtility.FieldNotAllowNull(this))
     {
         return;
     }
     Model.Bank bank = new Model.Bank();
     CoverObjectUtility.GetAutoBindingData(this, bank);
     //bank.BankCode = txtCode.Text;
     //bank.BankName = txtName.Text;
     //bank.Address = txtAddress.Text;
     //bank.Phone = txtPhone.Text;
     //bank.Fax = txtFax.Text;
     //bank.Email = txtEmail.Text;
     //bank.Note = txtNote.Text;
     bank.SetCreate();
     if (bank == null)
     {
         return;
     }
     try
     {
         using (IUnitOfWork uow = new UnitOfWork())
         {
             uow.BankBaseRepository.Add(bank);
             uow.Commit();
         }
         labelNotify1.SetText(UI.createsuccess, ToolBoxCS.LabelNotify.EnumStatus.Success);
         if (addnewBank != null)
         {
             addnewBank(bank, CRUD.Insert);
         }
         Close();
     }
     catch
     {
         labelNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
     }
 }
コード例 #29
0
ファイル: frmCreatePo.cs プロジェクト: quangphat/TmTech
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidationUtility.FieldNotAllowNull(this) == false)
            {
                return;
            }
            IList <QuotationDetail> lstProduct = gridControl1.DataSource as IList <QuotationDetail>;

            if (m_Po == null)
            {
                return;
            }
            if (lstProduct == null)
            {
                return;
            }
            CoverObjectUtility.GetAutoBindingData(this.tableLayoutPanel3, m_Po);
            try
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    uow.PoRepository.Add(m_Po);
                    uow.Commit();
                }
                isEdited = false;
                lblNotify1.SetText(UI.createsuccess, ToolBoxCS.LabelNotify.EnumStatus.Success);
                if (AddRow != null)
                {
                    m_Po.Quantity   = Convert.ToInt32(colQuantity.SummaryText);
                    m_Po.TotalValue = CurrencyUtility.ToDecimal(colThanhtien.SummaryText);
                    AddRow(m_Po, CRUD.Insert);
                }
                Close();
            }
            catch
            {
                lblNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed);
            }
        }
コード例 #30
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidationUtility.FieldNotAllowNull(this) == false)
            {
                return;
            }
            ProductLine line = new ProductLine();

            line.SerieId = m_Serie.SerieId;
            CoverObjectUtility.GetAutoBindingData(this, line);
            try
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    uow.ProductLineRepository.Add(line);
                    uow.Commit();
                }
                TreeTag tag = new TreeTag();

                tag.CateId    = m_Category.CategoryId;
                tag.CateName  = m_Category.CategoryName;
                tag.SerieId   = m_Serie.SerieId;
                tag.SerieName = m_Serie.SerieName;
                tag.LineId    = line.ProductLineId;
                tag.LineName  = line.ProductLineName;
                tag.NodeTye   = TreeTag.Types.Line;
                TreeNode node = new TreeNode(line.ProductLineName);
                node.Tag = tag;
                if (AddNode != null)
                {
                    AddNode(node);
                }
                this.Close();
            }
            catch
            {
            }
        }