Exemple #1
0
 private void ReadData(Company company)
 {
     txtCompanyCode.Text            = company.CompanyCode;
     txtCompanyName.Text            = company.CompanyName;
     cboTypeOfCompany.SelectedValue = company.TypeId;
     txtAddress.Text         = company.Address;
     txtAccountant.Text      = company.Accountant;
     txtPhoneAccountant.Text = company.AccountantPhone;
     txtSwich.Text           = company.SwiftCode;
     txtTaxCode.Text         = company.Taxcode;
     txtNoBrach.Text         = company.Branch.ToString();
     txtStaft.Text           = company.NumberOfEmployee.IntToString();
     txtNote.Text            = company.Note;
     txtAcountBank.Text      = company.BankName;
     txtNumberBank.Text      = company.BankAccount;
     PictureUtility.BindImage(PictureSgnature, company.Photo);
     PictureUtility.BindImage(PictureLogo, company.PictureLogo);
     if (company.MainDeputy != null)
     {
         txtNameContact.Text = company.MainDeputy.DeputyName;
         txtPhone.Text       = company.MainDeputy.Phone;
         txtEmail.Text       = company.MainDeputy.Email;
         cbSex.SelectedValue = company.MainDeputy.Sex;
     }
     if (company.Class != null)
     {
         cbClassCustormer.SelectedValue = company.Class.CompanyClassId;
     }
 }
Exemple #2
0
 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);
     }
 }
        private void gridView2_RowClick(object sender, RowClickEventArgs e)
        {
            gridutility.SetRowColor();
            int currentIndex = gridView2.GetSelectedRows().FirstOrDefault();

            if (selectindex == currentIndex)
            {
                return;
            }
            try
            {
                var imagePath = gridView2.GetRowCellValue(gridView2.FocusedRowHandle, gridView2.Columns["Material.PhotoPath"]);
                if (imagePath != null)
                {
                    PictureUtility.BindImage(ptPhoto, gridView2.GetRowCellValue(gridView2.FocusedRowHandle, gridView2.Columns["Material.PhotoPath"]).ToString());
                    selectindex = currentIndex;
                }
                else
                {
                    label6.Hide();
                }
            }
            catch (Exception)
            {
                return;
            }
        }
Exemple #4
0
        void DisplayInformation(TreeNode nodeInformation)
        {
            TreeTagPart treetag = nodeInformation.Tag as TreeTagPart;

            if (treetag == null)
            {
                return;
            }
            if (treetag.NodeTye != TreeTagPart.Types.Part)
            {
                return;
            }
            Part selectPart;

            Model.Sourcing selectSouring;
            txtPricePart.ReadOnly   = true;
            txtNamePart.ReadOnly    = true;
            txtDescription.ReadOnly = true;
            cboSupplier.Enabled     = false;



            using (IUnitOfWork uow = new UnitOfWork())
            {
                selectPart    = uow.PartBaseRepository.Find(treetag.PartIDTag);
                selectSouring = uow.SourcingBaseRepository.FindPartByIDPart(treetag.PartIDTag);
                uow.Commit();
            }
            if (selectPart == null)
            {
                return;
            }
            if (selectSouring == null)
            {
                return;
            }



            txtNamePart.Text          = selectPart.PartName;
            txtPricePart.Text         = (selectPart.Pricespart) > 0 ? selectPart.Pricespart.ToString() : "0";
            txtDescription.Text       = selectPart.Description;
            cboSupplier.SelectedValue = selectSouring.SupplierID;
            currentSelecSupplier      = selectSouring.SupplierID;

            txtNamePart.Focus();
            txtNumberPart.Text      = selectPart.PartNumber;
            txtDescription.ReadOnly = true;
            lbTitle.Text            = "Information detail sourcing";
            PictureUtility.BindImage(PictureImage, selectPart.ImagePath);

            if (selectPart.ImagePath != null)
            {
                currentImagePath = selectPart.ImagePath;
            }
            txtNumberPart.ReadOnly = true;
            treeView1.Select();
        }
Exemple #5
0
 private void ShowSelect(int index, PictureBox smallPictureBox)
 {
     if (ImgList == null)
     {
         return;
     }
     if (index < 0 || index > 4)
     {
         return;
     }
     PictureUtility.BindImage(ptbMain, ImgList[index]);
     //ptb0.BorderStyle = ptb1.BorderStyle = ptb2.BorderStyle = ptb3.BorderStyle = ptb4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     //smallPictureBox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
 }
