public CustomerEdit(VisitaJayaPerkasa.Entities.Customer customer) { InitializeComponent(); this.customer = customer; if (customer == null) { wantToCreateVessel = true; listCustomerDetail = new List<Entities.CustomerDetail>(); } else { wantToCreateVessel = false; etCustomerName.Text = customer.CustomerName; etOffice.Text = customer.Office; etAddress.Text = customer.Address; etEmail.Text = customer.Email; etPhone.Text = customer.Phone; etFax.Text = customer.Fax; etContactPerson.Text = customer.ContactPerson; chkStatusPPN.Checked = Convert.ToBoolean(customer.StatusPPN); SqlCustomerRepository sqlCustomerRepository = new SqlCustomerRepository(); listCustomerDetail = sqlCustomerRepository.ListCustomerDetail(customer.ID); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); else if (listCustomerDetail != null) CustomerDetailGridView.DataSource = listCustomerDetail; else listCustomerDetail = new List<VisitaJayaPerkasa.Entities.CustomerDetail>(); sqlCustomerRepository = null; } }
public SearchCustomer() { InitializeComponent(); SqlCustomerRepository sqlCustomerRepository = new SqlCustomerRepository(); listCustomer = sqlCustomerRepository.listCustomerForPriceList(); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) { MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } CustomerGridView.DataSource = listCustomer; sqlCustomerRepository = null; }
public newLeadTime(Surat objSurat, rptLeadTimeControl objParent) { InitializeComponent(); this.objParent = objParent; sqlCustomerRepository = new SqlCustomerRepository(); List<Customer> listCustomer = sqlCustomerRepository.listCustomerForPriceList(); cboCustomer.DataSource = listCustomer; cboCustomer.DisplayMember = "CustomerName"; cboCustomer.ValueMember = "ID"; if (objSurat == null) { surat = new Surat(); sqlSuratRepository = new SqlSuratRepository(); isCreateNew = true; Surat tempSurat = sqlSuratRepository.GetlastNoSurat(EnumSurat.LeadTime); String strTempNoSurat = (tempSurat == null) ? "0" : tempSurat.NoSurat.Substring(0, 4); etNoSurat.Text = surat.GenerateNoSurat(Int32.Parse(strTempNoSurat), EnumSurat.LeadTime); listCustomer = null; tempSurat = null; strTempNoSurat = null; sqlSuratRepository = null; } else { isCreateNew = false; surat = objSurat; etNoSurat.Text = objSurat.NoSurat; radDateTimePicker1.Value = objSurat.Tgl; cboCustomer.SelectedValue = objSurat.CustomerID; } sqlCustomerRepository = null; }
public RptDeliveryControl() { InitializeComponent(); sqlCustomerRepository = new SqlCustomerRepository(); sqlCustomerTransRepository = new SqlCustomerTransRepository(); DateTime datetime = DateTime.Now; cboMonth.SelectedIndex = datetime.Month-1; spnYear.Value = datetime.Year; cboMonth.SelectedIndex = datetime.Month - 1; spnYear.Value = datetime.Year; List<VisitaJayaPerkasa.Entities.Customer> listCustomer = sqlCustomerRepository.ListCustomers(); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cboCustomer.DataSource = listCustomer; cboCustomer.DisplayMember = "CustomerName"; cboCustomer.ValueMember = "ID"; cboCustomer.SelectedIndex = -1; cboCustomer.Text = "-- Choose --"; cboCustomer.SelectedIndex = 0; cboCustomer2.DataSource = listCustomer; cboCustomer2.DisplayMember = "CustomerName"; cboCustomer2.ValueMember = "ID"; cboCustomer2.SelectedIndex = -1; cboCustomer2.Text = "-- Choose --"; cboTransDate.SelectedIndex = -1; cboTransDate.Text = "-- Choose --"; cboTransDetail.SelectedIndex = -1; cboTransDetail.Text = "-- Choose --"; cboCustomer2.SelectedIndexChanged += new EventHandler(Customer2_SelectedIndexChanged); cboCustomer2.SelectedIndex = 0; }
public CustomerView(VisitaJayaPerkasa.Entities.Customer customer) { InitializeComponent(); sqlCustomerRepository = new SqlCustomerRepository(); listCustomerDetail = sqlCustomerRepository.ListCustomerDetail(customer.ID); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); else if (listCustomerDetail != null) CustomerDetailGridView.DataSource = listCustomerDetail; lblCustomerName.Text = customer.CustomerName; lblOffice.Text = customer.Office; lblAddres.Text = customer.Address; lblEmail.Text = customer.Email; lblPhone.Text = customer.Phone; lblFax.Text = customer.Fax; lblContactPerson.Text = customer.ContactPerson; }
public void LoadDataInBackground() { sqlCustomerRepository = new SqlCustomerRepository(); listCustomer = null; string searchValue = radTextBoxElementSearchWord.Text; string searchKey = radComboBoxElement.Text; listCustomer = sqlCustomerRepository.ListCustomers(); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); else if (listCustomer != null) { if (!string.IsNullOrEmpty(searchValue) && !string.IsNullOrEmpty(searchKey)) { switch (searchKey) { case "Office": showListCustomer = listCustomer.Where(c => c.Office.Contains(searchValue)).ToList<VisitaJayaPerkasa.Entities.Customer>(); break; case "Customer Name": showListCustomer = listCustomer.Where(c => c.CustomerName.Contains(searchValue)).ToList<VisitaJayaPerkasa.Entities.Customer>(); break; } } else showListCustomer = listCustomer; } else showListCustomer = null; if (showListCustomer != null) { totalPage = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(showListCustomer.Count() / Convert.ToDecimal(pageSize)))); currentPage = 1; } else totalPage = 0; }
private void radButtonElementRemove_Click(object sender, EventArgs e) { if (CustomerGridView.SelectedRows.Count == 1) { sqlCustomerRepository = new SqlCustomerRepository(); DialogResult dResult = MessageBox.Show(this, "Are you sure want delete master and detail this customer ? ", "Confirmation", MessageBoxButtons.YesNo); if (dResult == DialogResult.Yes) { GridViewRowInfo gridInfo = CustomerGridView.SelectedRows.First(); string id = gridInfo.Cells[0].Value.ToString(); SqlParameter[] sqlParam = SqlUtility.SetSqlParameter(new string[] { "customer_id" }, new object[] { id }); if (sqlCustomerRepository.DeleteCustomer(sqlParam)) { MessageBox.Show("Data Deleted !"); LoadData(); } else if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); else MessageBox.Show("Cannot Delete Data !"); sqlParam = null; } } }
public PriceList() { InitializeComponent(); sqlPriceListRepository = new SqlPriceListRepository(); sqlCityRepository = new SqlCityRepository(); sqlCustomerRepository = new SqlCustomerRepository(); sqlRecipientRepository = new SqlRecipientRepository(); sqlWareHouseRepository = new SqlWareHouseRepository(); listPriceDeleteExistsData = new List<Guid>(); listIndexPriceDeleteExistsData = new List<int>(); listTypeOfSupplier = sqlPriceListRepository.GetTypeOfSupplier(0); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cboTypeSupplier.SelectedValueChanged -= new EventHandler(cboTypeSupplier_SelectedValueChanged); cboTypeSupplier.DataSource = listTypeOfSupplier; cboTypeSupplier.DisplayMember = "CategoryName"; cboTypeSupplier.ValueMember = "ID"; cboTypeSupplier.SelectedIndex = -1; cboTypeSupplier.SelectedText = Constant.VisitaJayaPerkasaApplication.cboDefaultText; cboTypeSupplier.SelectedValueChanged += new EventHandler(cboTypeSupplier_SelectedValueChanged); listCity = sqlCityRepository.GetCity(); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cbDestination.DataSource = listCity; cbDestination.DisplayMember = "CityName"; cbDestination.ValueMember = "ID"; cbDestination.SelectedIndex = -1; cbDestination.SelectedText = Constant.VisitaJayaPerkasaApplication.cboDefaultText; listRecipient = sqlRecipientRepository.GetRecipient(); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cboRecipient.DataSource = listRecipient; cboRecipient.DisplayMember = "Name"; cboRecipient.ValueMember = "ID"; cboRecipient.SelectedIndex = -1; cboRecipient.SelectedText = Constant.VisitaJayaPerkasaApplication.cboDefaultText; listWarehouse = sqlWareHouseRepository.GetWareHouse(); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cboStuffingPlace.DataSource = listWarehouse; cboStuffingPlace.DisplayMember = "Address"; cboStuffingPlace.ValueMember = "Id"; cboStuffingPlace.SelectedIndex = -1; cboStuffingPlace.SelectedText = Constant.VisitaJayaPerkasaApplication.cboDefaultText; cbSupplier.Enabled = false; cboRecipient.Enabled = false; cbDislayAll.Visible = false; cbDislayAll.Enabled = false; sqlPriceListRepository = null; PriceListGridView.Enabled = false; sqlCityRepository = null; pickerFrom.Value = DateTime.Today; pickerTo.Value = DateTime.Today; }
private void cbSearch_SelectedIndexChanged(object sender, EventArgs e) { if (cbSearch.Text.ToLower().Equals("all")) { rtsiHal.Visibility = ElementVisibility.Collapsed; rtsiCustomer.Visibility = ElementVisibility.Collapsed; } else if (cbSearch.Text.ToLower().Equals("hal")) { rtsiHal.Visibility = ElementVisibility.Visible; rtsiCustomer.Visibility = ElementVisibility.Collapsed; sqlSuratRepository = new SqlSuratRepository(); listSurat = sqlSuratRepository.ListSurat(EnumSurat.LeadTime); cbHal.DataSource = listSurat; cbHal.DisplayMember = "NoSurat"; sqlSuratRepository = null; } else if (cbSearch.Text.ToLower().Equals("customer")) { rtsiHal.Visibility = ElementVisibility.Collapsed; rtsiCustomer.Visibility = ElementVisibility.Visible; SqlCustomerRepository sqlCustomerRepository = new SqlCustomerRepository(); List<Customer> listCustomer = sqlCustomerRepository.listCustomerForPriceList(); cboCustomer.DataSource = listCustomer; cboCustomer.DisplayMember = "CustomerName"; cboCustomer.ValueMember = "ID"; sqlCustomerRepository = null; listCustomer = null; } }
private void SaveData() { SqlCustomerRepository sqlCustomerRepository = null; if (wantToCreateVessel) { sqlCustomerRepository = new SqlCustomerRepository(); Guid newGuid = Guid.NewGuid(); string[] strSqlParam = getStringSqlParameter(); object[] objSqlParam = GetObjSqlParameter(newGuid); SqlParameter[] sqlParam = SqlUtility.SetSqlParameter(strSqlParam, objSqlParam); if (sqlCustomerRepository.CheckCustomer(sqlParam, Guid.Empty, true)) { DialogResult dResult = MessageBox.Show(this, "Customer has already deleted. Do you want to activate ?", "Confirmation", MessageBoxButtons.YesNo); if (dResult == DialogResult.Yes) { if (sqlCustomerRepository.ActivateCustomer(sqlParam)) { MessageBox.Show(this, "Success Activate Customer", "Information"); radButtonElement2.PerformClick(); } else if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); else MessageBox.Show(this, "Cannot Activate Customer", "Information"); sqlParam = null; } return; } else if (!Constant.VisitaJayaPerkasaApplication.anyConnection) { MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (sqlCustomerRepository.CheckCustomer(sqlParam, Guid.Empty)) { MessageBox.Show(this, "Customer has already exists", "Information"); return; } else if (!Constant.VisitaJayaPerkasaApplication.anyConnection) { MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (sqlCustomerRepository.CreateCustomer(sqlParam)) { MessageBox.Show(this, "Success insert customer data", "Information"); radButtonElement2.PerformClick(); } else if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); else { MessageBox.Show(this, "Cannot insert customer data", "Information"); } sqlCustomerRepository = null; strSqlParam = null; objSqlParam = null; sqlParam = null; } else { sqlCustomerRepository = new SqlCustomerRepository(); string[] strSqlParam = getStringSqlParameter(); object[] objSqlParam = GetObjSqlParameter(customer.ID); SqlParameter[] sqlParam = SqlUtility.SetSqlParameter(strSqlParam, objSqlParam); if (sqlCustomerRepository.CheckCustomer(sqlParam, this.customer.ID)) { MessageBox.Show(this, "customer has already exist. if it has already deleted. you must activate it with create new data", "Information"); return; } else if (!Constant.VisitaJayaPerkasaApplication.anyConnection) { MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (sqlCustomerRepository.EditCustomer(sqlParam)) { MessageBox.Show(this, "Success edit customer data", "Information"); radButtonElement2.PerformClick(); } else if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); else { MessageBox.Show(this, "Cannot edit customer data", "Information"); } sqlCustomerRepository = null; strSqlParam = null; objSqlParam = null; sqlParam = null; } }
public CustomerTransEdit(VisitaJayaPerkasa.Entities.CustomerTrans customerTrans) { InitializeComponent(); this.customerTrans = customerTrans; sqlCustomerRepository = new SqlCustomerRepository(); sqlTypeContRepository = new SqlTypeContRepository(); sqlCityRepository = new SqlCityRepository(); sqlPelayaranRepository = new SqlPelayaranRepository(); sqlConditionRepository = new SqlConditionRepository(); sqlPriceListRepository = new SqlPriceListRepository(); sqlWarehouseRepository = new SqlWareHouseRepository(); sqlRecipientRepository = new SqlRecipientRepository(); sqlScheduleRepository = new SqlScheduleRepository(); sqlTruckingRepository = new SqlTruckingRepository(); sqlJenisBarangRepository = new SqlJenisBarangRepository(); List<VisitaJayaPerkasa.Entities.Customer> listCustomer = sqlCustomerRepository.ListCustomers(); List<VisitaJayaPerkasa.Entities.TypeCont> listType = sqlTypeContRepository.GetTypeCont(); List<VisitaJayaPerkasa.Entities.City> listOrigin = sqlCityRepository.GetCity(); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) { MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } List<VisitaJayaPerkasa.Entities.City> listDestination = sqlCityRepository.GetCity(); List<VisitaJayaPerkasa.Entities.PelayaranDetail> listPelayaran = sqlPelayaranRepository.GetVessels(); List<VisitaJayaPerkasa.Entities.Schedule> listSchedule = sqlScheduleRepository.ListSchedule(); List<VisitaJayaPerkasa.Entities.Condition> listCondition = sqlConditionRepository.GetConditions(); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) { MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } List<VisitaJayaPerkasa.Entities.WareHouse> listWarehouse; List<VisitaJayaPerkasa.Entities.Recipient> listRecipient; if (customerTrans != null) { listWarehouse = (this.customerTrans == null) ? sqlWarehouseRepository.GetWareHouse() : sqlWarehouseRepository.GetWareHouseByCustomer(customerTrans.CustomerID); listRecipient = (this.customerTrans == null) ? sqlRecipientRepository.GetRecipient() : sqlRecipientRepository.GetRecipientByCustomer(customerTrans.CustomerID); } else { listWarehouse = new List<Entities.WareHouse>(); listRecipient = new List<Entities.Recipient>(); } List<VisitaJayaPerkasa.Entities.Trucking> listTrucking = new List<Entities.Trucking>(); List<VisitaJayaPerkasa.Entities.JenisBarang> listJenisBarang = sqlJenisBarangRepository.ListJenisBarang(); if (!Constant.VisitaJayaPerkasaApplication.anyConnection) { MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } cboCustomer.DataSource = listCustomer; cboCustomer.DisplayMember = "CustomerName"; cboCustomer.ValueMember = "ID"; cboCustomer.SelectedIndex = -1; cboCustomer.Text = "-- Choose --"; cboCustomer.Tag = "cboCustomer"; cboType.DataSource = listType; cboType.DisplayMember = "TypeName"; cboType.ValueMember = "ID"; cboType.SelectedIndex = -1; cboType.Text = "-- Choose --"; cboOrigin.DataSource = listOrigin; cboOrigin.DisplayMember = "CityName"; cboOrigin.ValueMember = "ID"; cboOrigin.SelectedIndex = -1; cboOrigin.Text = "-- Choose --"; cboDestination.DataSource = listDestination; cboDestination.DisplayMember = "CityName"; cboDestination.ValueMember = "ID"; cboDestination.SelectedIndex = -1; cboDestination.Text = "-- Choose --"; days = from p in listDestination select p.Days; cboPelayaranDetail.DataSource = listSchedule; cboPelayaranDetail.DisplayMember = "namaKapal"; //cboPelayaranDetail.ValueMember = "ID"; cboPelayaranDetail.SelectedIndex = -1; cboPelayaranDetail.Text = "-- Choose --"; cboCondition.DataSource = listCondition; cboCondition.DisplayMember = "ConditionName"; cboCondition.ValueMember = "ID"; cboCondition.SelectedIndex = -1; cboCondition.Text = "-- Choose --"; cboStuffingPlace.DataSource = listWarehouse; cboStuffingPlace.DisplayMember = "Address"; cboStuffingPlace.ValueMember = "Id"; cboStuffingPlace.SelectedIndex = -1; cboStuffingPlace.Text = "-- Choose --"; cboRecipient.DataSource = listRecipient; cboRecipient.DisplayMember = "Name"; cboRecipient.ValueMember = "ID"; cboRecipient.SelectedIndex = -1; cboRecipient.Text = "-- Choose --"; cboTrucking.DataSource = listTrucking; cboTrucking.DisplayMember = "TruckNo"; cboTrucking.ValueMember = "ID"; cboTrucking.SelectedIndex = -1; cboTrucking.Text = "-- Choose --"; cboJenisBarang.DataSource = listJenisBarang; cboJenisBarang.DisplayMember = "Nama"; cboJenisBarang.ValueMember = "Nama"; cboJenisBarang.SelectedIndex = -1; cboJenisBarang.Text = "-- Type or Choose --"; if (customerTrans == null) { wantToCreateVessel = true; listCustomerTransDetail = new List<Entities.CustomerTransDetail>(); } else { wantToCreateVessel = false; cboCustomer.SelectedValue = customerTrans.CustomerID; cboCustomer.Enabled = false; SqlCustomerTransRepository sqlCustomerTransRepository = new SqlCustomerTransRepository(); listCustomerTransDetail = sqlCustomerTransRepository.ListCustomerTransDetail(customerTrans.CustomerTransID); ID = customerTrans.CustomerTransID; if (!Constant.VisitaJayaPerkasaApplication.anyConnection) MessageBox.Show(this, "Please check your connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); else if (listCustomerTransDetail != null) CustomerTransDetailGridView.DataSource = listCustomerTransDetail; else listCustomerTransDetail = new List<VisitaJayaPerkasa.Entities.CustomerTransDetail>(); sqlCustomerTransRepository = null; } cboCustomer.SelectedIndexChanged += new EventHandler(cboSelected_SelectedIndexChanged); cboType.SelectedIndexChanged += new EventHandler(cboSelected_SelectedIndexChanged); cboDestination.SelectedIndexChanged += new EventHandler(cboSelected_SelectedIndexChanged); cboCondition.SelectedIndexChanged += new EventHandler(cboSelected_SelectedIndexChanged); sqlCustomerRepository = null; sqlTypeContRepository = null; sqlCityRepository = null; sqlPelayaranRepository = null; sqlConditionRepository = null; if (wantToCreateVessel) { dtpTD.Visible = false; dtpETA.Visible = false; dtpTA.Visible = false; dtpUnloading.Visible = false; } }