public AddNewCompany(long srNo, UniEnums.CompanyType companyType) { InitializeComponent(); _companyType = companyType; _company = _uniDb.CustomerDetails.Single(x => x.SrNo == srNo && x.CompanyType == _companyType.ToString()); }
public AddNewCompany(UniEnums.CompanyType companyType) { InitializeComponent(); _companyType = companyType; _company = new CustomerDetail() { ProcessedDate = DateTime.Now.Date, CompanyType = _companyType.ToString() }; }
private void buttonSave_Click(object sender, EventArgs e) { if (!ValidateForm()) return; _company.CompanyName = txtCompanyName.Text; _company.OfficeAddress = txtOfficeAddress.Text; _company.FactoryAddress = txtFactoryAddress.Text; _company.ContactPerson = txtContactPerson.Text; _company.PhoneNo = txtPhoneNo.Text; _company.MobileNo = txtMobileNo.Text; _company.BusinessType = cmbBusinessType.Text; _company.Sector = cmbSector.Text; _company.Expert = cmbExpert.Text; _company.AnnualTurnover = txtAnnualTurnover.Text; _company.EstablishedYear = string.IsNullOrEmpty(txtEstablishedYear.Text) ? 0 : Convert.ToInt32(txtEstablishedYear.Text); _company.NoOfEmployees = string.IsNullOrEmpty(txtNoOfEmployee.Text) ? 0 : Convert.ToInt32(txtNoOfEmployee.Text); _company.Website = txtWebsite.Text; _company.Email = txtEmail.Text; _company.Source = cmbSource.Text; _company.ExecutiveName = HomePage.UserDetail.UserId; _company.ModifiedDateTime = DateTime.Now; _company.ProcessedDate = dtpProcessedDate.Value; _company.Networking = cbNetworking.Checked; var targetPath = string.Format("{0}/{1}/{2}", ConfigurationSettings.AppSettings["CvUploadLocation"], "Client", _company.CompanyName); _company.Note = txtNote.Text; _company.Profile1 = CommanFuction.SaveFile(txtProfile1.Text, targetPath); _company.Profile2 = CommanFuction.SaveFile(txtProfile2.Text, targetPath); // for save if (_company.SrNo < 1) { var maxId = _uniDb.CustomerDetails.Any() ? _uniDb.CustomerDetails.Where(c => c.CompanyType == _companyType.ToString()).Max(c => c.SrNo) : 0; _company.SrNo = maxId + 1; _uniDb.CustomerDetails.InsertOnSubmit(_company); _uniDb.SubmitChanges(); _company = new CustomerDetail() { ProcessedDate = DateTime.Now.Date, CompanyType = _companyType.ToString() }; ResetCompany(); return; } // for update _uniDb.SubmitChanges(); ResetCompany(); Close(); }
partial void DeleteCustomerDetail(CustomerDetail instance);
partial void UpdateCustomerDetail(CustomerDetail instance);
partial void InsertCustomerDetail(CustomerDetail instance);