Exemple #6
0
 public void Show(string[] imglst)
 {
     ImgList = imglst;
     if (ImgList == null)
     {
         return;
     }
     PictureUtility.BindImage(ptbMain, ImgList[0]);
     PictureUtility.BindImage(ptb0, ImgList[0]);
     PictureUtility.BindImage(ptb1, ImgList[1]);
     PictureUtility.BindImage(ptb2, ImgList[2]);
     PictureUtility.BindImage(ptb3, ImgList[3]);
     PictureUtility.BindImage(ptb4, ImgList[4]);
 }
Exemple #7
0
        private void frmEditCustomer_Load(object sender, EventArgs e)
        {
            using (IUnitOfWork uow = new UnitOfWork())
            {
                _objEditCompany = uow.CompanyRepository.Find(_objEditCompany.CompanyId);
                uow.Commit();
            }
            cbSex.SelectedIndex = 0;

            txtCompanyCode.Text            = _objEditCompany.CompanyCode;
            txtCompanyName.Text            = _objEditCompany.CompanyName;
            txtTaxCode.Text                = _objEditCompany.Taxcode;
            txtAddree.Text                 = _objEditCompany.Address;
            txtSwich.Text                  = _objEditCompany.SwiftCode;
            txtNoBrach.Text                = (_objEditCompany.Branch != 0) ? _objEditCompany.Branch.ToString() : string.Empty;
            txtStaft.Text                  = (_objEditCompany.NumberOfEmployee != null) ? _objEditCompany.Branch.ToString() : string.Empty;
            txtWebsite.Text                = _objEditCompany.Website;
            txtNote.Text                   = _objEditCompany.Note;
            txtTargertValue.Text           = (_objEditCompany.TagetValue != 0) ? _objEditCompany.TagetValue.ToString() : string.Empty;
            cbClassCustormer.SelectedValue = _objEditCompany.ClassId;
            PictureUtility.BindImage(PictureSgnature, _objEditCompany.Photo);
            PictureUtility.BindImage(PictureLogo, _objEditCompany.PictureLogo);
            txtAccount.Text = _objEditCompany.Accountant;
            txtAccount.Text = _objEditCompany.AccountantPhone;
            using (IUnitOfWork uow = new UnitOfWork())
            {
                _objMain = uow.DeputyRepository.FindMainDeputy(_objEditCompany.CompanyId);
            }
            Users  user    = UtilityFunction.GetUser(_objMain);
            string account = user != null ? user.UserName : "";

            using (IUnitOfWork uow = new UnitOfWork())
            {
                userEdit = uow.UsersRepository.IsExist(account);
            }
            if (_objMain == null)
            {
                return;
            }
            txtNameContact.Text = _objMain.DeputyName;
            txtEmail.Text       = _objMain.Email;
            txtPhone.Text       = _objMain.Phone;
            cbSex.SelectedIndex = _objMain.Sex ? 0 : 1;
            if (userEdit == null)
            {
                return;
            }
            txtAccount.Text = userEdit.UserName;
        }
Exemple #8
0
        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            TreeTagPart treetag = treeView1.SelectedNode.Tag as TreeTagPart;
            Part        selectPart;

            Model.Sourcing selectSouring;
            using (IUnitOfWork uow = new UnitOfWork())
            {
                selectPart    = uow.PartBaseRepository.Find(treetag.PartIDTag);
                selectSouring = uow.SourcingBaseRepository.FindPartByIDPart(treetag.PartIDTag);
                uow.Commit();
            }
            if (selectPart == null)
            {
                return;
            }
            if (selectSouring == null)
            {
                return;
            }

            txtNumberPart.Text       = selectPart.PartNumber;
            txtNamePart.Text         = selectPart.PartName;
            txtPricePart.Text        = (selectPart.Pricespart) > 0 ? selectPart.Pricespart.ToString() : "0";
            txtDescription.Text      = selectPart.Description;
            cboSupplier.SelectedItem = selectPart.SeriesPartID;
            lbTitle.Text             = "update sourcing";
            isUpdatePart             = selectPart;
            isSourcing = selectSouring;
            isInsert   = false;
            isUpdate   = true;

            objBackUp = new PartBackUp();

            objBackUp.PartName    = txtNamePart.Text;
            objBackUp.Description = txtDescription.Text;
            objBackUp.PartName    = txtNumberPart.Text;
            objBackUp.Pricespart  = txtPricePart.Text != string.Empty ? decimal.Parse(txtPricePart.Text) : 0;
            objBackUp.ImagePath   = currentImagePath;
            PictureUtility.BindImage(PictureImage, selectPart.ImagePath);
            txtNumberPart.ReadOnly  = true;
            txtPricePart.ReadOnly   = false;
            txtNamePart.ReadOnly    = false;
            txtDescription.ReadOnly = false;
            cboSupplier.Enabled     = true;
            mainUpdate = treetag;
            txtDescription.ReadOnly = false;
        }
        private void gridView2_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            Staff staff = gridUtility2.GetSelectedItem <Staff>();

            if (staff == null)
            {
                return;
            }

            PictureUtility.BindImage(ptAvatar, staff.Avatar);
            PictureUtility.BindImage(ptSignature, staff.SignaturePhoto);
            txtCreatedBy.Text = staff.CreateBy;

            txtCreatedDate.Text = staff.CreateDate != null?UtilityFunction.DateTimeToString(staff.CreateDate.Value) : "";

            txtModifiedBy.Text   = staff.ModifyBy;
            txtModifiedDate.Text = staff.ModifyDate != null?UtilityFunction.DateTimeToString((DateTime)staff.ModifyDate) : "";
        }
