示例#1
0
        private void FrmAddCompany_Load(object sender, EventArgs e)
        {
            if (_mode == 0) //add new
            {
                this.Text         = "Them moi doanh nghiep" + ConstantInfo.MESSAGE_TITLE + GlobalInfo.CompanyName;
                btnAdd.Enabled    = true;
                btnUpdate.Enabled = false;
            }

            if (_mode == 1) //update
            {
                btnAdd.Enabled    = false;
                btnUpdate.Enabled = true;

                this.Text = "Cap nhat doanh nghiep" + ConstantInfo.MESSAGE_TITLE + GlobalInfo.CompanyName;
                tblCompany company = CompanyFactory.FindByCode(_companyCode);
                if (company == null)
                {
                    MessageBox.Show("Doanh nghiệp này không còn tồn tại trong Cơ Sở Dữ Liệu. Bạn hãy kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                txtCompanyCode.ReadOnly = true;
                txtCompanyCode.Text     = company.CompanyCode;
                txtCompanyName.Text     = company.CompanyName;
                txtDescription.Text     = company.Description;
            }
        }
示例#2
0
        public CompanyVM GetByIdCompany(int id)
        {
            try
            {
                tblCompany company    = _companyRepository.GetById(id);
                CompanyVM  _CompanyVM = new CompanyVM();
                _CompanyVM.Address       = company.Address;
                _CompanyVM.BankAccountNo = company.BankAccountNo;
                _CompanyVM.BankIFSCNo    = company.BankIFSCNo;
                _CompanyVM.BankName      = company.BankName;
                _CompanyVM.City          = company.City;
                _CompanyVM.CompanyName   = company.CompanyName;
                _CompanyVM.CountryId     = company.CountryId;
                _CompanyVM.Email         = company.Email;
                _CompanyVM.FaxNo         = company.FaxNo;
                _CompanyVM.GSTIN         = company.GSTIN;
                _CompanyVM.IsActive      = company.IsActive;
                _CompanyVM.Logo          = company.Logo;
                _CompanyVM.MobileNo      = company.MobileNo;
                _CompanyVM.Password      = company.Password;
                _CompanyVM.PinCode       = company.PinCode;
                _CompanyVM.State         = company.State;
                _CompanyVM.TelephoneNo   = company.TelephoneNo;
                _CompanyVM.Website       = company.Website;

                if (company.Logo != null)
                {
                    _CompanyVM.LogoPath = string.Format("data:image/jpg;base64,{0}",
                                                        Convert.ToBase64String(company.Logo, 0, company.Logo.Length));
                }

                return(_CompanyVM);
            }
            catch (Exception e) { throw e; }
        }
示例#3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.grvCompany.SelectedRows.Count > 0)
                {
                    int selectedIndex = grvCompany.SelectedRows[0].Index;

                    // gets the RowID from the first column in the grid
                    var companyCode = grvCompany[0, selectedIndex].Value.ToString();

                    tblCompany company = CompanyFactory.FindByCode(companyCode);
                    if (company == null)
                    {
                        MessageBox.Show("Doanh nghiệp này không còn tồn tại trong Cơ Sở Dữ Liệu. Bạn hãy kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    FrmAddCompany frmAddCompany = new FrmAddCompany(companyCode, 1, _userInfo, this);
                    frmAddCompany.MdiParent = this.MdiParent;
                    frmAddCompany.Show();
                }
                else
                {
                    MessageBox.Show("Bạn cần chọn một bản ghi để cập nhật", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                if (GlobalInfo.IsDebug)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
示例#4
0
        public bool UpdateCompany(CompanyVM _CompanyVM)
        {
            try
            {
                tblCompany company = _companyRepository.GetById(_CompanyVM.CompanyId);

                company.Address       = _CompanyVM.Address;
                company.BankAccountNo = _CompanyVM.BankAccountNo;
                company.BankIFSCNo    = _CompanyVM.BankIFSCNo;
                company.BankName      = _CompanyVM.BankName;
                company.City          = _CompanyVM.City;
                company.CompanyName   = _CompanyVM.CompanyName;
                company.CountryId     = _CompanyVM.CountryId;
                company.Email         = _CompanyVM.Email;
                company.FaxNo         = _CompanyVM.FaxNo;
                company.GSTIN         = _CompanyVM.GSTIN;
                company.IsActive      = _CompanyVM.IsActive;
                company.Logo          = _CompanyVM.Logo;
                company.LogoPath      = _CompanyVM.LogoPath;
                company.MobileNo      = _CompanyVM.MobileNo;
                company.Password      = _CompanyVM.Password;
                company.PinCode       = _CompanyVM.PinCode;
                company.State         = _CompanyVM.State;
                company.TelephoneNo   = _CompanyVM.TelephoneNo;
                company.Website       = _CompanyVM.Website;

                _companyRepository.Update(company);
                _unitOfWork.Complete();
                return(true);
            }
            catch (Exception e) { throw e; }
        }
        public IHttpActionResult PuttblCompany(int id, tblCompany tblCompany)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tblCompany.Id)
            {
                return(BadRequest());
            }

            db.Entry(tblCompany).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tblCompanyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#6
0
文件: CompanyDAL.cs 项目: ewin66/RAPH
 public static Model.Reports.CompanyDetailReportModel GetCompanyDetailReportModel(long CompanyID)
 {
     using (dbVisionEntities db = new dbVisionEntities())
     {
         tblCompany r = db.tblCompanies.FirstOrDefault(r1 => r1.CompanyID == CompanyID);
         if (r == null)
         {
             return(null);
         }
         else
         {
             return(new CompanyDetailReportModel()
             {
                 CompanyID = r.CompanyID,
                 CompanyName = r.CompanyName,
                 Address = r.Address1,
                 CityID = r.CityID,
                 PIN = r.PIN,
                 Phone1 = r.Phone1,
                 MobileNo1 = r.MobileNo1,
                 EMailID = r.EMailID,
                 Website = r.Website,
                 BusinessStartedFrom = r.BusinessStartedFrom,
                 CityName = r.tblCity.CityName,
                 StateName = r.tblCity.tblState.StateName,
                 StateNameShort = r.tblCity.tblState.StateShortName ?? r.tblCity.tblState.StateName,
                 CountryName = r.tblCity.tblState.tblCountry.CountryName,
             });
         }
     }
 }
示例#7
0
 void Guncelle()
 {
     try
     {
         tblCompany com = _db.tblCompanies.First(x => x.ID == _firmaId);
         com.Address    = txtAdres.Text;
         com.Authorized = txtYetkili.Text;
         com.CityID     = _db.tblCities.First(x => x.City == cbSehir.Text).Id;
         com.CusSup     = cbFirmaTur.Text;
         com.Email      = txtemail.Text;
         com.Fax        = txtFaks.Text;
         com.Mobile     = txtGsm.Text;
         com.Name       = txtFadi.Text;
         com.Phone      = txtTel.Text;
         com.TaxNo      = txtVn.Text;
         com.TaxOffice  = txtVd.Text;
         _db.SubmitChanges();
         _m.Guncelle(true);
         Temizle();
     }
     catch (Exception e)
     {
         _m.Hata(e);
     }
 }
示例#8
0
        public bool UpdateCompany(CompanyVM companyVM)
        {
            using (var dbTransaction = unitOfWork.dbContext.Database.BeginTransaction())
            {
                try
                {
                    tblCompany company = unitOfWork.TblCompanyRepository.GetByID(companyVM.CompanyID);
                    company.CompanyName  = companyVM.CompanyName;
                    company.IsActive     = companyVM.IsActive;
                    company.ModifiedDate = DateTime.Now;
                    company.ModifiedBy   = companyVM.ModifiedBy;
                    unitOfWork.TblCompanyRepository.Update(company);
                    unitOfWork.Save();

                    //Complete the Transaction
                    dbTransaction.Commit();
                    return(true);
                }
                catch (Exception ex)
                {
                    //Roll back the Transaction
                    dbTransaction.Rollback();
                    return(false);
                }
            }
        }
示例#9
0
 void Ac(int id)
 {
     try
     {
         edit     = true;
         _firmaId = id;
         tblCompany com = _db.tblCompanies.First(s => s.ID == _firmaId);
         txtAdres.Text   = com.Address;
         txtBolge.Text   = com.tblCity.Territory;
         txtemail.Text   = com.Email;
         txtFadi.Text    = com.Name;
         txtFaks.Text    = com.Fax;
         txtFirmaNo.Text = com.CompNo.ToString().PadLeft(7, '0');
         txtGsm.Text     = com.Mobile;
         txtTel.Text     = com.Phone;
         txtVd.Text      = com.TaxOffice;
         txtVn.Text      = com.TaxNo;
         txtYetkili.Text = com.Authorized;
         cbFirmaTur.Text = com.CusSup;
         cbSehir.Text    = com.tblCity.City;
     }
     catch (Exception e)
     {
         _m.Hata(e);
     }
 }
示例#10
0
        void YeniKaydet()
        {
            try
            {
                tblCompany com = new tblCompany();
                com.Address    = txtAdres.Text;
                com.Authorized = txtYetkili.Text;
                com.CityID     = _db.tblCities.First(x => x.City == cbSehir.Text).Id;
                com.CompNo     = int.Parse(txtFirmaNo.Text);
                com.CusSup     = cbFirmaTur.Text;
                com.Email      = txtemail.Text;
                com.Fax        = txtFaks.Text;
                com.Mobile     = txtGsm.Text;
                com.Name       = txtFadi.Text;
                com.Phone      = txtTel.Text;
                com.TaxNo      = txtVn.Text;
                com.TaxOffice  = txtVd.Text;

                _db.tblCompanies.InsertOnSubmit(com);
                _db.SubmitChanges();
                _m.YeniKayit("Kayıt başarıyla gerçekleşti.");
                Temizle();
            }
            catch (Exception e)
            {
                _m.Hata(e);
            }
        }
示例#11
0
 public CompanyViewModel GetFirstCompanyDetail()
 {
     using (dbUltraCoralEntities db = new dbUltraCoralEntities())
     {
         tblCompany SaveModel = db.tblCompanies.FirstOrDefault();
         if (SaveModel == null)
         {
             return(null);
         }
         return(new CompanyViewModel()
         {
             CompanyID = SaveModel.CompanyID,
             CompanyName = SaveModel.CompanyName,
             Address = SaveModel.Address,
             PhoneNo = SaveModel.PhoneNo,
             FaxNo = SaveModel.FaxNo,
             EMailID = SaveModel.EMailID,
             Website = SaveModel.Website,
             Slogan = SaveModel.Slogan,
             noreplyEmailID = SaveModel.noreplyEmailID,
             noreplyPassword = SaveModel.noreplyEmailIDPassword,
             noreplyOutgoingSMTPServerName = SaveModel.noreplyOutgoingSMTPServerName,
             noreplyOutgoingSMTPPortNo = SaveModel.noreplyOutgoingSMTPPort
         });
     }
 }
 public ActionResult AddCompany(VMCompany VMcompany)
 {
     try
     {
         if (ModelState.IsValid)
         {
             tblUser user = Session[WebUtil.CURRENT_USER] as tblUser;
             if (!(user != null))
             {
                 return(RedirectToAction("RedirectToLogin", "user"));
             }
             tblCompany Table = (VMcompany).TotblCompany();
             Table.CreatedBy   = user.Id;
             Table.CreatedDate = DateTime.Now;
             new CompanyHandler().AddCompany(Table);
             return(JavaScript("showMessage('success', 'Company added Successfully','bottom-right','Company', 'Manage')"));
         }
         else
         {
             return(JavaScript("showMessage('error', 'All fields are required, Please try again','bottom-right','Company', 'Manage')"));
         }
     }
     catch (Exception ex)
     {
         return(JavaScript("showMessage('error', 'Failed to Add Company, Please Contact to Administrator','bottom-right','Company', 'Manage')"));
     }
 }
示例#13
0
        public static int Update(tblCompany companyObj)
        {
            var db = new dbTrainEntities(ConnectionController.GetConnection());

            tblCompany originCompany = db.tblCompanies.Where(g => g.CompanyCode == companyObj.CompanyCode).FirstOrDefault();

            if (originCompany == null)
            {
                return(-1);
            }

            originCompany.CompanyName  = companyObj.CompanyName;
            originCompany.Description  = companyObj.Description;
            originCompany.ModifiedBy   = companyObj.ModifiedBy;
            originCompany.ModifiedDate = CommonFactory.GetCurrentDate();

            try
            {
                return(db.SaveChanges());
            }
            catch (Exception ex)
            {
                return(-1);
            }
        }
示例#14
0
    public IList <string> GetCompanyName(int CompanyID)
    {
        var            DC      = new DataClassesDataContext();
        tblCompany     company = DC.tblCompanies.SingleOrDefault(ob => ob.CompanyID == CompanyID);
        IList <string> Data    = new string[] { company.Name, company.ProfilePic };

        return(Data);
    }
        public void UpdateCompany(long id, tblCompany company)
        {
            using (OriginatorEntities db = new OriginatorEntities())
            {
                tblCompany found = db.tblCompanies.Find(id);
                if (!string.IsNullOrWhiteSpace(company.Name))
                {
                    found.Name = company.Name;
                }
                if (!string.IsNullOrWhiteSpace(company.Street))
                {
                    found.Street = company.Street;
                }
                if (!string.IsNullOrWhiteSpace(company.City))
                {
                    found.City = company.City;
                }
                if (!string.IsNullOrWhiteSpace(company.Country))
                {
                    found.Country = company.Country;
                }
                if (!string.IsNullOrWhiteSpace(company.Landline))
                {
                    found.Landline = company.Landline;
                }
                if (!string.IsNullOrWhiteSpace(company.Mobile))
                {
                    found.Mobile = company.Mobile;
                }
                if (!string.IsNullOrWhiteSpace(company.FaxNo))
                {
                    found.FaxNo = company.FaxNo;
                }
                if (!string.IsNullOrWhiteSpace(company.Website))
                {
                    found.Website = company.Website;
                }
                if (!string.IsNullOrWhiteSpace(company.NTN.ToString()))
                {
                    found.NTN = company.NTN;
                }
                if (!string.IsNullOrWhiteSpace(company.STN.ToString()))
                {
                    found.STN = company.STN;
                }
                if (company.ModifiedBy != null && company.ModifiedBy > 0)
                {
                    found.ModifiedBy = company.ModifiedBy;
                }
                if (!string.IsNullOrWhiteSpace(company.ModifiedDate.ToString()))
                {
                    found.ModifiedDate = company.ModifiedDate;
                }

                db.SaveChanges();
            }
        }
示例#16
0
        public static int Insert(tblCompany company)
        {
            var db = new dbTrainEntities(ConnectionController.GetConnection());

            company.CreatedDate  = CommonFactory.GetCurrentDate();
            company.ModifiedDate = CommonFactory.GetCurrentDate();
            db.AddTotblCompanies(company);
            return(db.SaveChanges());
        }
示例#17
0
        public IHttpActionResult GettblCompany(int id)
        {
            tblCompany tblCompany = db.tblCompanies.Find(id);

            if (tblCompany == null)
            {
                return(NotFound());
            }

            return(Ok(tblCompany));
        }
 public void DeleteCompany(long Id, long DeletedBy)
 {
     using (OriginatorEntities db = new OriginatorEntities())
     {
         tblCompany found = db.tblCompanies.Find(Id);
         found.DeletedBy   = DeletedBy;
         found.DeletedDate = DateTime.Now;
         found.IsDeleted   = true;
         db.SaveChanges();
     }
 }
示例#19
0
        public IHttpActionResult PosttblCompany(tblCompany tblCompany)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tblCompanies.Add(tblCompany);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = tblCompany.Id }, tblCompany));
        }
示例#20
0
        public IHttpActionResult DeletetblCompany(int id)
        {
            tblCompany tblCompany = db.tblCompanies.Find(id);

            if (tblCompany == null)
            {
                return(NotFound());
            }

            db.tblCompanies.Remove(tblCompany);
            db.SaveChanges();

            return(Ok(tblCompany));
        }
示例#21
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.grvCompany.SelectedRows.Count > 0)
                {
                    DialogResult result = MessageBox.Show("Bạn thự sự muốn xóa doanh nghiệp đã chọn?", "Cảnh báo!", MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes)
                    {
                        int selectedIndex = grvCompany.SelectedRows[0].Index;

                        // gets the RowID from the first column in the grid
                        var companyCode = grvCompany[0, selectedIndex].Value.ToString();

                        tblCompany company = CompanyFactory.FindByCode(companyCode);
                        if (company == null)
                        {
                            MessageBox.Show("Loại hình này không còn tồn tại trong Cơ Sở Dữ Liệu. Bạn hãy kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        if (CompanyFactory.Delete(companyCode) > 0)
                        {
                            search();
                            MessageBox.Show("Xóa doanh nghiệp thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            search();
                            MessageBox.Show("Xóa doanh nghiệp không thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("Bạn cần chọn một bản ghi để xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                if (GlobalInfo.IsDebug)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
示例#22
0
文件: CompanyDAL.cs 项目: ewin66/RAPH
 public CompanyDetailViewModel GetCompanyDetail(long CompanyID)
 {
     using (dbVisionEntities db = new dbVisionEntities())
     {
         tblCompany r = db.tblCompanies.FirstOrDefault(r1 => r1.CompanyID == CompanyID);
         if (r == null)
         {
             return(null);
         }
         else
         {
             return(ConvertToDetailViewModel(r));
         }
     }
 }
示例#23
0
    public void ChangeActivation(int ID, string TableName)
    {
        var DC = new DataClassesDataContext();

        if (TableName == "tblCompany")
        {
            tblCompany result = (from u in DC.tblCompanies
                                 where u.CompanyID == ID
                                 select u).Single();
            if (result.IsActive)
            {
                result.IsActive = false;
            }
            else
            {
                result.IsActive = true;
            }
        }
        if (TableName == "tblAdmin")
        {
            tblAdmin result = (from u in DC.tblAdmins
                               where u.AdminID == ID
                               select u).Single();
            if (result.IsActive)
            {
                result.IsActive = false;
            }
            else
            {
                result.IsActive = true;
            }
        }
        if (TableName == "tblDesignation")
        {
            tblDesignation result = (from u in DC.tblDesignations
                                     where u.DesignationID == ID
                                     select u).Single();
            if (result.IsDeleted)
            {
                result.IsDeleted = false;
            }
            else
            {
                result.IsDeleted = true;
            }
        }
        DC.SubmitChanges();
    }
示例#24
0
        public static tblCompany TotblCompany(this VMCompany model)
        {
            tblCompany table = new tblCompany();

            table.Name     = model.Name;
            table.Street   = model.Street;
            table.City     = model.City;
            table.Country  = model.Country;
            table.Landline = model.Landline;
            table.Mobile   = model.Mobile;
            table.FaxNo    = model.FaxNo;
            table.Website  = model.Website;
            table.NTN      = model.NTN;
            table.STN      = model.STN;
            return(table);
        }
示例#25
0
        public static VMCompany ToVMCompany(this tblCompany entity)
        {
            VMCompany model = new VMCompany();

            model.Id       = entity.Id;
            model.Name     = entity.Name;
            model.Street   = entity.Street;
            model.City     = entity.City;
            model.Country  = entity.Country;
            model.Landline = entity.Landline;
            model.Mobile   = entity.Mobile;
            model.FaxNo    = entity.FaxNo;
            model.Website  = entity.Website;
            //model.NTN = (long)entity.NTN;
            //model.STN = (long)entity.STN;
            return(model);
        }
 public void AddCompany(tblCompany company)
 {
     using (OriginatorEntities db = new OriginatorEntities())
     {
         db.tblCompanies.Add(company);
         db.SaveChanges();
         tblAccount Account = new tblAccount {
             AccountName = "Initial Cash", CompanyId = company.Id, Description = "Initial Cash Account", Source = "Cash", CreatedDate = DateTime.Now, CreatedBy = company.CreatedBy
         };
         db.tblAccounts.Add(Account);
         db.SaveChanges();
         tblSubAccount SubAccount = new tblSubAccount {
             SubAccountName = "Initial Cash", Description = "Initial Cash SubAccount", Amount = 0, AccountId = Account.Id, AccountNumber = "Initial Cash " + company.Name, CompanyId = company.Id, CreatedBy = company.CreatedBy, CreatedDate = DateTime.Now, TypeId = 8
         };
         db.tblSubAccounts.Add(SubAccount);
         db.SaveChanges();
     }
 }
示例#27
0
文件: frmCompany.cs 项目: ewin66/RAPH
        public override void DeleteRecord(DeletingParameter Paras)
        {
            int        CompanyID = ((CompanyEditListModel)EditRecordDataSource).CompanyID;
            tblCompany SaveModel = DALObject.FindSaveModelByPrimeKey(CompanyID);

            if (SaveModel != null && SaveModel.CompanyLogoFileName != null)
            {
                try
                {
                    File.Delete(SaveModel.CompanyLogoFileName);
                }
                catch (Exception) { }
            }
            //--
            Paras.DeletingResult = DALObject.DeleteRecord(CompanyID);
            //--
            base.DeleteRecord(Paras);
        }
示例#28
0
        private bool validate()
        {
            bool valid = true;

            if (_mode == 0)//add new
            {
                if (String.IsNullOrEmpty(txtCompanyCode.Text.Trim()))
                {
                    valid = false;
                    MessageBox.Show("Mã doanh nghiệp không được để trống", "Dữ liệu không hợp lệ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtCompanyCode.Focus();
                }
                else if (null != CompanyFactory.FindByCode(txtCompanyCode.Text.Trim()))
                {
                    valid = false;
                    MessageBox.Show("Mã doanh nghiệp này đã tồn tại, hãy thử với mã khác", "Dữ liệu không hợp lệ", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    txtCompanyCode.Focus();
                }

                if (String.IsNullOrEmpty(txtCompanyName.Text.Trim()))
                {
                    valid = false;
                    MessageBox.Show("Tên doanh nghiệp không được để trống", "Dữ liệu không hợp lệ", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    txtCompanyName.Focus();
                }
            }
            if (_mode == 1) //update
            {
                tblCompany company = CompanyFactory.FindByCode(_companyCode);
                if (company == null)
                {
                    valid = false;
                    MessageBox.Show("Doanh nghiệp này không còn tồn tại trong Cơ Sở Dữ Liệu. Bạn hãy kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (String.IsNullOrEmpty(txtCompanyName.Text.Trim()))
                {
                    valid = false;
                    MessageBox.Show("Tên doanh nghiệp không được để trống", "Dữ liệu không hợp lệ", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    txtCompanyName.Focus();
                }
            }
            return(valid);
        }
示例#29
0
        protected void BindingCombox()
        {
            List <tblCompany> companyObjList;
            GetInfo           bllGetInfo = new GetInfo();

            companyObjList = bllGetInfo.GetCompany();
            if (companyObjList != null && companyObjList.Count > 0)
            {
                tblCompany companyObj = new tblCompany();
                companyObj.CompName  = "N/A";
                companyObj.CompanyID = "N/A";
                companyObjList.Add(companyObj);
                rcomCompany.DataSource     = companyObjList;
                rcomCompany.DataTextField  = "CompName";
                rcomCompany.DataValueField = "CompanyID";
                rcomCompany.DataBind();

                rcomCompany.SelectedValue = "N/A";
            }
        }
示例#30
0
        private void grvCompany_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (_userInfo.UserPermission.Contains(ConstantInfo.PERMISSON_QUAN_LY_THONG_TIN_DOANH_NGHIEP) == false)
            {
                return;
            }

            try
            {
                if (this.grvCompany.SelectedRows.Count > 0)
                {
                    int selectedIndex = grvCompany.SelectedRows[0].Index;

                    // gets the RowID from the first column in the grid
                    var companyCode = grvCompany[0, selectedIndex].Value.ToString();

                    tblCompany company = CompanyFactory.FindByCode(companyCode);
                    if (company == null)
                    {
                        MessageBox.Show("Doanh nghiệp này không còn tồn tại trong Cơ Sở Dữ Liệu. Bạn hãy kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }


                    FrmAddCompany frmAddCompany = new FrmAddCompany(companyCode, 1, _userInfo, this);
                    frmAddCompany.MdiParent = this.MdiParent;
                    frmAddCompany.Show();
                }
                else
                {
                    MessageBox.Show("Bạn cần chọn một bản ghi để cập nhật", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                if (GlobalInfo.IsDebug)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
 public static tblCompany CreatetblCompany(string companyCode, string branchId)
 {
     tblCompany tblCompany = new tblCompany();
     tblCompany.CompanyCode = companyCode;
     tblCompany.BranchId = branchId;
     return tblCompany;
 }
 public void AddTotblCompanies(tblCompany tblCompany)
 {
     AddObject("tblCompanies", tblCompany);
 }