Exemple #10
0
        private void createSourcingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeTagPart treetag = treeView1.SelectedNode.Tag as TreeTagPart;

            mainCreate = treetag;
            if (treetag != null)
            {
                isCreateNew.SeriesPartID = treetag.SeriesPartIDTag;
            }
            txtNamePart.Tag = txtNamePart.Text;
            objBackUp       = new PartBackUp();

            objBackUp.PartName    = txtNamePart.Text;
            objBackUp.Description = txtDescription.Text;
            objBackUp.PartName    = txtNumberPart.Text;
            objBackUp.Pricespart  = txtPricePart.Text != string.Empty ? decimal.Parse(txtPricePart.Text) : 0;
            objBackUp.ImagePath   = PictureImage.Tag != null?PictureImage.Tag.ToString() : null;

            objBackUp.ImagePath = currentImagePath;


            PictureUtility.BindImage(PictureImage, "@32121");

            txtNamePart.Text          = string.Empty;
            txtDescription.Text       = string.Empty;
            txtNumberPart.Text        = string.Empty;
            txtPricePart.Text         = string.Empty;
            PictureImage.InitialImage = null;
            ComboboxUtility.BindSupplier(cboSupplier);
            lbTitle.Text            = "Create new sourcing";
            isInsert                = true;
            isUpdate                = false;
            txtPricePart.ReadOnly   = false;
            txtNamePart.ReadOnly    = false;
            txtDescription.ReadOnly = false;
            cboSupplier.Enabled     = true;
            txtNumberPart.ReadOnly  = false;
        }
Exemple #11
0
        private void bootstrapButton2_Click(object sender, EventArgs e)
        {
            if (isInsert == false && isUpdate == false)
            {
                if (objBackUp != null)
                {
                    txtNamePart.Text    = objBackUp.PartName;
                    txtDescription.Text = objBackUp.Description;
                    txtNumberPart.Text  = objBackUp.PartName;
                    txtPricePart.Text   = objBackUp.Pricespart > 0 ? objBackUp.Pricespart.ToString() : string.Empty;
                    PictureImage.Image  = objBackUp.ImageBackUp;
                    PictureUtility.BindImage(PictureImage, objBackUp.ImagePath);
                    cboSupplier.SelectedValue = currentSelecSupplier;
                    currentSelecSupplier      = -1;
                    objBackUp = null;
                }

                txtNamePart.ReadOnly = txtDescription.ReadOnly = txtNumberPart.ReadOnly = txtPricePart.ReadOnly = true;
                treeView1.Select();

                return;
            }

            DialogResult result = FormUtility.MscWarming();

            if (result == DialogResult.Yes)
            {
                if (objBackUp != null)
                {
                    txtNamePart.Text    = objBackUp.PartName;
                    txtDescription.Text = objBackUp.Description;
                    txtNumberPart.Text  = objBackUp.PartName;
                    txtPricePart.Text   = objBackUp.Pricespart > 0 ? objBackUp.Pricespart.ToString() : string.Empty;
                    PictureUtility.BindImage(PictureImage, objBackUp.ImagePath);
                    cboSupplier.SelectedValue = currentSelecSupplier;
                    currentSelecSupplier      = -1;
                    objBackUp = null;
                }

                txtNamePart.ReadOnly = txtDescription.ReadOnly = txtNumberPart.ReadOnly = txtPricePart.ReadOnly = true;

                if (isInsert == true || isUpdate == true)
                {
                    TreeNode nodeSelect = treeView1.SelectedNode;

                    DisplayInformation(nodeSelect);
                    isInsert = false;
                    isUpdate = false;
                }
                else
                {
                    TreeNode nodeSelect = treeView1.SelectedNode;

                    DisplayInformation(nodeSelect);
                }
            }
            else
            {
                return;
            }
        }