private MSupplier GetMSupplier(dynamic data) { MSupplier supplier = new MSupplier(); if (data != null) { // supplier.FullName = data.FullName; supplier.iSupplierID = data.iSupplierID ?? -1; supplier.strFirstName = data.strFirstName ?? " "; supplier.strMiddleName = data.strMiddleName ?? " "; supplier.strLastName = data.strLastName ?? " "; supplier.iSupplierCategory = data.iSupplierCategory ?? -1; supplier.iSupplierServiceType = data.iSupplierServiceType ?? -1; supplier.strEmailID = data.strEmailID ?? " "; supplier.iPhoneNumber = data.iPhoneNumber ?? " "; supplier.strAddress = data.strAddress ?? " "; supplier.iPincode = data.iPincode ?? " "; supplier.iCurrency = data.iCurrency ?? " "; supplier.SupplierPhoto = data.SupplierPhoto; supplier.SupplierDate = data.SupplierDate ?? " "; supplier.iPersonPhoneNumber = data.iPersonPhoneNumber; supplier.strPersonEmailID = data.strPersonEmailID; supplier.strCompanyName = data.strCompanyName; supplier.strWebsites = data.strWebsites; supplier.strPicName = data.strPicName; supplier.AccountNumber = data.AccountNumber; supplier.strBankName = data.strBankName; supplier.strBranchName = data.strBranchName; supplier.strSwiftCode = data.strSwiftCode; } return(supplier); }
public static TransactionFormViewModel Create(EnumTransactionStatus enumTransactionStatus, ITTransRepository transRepository, IMWarehouseRepository mWarehouseRepository, IMSupplierRepository mSupplierRepository, IMUnitTypeRepository mUnitTypeRepository, IMJobTypeRepository mJobTypeRepository) { TransactionFormViewModel viewModel = new TransactionFormViewModel(); TTrans trans = SetNewTrans(enumTransactionStatus); viewModel.Trans = trans; Helper.CommonHelper.SetViewModelByStatus(viewModel, enumTransactionStatus); viewModel.TransFactur = trans.TransFactur; viewModel.TransDate = trans.TransDate; viewModel.TransId = trans.Id; viewModel.TransStatus = trans.TransStatus; viewModel.WarehouseId = trans.WarehouseId; viewModel.WarehouseIdTo = trans.WarehouseIdTo; viewModel.UnitTypeId = trans.UnitTypeId; viewModel.JobTypeId = trans.JobTypeId; viewModel.TransDesc = trans.TransDesc; IList <MWarehouse> list = mWarehouseRepository.GetAll(); MWarehouse mWarehouse = new MWarehouse(); mWarehouse.WarehouseName = "-Pilih Gudang-"; list.Insert(0, mWarehouse); viewModel.WarehouseList = new SelectList(list, "Id", "WarehouseName"); viewModel.WarehouseToList = new SelectList(list, "Id", "WarehouseName"); IList <MSupplier> listSupplier = mSupplierRepository.GetAll(); MSupplier mSupplier = new MSupplier(); mSupplier.SupplierName = "-Pilih Supplier-"; listSupplier.Insert(0, mSupplier); viewModel.SupplierList = new SelectList(listSupplier, "Id", "SupplierName"); IList <MUnitType> listUnitType = mUnitTypeRepository.GetAll(); MUnitType mUnitType = new MUnitType(); mUnitType.UnitTypeName = "-Pilih Unit-"; listUnitType.Insert(0, mUnitType); viewModel.UnitTypeList = new SelectList(listUnitType, "Id", "UnitTypeName"); IList <MJobType> listJobType = mJobTypeRepository.GetAll(); MJobType mJobType = new MJobType(); mJobType.JobTypeName = "-Pilih Jenis Pekerjaan-"; listJobType.Insert(0, mJobType); viewModel.JobTypeList = new SelectList(listJobType, "Id", "JobTypeName"); //fill payment method var values = from EnumPaymentMethod e in Enum.GetValues(typeof(EnumPaymentMethod)) select new { ID = e, Name = e.ToString() }; viewModel.PaymentMethodList = new SelectList(values, "Id", "Name"); //viewModel.ViewWarehouseTo = false; //viewModel.ViewSupplier = false; //viewModel.ViewDate = false; //viewModel.ViewFactur = false; return(viewModel); }
public ActionResult Update(MSupplier viewModel, FormCollection formCollection) { UpdateNumericData(viewModel, formCollection); MSupplier mSupplierToUpdate = _mSupplierRepository.Get(viewModel.Id); TransferFormValuesTo(mSupplierToUpdate, viewModel); mSupplierToUpdate.ModifiedDate = DateTime.Now; mSupplierToUpdate.ModifiedBy = User.Identity.Name; mSupplierToUpdate.DataStatus = EnumDataStatus.Updated.ToString(); RefAddress address = mSupplierToUpdate.AddressId; TransferFormValuesTo(address, formCollection); address.ModifiedDate = DateTime.Now; address.ModifiedBy = User.Identity.Name; address.DataStatus = EnumDataStatus.Updated.ToString(); _mSupplierRepository.Update(mSupplierToUpdate); bool isSave = false; try { _mSupplierRepository.DbContext.CommitChanges(); } catch (Exception e) { _mSupplierRepository.DbContext.RollbackTransaction(); return(Content(e.GetBaseException().Message)); } return(Content("success")); }
private static void TransferFormValuesTo(MSupplier mSupplierToUpdate, MSupplier mSupplierFromForm) { mSupplierToUpdate.SupplierName = mSupplierFromForm.SupplierName; mSupplierToUpdate.SupplierDesc = mSupplierFromForm.SupplierDesc; mSupplierToUpdate.SupplierMaxDebt = mSupplierFromForm.SupplierMaxDebt; mSupplierToUpdate.SupplierStatus = mSupplierFromForm.SupplierStatus; }
public static MSupplier MSupplierEmpty(this BoSupplier oBSupplier) { var oObject = LiUtilsLib.bll_GetObjectByName(MGlobalVariables.LNameObjectSupplier); var oMSupplier = new MSupplier { LObject = new MObject { LIdObject = oObject.LIdObject, LNameObject = oObject.LNameObject }, LStatus = new MStatus { LDsEstado = null, LIdStatus = null }, LTypeIdentification = new MTypeIdentification { LIdTypeIdentification = 0, LTypeIdentification = null }, LListTypeIdentification = new List <SelectListItem>(), LListStatus = new List <SelectListItem>(), LNameSupplier = null, LNoIdentification = null, LIdSupplier = 0, LCreationDate = new DateTime(), LModificationDate = new DateTime() }; oMSupplier.LListTypeIdentification = LiTypeIdentification.bll_getListTypeIdentification().MListAllTypeIdentificationWithSelect(true); oMSupplier.LListStatus = LiStatus.Bll_getListStatusByIdObject(oMSupplier.LObject.LIdObject).MListStatusWithSelect(); return(oMSupplier); }
public ActionResult Create(MSupplier pMsupplier) { try { this.ModelState.Remove(EFields.LFieldIdSupplier); if (this.ModelState.IsValid) { var lMessage = this.LiSupplier.bll_InsertSupplier(pMsupplier.LNameSupplier, pMsupplier.LNoIdentification, Convert.ToInt32(this.Request.Form[EFields.LFieldListTypeIdentification]), Convert.ToInt32(this.Request.Form[EFields.LFieldListObject]), this.LiUtilsLib.bll_getStatusApproByObject(this.LiUtilsLib.bll_GetObjectByName(MGlobalVariables.LNameObjectSupplier).LIdObject).LIdStatus); if (lMessage == null) { return(this.RedirectToAction("Index")); } ListEmptySupplier(pMsupplier); pMsupplier.LMessageException = lMessage; return(this.View(pMsupplier)); } ListEmptySupplier(pMsupplier); return(this.View(pMsupplier)); } catch (Exception e) { ListEmptySupplier(pMsupplier); pMsupplier.LMessageException = e.Message; return(this.View(pMsupplier)); } }
public ActionResult Insert(MSupplier viewModel, FormCollection formCollection) { RefAddress address = new RefAddress(); TransferFormValuesTo(address, formCollection); address.SetAssignedIdTo(Guid.NewGuid().ToString()); address.CreatedDate = DateTime.Now; address.CreatedBy = User.Identity.Name; address.DataStatus = EnumDataStatus.New.ToString(); _refAddressRepository.Save(address); UpdateNumericData(viewModel, formCollection); MSupplier mSupplierToInsert = new MSupplier(); TransferFormValuesTo(mSupplierToInsert, viewModel); mSupplierToInsert.SetAssignedIdTo(viewModel.Id); mSupplierToInsert.CreatedDate = DateTime.Now; mSupplierToInsert.CreatedBy = User.Identity.Name; mSupplierToInsert.DataStatus = EnumDataStatus.New.ToString(); mSupplierToInsert.AddressId = address; _mSupplierRepository.Save(mSupplierToInsert); return(Content("success")); }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(supplierIdTextBox.Text.Trim())) { if (MessageBox.Show("Anda yakin menghapus data?", "Konfirmasi Hapus Data", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { supp = (MSupplier)DataMaster.GetObjectById(typeof(MSupplier), supplierIdTextBox.Text); DataMaster.Delete(supp); IList listAcc = DataMaster.GetListEq(typeof(MSupplierAccount), MSupplierAccount.ColumnNames.SupplierId, supplierIdTextBox.Text); MSupplierAccount suppAcc; for (int i = 0; i < listAcc.Count; i++) { suppAcc = (MSupplierAccount)listAcc[i]; if (suppAcc != null) { DataMaster.Delete(suppAcc); } } ModuleControlSettings.SaveLog(ListOfAction.Delete, supplierIdTextBox.Text, ListOfTable.MSupplier, lbl_UserName.Text); BindData(); } } }
private static void ListEmptySupplier(MSupplier pMsupplier) { pMsupplier.LListTypeIdentification = new List <SelectListItem>(); pMsupplier.LListTypeIdentification = LiTypeIdentification.bll_getListTypeIdentification().MListAllTypeIdentification(); pMsupplier.LListStatus = new List <SelectListItem>(); pMsupplier.LListStatus = LiStatus.Bll_getListStatusByIdObject(pMsupplier.LObject.LIdObject).MListAllStatus(); }
public static MSupplier MSupplierById(this BoSupplier pBoSupplier) { var lMSupplier = new MSupplier { LObject = new MObject { LIdObject = pBoSupplier.LObject.LIdObject, LNameObject = pBoSupplier.LObject.LNameObject }, LStatus = new MStatus { LDsEstado = pBoSupplier.LStatus.LDsEstado, LIdStatus = pBoSupplier.LStatus.LIdStatus }, LTypeIdentification = new MTypeIdentification { LIdTypeIdentification = pBoSupplier.LTypeIdentification.LIdTypeIdentification, LTypeIdentification = pBoSupplier.LTypeIdentification.LTypeIdentification }, LListTypeIdentification = new List <SelectListItem>(), LListStatus = new List <SelectListItem>(), LNameSupplier = pBoSupplier.LNameSupplier, LNoIdentification = pBoSupplier.LNoIdentification, LIdSupplier = pBoSupplier.LIdSupplier, LCreationDate = pBoSupplier.LCreationDate, LModificationDate = pBoSupplier.LModificationDate }; lMSupplier.LListTypeIdentification = LiTypeIdentification.bll_getListTypeIdentification().MListAllTypeIdentification(); lMSupplier.LListStatus = LiStatus.Bll_getListStatusByIdObject(pBoSupplier.LObject.LIdObject).MListAllStatus(); return(lMSupplier); }
public ActionResult Edit(int id, MSupplier pMsupplier) { try { if (this.ModelState.IsValid) { var lMessage = this.LiSupplier.bll_UpdateSupplier(id, pMsupplier.LNameSupplier, pMsupplier.LNoIdentification, Convert.ToInt32(this.Request.Form[EFields.LFieldListTypeIdentification]), Convert.ToInt32(this.Request.Form[EFields.LFieldListObject]), this.Request.Form[EFields.LFieldListStatus]); if (lMessage == null) { return(this.RedirectToAction("Index")); } ListEmptySupplier(pMsupplier); pMsupplier.LMessageException = lMessage; return(this.View(pMsupplier)); } ListEmptySupplier(pMsupplier); return(this.View(pMsupplier)); } catch (Exception e) { ListEmptySupplier(pMsupplier); pMsupplier.LMessageException = e.Message; return(this.View(pMsupplier)); } }
private void txt_CustId_Validating(object sender, CancelEventArgs e) { if (!string.IsNullOrEmpty(txt_CustId.Text.Trim())) { if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Sales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.SalesVIP.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSalesVIP.ToString())) { MCustomer cust = (MCustomer)DataMaster.GetObjectByProperty(typeof(MCustomer), MCustomer.ColumnNames.CustomerId, txt_CustId.Text); if (cust != null) { txt_CustName.Text = cust.CustomerName; } else { txt_CustName.ResetText(); } } else { MSupplier supp = (MSupplier)DataMaster.GetObjectByProperty(typeof(MSupplier), MSupplier.ColumnNames.SupplierId, txt_CustId.Text); if (supp != null) { txt_CustName.Text = supp.SupplierName; } else { txt_CustName.ResetText(); } } } }
public MSupplier Get(int id) { MSupplier supplier = new MSupplier(); supplier = auctionContext.MSuppliers.Where(a => a.iSupplierID == id).FirstOrDefault(); return(supplier); }
private static SelectList GetSupplierList() { IMSupplierRepository mSupplierRepository = new MSupplierRepository(); IList <MSupplier> listSupplier = mSupplierRepository.GetAll(); MSupplier mSupplier = new MSupplier(); mSupplier.SupplierName = "-Pilih Supplier-"; listSupplier.Insert(0, mSupplier); return(new SelectList(listSupplier, "Id", "SupplierName")); }
public ActionResult Update(MSupplier viewModel, FormCollection formCollection) { UpdateNumericData(viewModel, formCollection); MSupplier mSupplierToUpdate = _mSupplierRepository.Get(viewModel.Id); TransferFormValuesTo(mSupplierToUpdate, viewModel); mSupplierToUpdate.ModifiedDate = DateTime.Now; mSupplierToUpdate.ModifiedBy = User.Identity.Name; mSupplierToUpdate.DataStatus = EnumDataStatus.Updated.ToString(); RefAddress address = mSupplierToUpdate.AddressId; TransferFormValuesTo(address, formCollection); address.ModifiedDate = DateTime.Now; address.ModifiedBy = User.Identity.Name; address.DataStatus = EnumDataStatus.Updated.ToString(); _mSupplierRepository.Update(mSupplierToUpdate); bool isSave = false; MAccountRef accountRef = GetAccountRef(mSupplierToUpdate.Id); if (accountRef == null) { accountRef = new MAccountRef(); accountRef.SetAssignedIdTo(Guid.NewGuid().ToString()); isSave = true; } accountRef.ReferenceId = mSupplierToUpdate.Id; accountRef.ReferenceTable = EnumReferenceTable.Supplier.ToString(); accountRef.ReferenceType = EnumReferenceTable.Supplier.ToString(); accountRef.AccountId = _mAccountRepository.Get(formCollection["AccountId"]); if (isSave) { _mAccountRefRepository.Save(accountRef); } else { _mAccountRefRepository.Update(accountRef); } try { _mSupplierRepository.DbContext.CommitChanges(); } catch (Exception e) { _mSupplierRepository.DbContext.RollbackTransaction(); return(Content(e.GetBaseException().Message)); } return(Content("success")); }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(supplierIdTextBox.Text.Trim())) { if (MessageBox.Show("Anda yakin menghapus data?", "Konfirmasi Hapus Data", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { supp = (MSupplier)DataMaster.GetObjectById(typeof(MSupplier), supplierIdTextBox.Text); DataMaster.Delete(supp); BindData(); } } }
private void bindingNavigatorSaveItem_Click(object sender, EventArgs e) { if (!ValidateForm()) { return; } if (supplierIdTextBox.Enabled == true) { supp = new MSupplier(); } else { supp = (MSupplier)DataMaster.GetObjectById(typeof(MSupplier), supplierIdTextBox.Text); } supp.SubAccountId = string.Empty; supp.SupplierAddress = supplierAddressTextBox.Text; supp.SupplierContact = supplierContactTextBox.Text; supp.SupplierContactPhone = supplierContactPhoneTextBox.Text; supp.SupplierFax = supplierFaxTextBox.Text; supp.SupplierId = supplierIdTextBox.Text; supp.SupplierLimit = decimal.Zero; supp.SupplierName = supplierNameTextBox.Text; supp.SupplierNpwp = supplierNpwpTextBox.Text; supp.SupplierPhone = supplierPhoneTextBox.Text; supp.ModifiedBy = lbl_UserName.Text; supp.ModifiedDate = DateTime.Now; if (supplierIdTextBox.Enabled == true) { try { DataMaster.SavePersistence(supp); } catch (NHibernate.NonUniqueObjectException) { RecreateBalloon(); balloonHelp.Caption = "Validasi data kurang"; balloonHelp.Content = "Supplier dengan kode " + supplierIdTextBox.Text + " sudah pernah diinput, silahkan input dengan kode yang lain"; balloonHelp.ShowBalloon(supplierIdTextBox); supplierIdTextBox.Focus(); return; } ModuleControlSettings.SaveLog(ListOfAction.Insert, supplierIdTextBox.Text, ListOfTable.MSupplier, lbl_UserName.Text); } else { DataMaster.UpdatePersistence(supp); ModuleControlSettings.SaveLog(ListOfAction.Update, supplierIdTextBox.Text, ListOfTable.MSupplier, lbl_UserName.Text); } BindData(); }
public ActionResult InsertOrUpdate(MSupplier viewModel, FormCollection formCollection) { if (formCollection["oper"].Equals("add")) { return(Insert(viewModel, formCollection)); } else if (formCollection["oper"].Equals("edit")) { return(Update(viewModel, formCollection)); } return(View()); }
private static void UpdateNumericData(MSupplier viewModel, FormCollection formCollection) { if (!string.IsNullOrEmpty(formCollection["SupplierMaxDebt"])) { string SupplierMaxDebt = formCollection["SupplierMaxDebt"].Replace(",", ""); viewModel.SupplierMaxDebt = Convert.ToDecimal(SupplierMaxDebt); } else { viewModel.SupplierMaxDebt = null; } }
public static ReportParamViewModel CreateReportParamViewModel(IMCostCenterRepository mCostCenterRepository, IMWarehouseRepository mWarehouseRepository, IMSupplierRepository mSupplierRepository, ITRecPeriodRepository tRecPeriodRepository, IMItemRepository mItemRepository) { ReportParamViewModel viewModel = new ReportParamViewModel(); IList <MCostCenter> list = mCostCenterRepository.GetAll(); MCostCenter costCenter = new MCostCenter(); costCenter.CostCenterName = "-Semua Cost Center-"; list.Insert(0, costCenter); viewModel.CostCenterList = new SelectList(list, "Id", "CostCenterName"); IList <MWarehouse> listWarehouse = mWarehouseRepository.GetAll(); MWarehouse account = new MWarehouse(); account.WarehouseName = "-Semua Gudang-"; listWarehouse.Insert(0, account); viewModel.WarehouseList = new SelectList(listWarehouse, "Id", "WarehouseName"); IList <MSupplier> listSupplier = mSupplierRepository.GetAll(); MSupplier supplier = new MSupplier(); supplier.SupplierName = "-Semua Supplier-"; listSupplier.Insert(0, supplier); viewModel.SupplierList = new SelectList(listSupplier, "Id", "SupplierName"); IList <TRecPeriod> listRecPeriod = tRecPeriodRepository.GetAll(); //TRecPeriod recPeriod = new TRecPeriod(); //recPeriod.PeriodDesc = "-Pilih Period-"; //listRecPeriod.Insert(0, recPeriod); viewModel.RecPeriodList = new SelectList(listRecPeriod, "Id", "PeriodDesc"); IList <MItem> listItem = mItemRepository.GetAll(); MItem item = new MItem(); item.ItemName = "-Semua Item-"; listItem.Insert(0, item); viewModel.ItemList = new SelectList(listItem, "Id", "ItemName"); ArrayList arr = new ArrayList(); for (int i = 1; i <= 5; i++) { var sel = new { Id = i }; arr.Add(sel); } viewModel.ShiftNoList = new SelectList(arr, "Id", "Id"); viewModel.DateFrom = DateTime.Today; viewModel.DateTo = DateTime.Today; return(viewModel); }
private void UpdateNumericData(MSupplier viewModel, FormCollection formCollection) { if (!string.IsNullOrEmpty(formCollection["SupplierMaxDebt"])) { string wide = formCollection["SupplierMaxDebt"].Replace(",", ""); decimal?budget = Convert.ToDecimal(wide); viewModel.SupplierMaxDebt = budget; } else { viewModel.SupplierMaxDebt = null; } }
internal static string GetSupplierName(string SupplierId) { DataMasterMgtServices DataMaster = new DataMasterMgtServices(); MSupplier sup = DataMaster.GetObjectByProperty(typeof(MSupplier), MSupplier.ColumnNames.SupplierId, SupplierId) as MSupplier; if (sup != null) { return(sup.SupplierName); } else { return(string.Empty); } }
public static void SupplierValidating(string supplierId, TextBox supplierNameTextBox) { DataMasterMgtServices DataMaster = new DataMasterMgtServices(); MSupplier supp = (MSupplier)DataMaster.GetObjectByProperty(typeof(MSupplier), MSupplier.ColumnNames.SupplierId, supplierId); if (supp != null) { supplierNameTextBox.Text = supp.SupplierName; } else { supplierNameTextBox.ResetText(); } }
public ActionResult Insert(MSupplier viewModel, FormCollection formCollection) { try { _mSupplierRepository.DbContext.BeginTransaction(); UpdateNumericData(viewModel, formCollection); RefAddress address = new RefAddress(); TransferFormValuesTo(address, formCollection); address.SetAssignedIdTo(Guid.NewGuid().ToString()); address.CreatedDate = DateTime.Now; address.CreatedBy = User.Identity.Name; address.DataStatus = EnumDataStatus.New.ToString(); _refAddressRepository.Save(address); MSupplier mSupplierToInsert = new MSupplier(); TransferFormValuesTo(mSupplierToInsert, viewModel); mSupplierToInsert.SetAssignedIdTo(viewModel.Id); mSupplierToInsert.CreatedDate = DateTime.Now; mSupplierToInsert.CreatedBy = User.Identity.Name; mSupplierToInsert.DataStatus = EnumDataStatus.New.ToString(); mSupplierToInsert.AddressId = address; _mSupplierRepository.Save(mSupplierToInsert); MAccountRef accountRef = new MAccountRef(); accountRef.SetAssignedIdTo(Guid.NewGuid().ToString()); accountRef.ReferenceId = mSupplierToInsert.Id; accountRef.ReferenceTable = EnumReferenceTable.Supplier.ToString(); accountRef.ReferenceType = EnumReferenceTable.Supplier.ToString(); accountRef.AccountId = _mAccountRepository.Get(formCollection["AccountId"]); accountRef.CreatedDate = DateTime.Now; accountRef.CreatedBy = User.Identity.Name; accountRef.DataStatus = EnumDataStatus.New.ToString(); _mAccountRefRepository.Save(accountRef); _mSupplierRepository.DbContext.CommitChanges(); } catch (Exception e) { _mSupplierRepository.DbContext.RollbackTransaction(); //throw e.GetBaseException(); return(Content(e.GetBaseException().Message)); } return(Content("success")); }
private void bindingNavigatorSaveItem_Click(object sender, EventArgs e) { if (!ValidateForm()) { return; } if (supplierIdTextBox.Enabled == true) { supp = new MSupplier(); } else { supp = (MSupplier)DataMaster.GetObjectByProperty(typeof(MSupplier), MSupplier.ColumnNames.SupplierId, supplierIdTextBox.Text); } supp.SupplierContact = supplierContactTextBox.Text; supp.SupplierContactPhone = supplierContactPhoneTextBox.Text; supp.SupplierId = supplierIdTextBox.Text; supp.SupplierName = supplierNameTextBox.Text; supp.SupplierPhone = supplierPhoneTextBox.Text; supp.SupplierAddress = supplierAddressTextBox.Text; supp.ModifiedBy = lbl_UserName.Text; supp.ModifiedDate = DateTime.Now; if (supplierIdTextBox.Enabled == true) { try { DataMaster.SavePersistence(supp); } catch (NHibernate.NonUniqueObjectException) { RecreateBalloon(); balloonHelp.Caption = "Validasi data kurang"; balloonHelp.Content = "Supplier dengan kode " + supplierIdTextBox.Text + " sudah pernah diinput, silahkan input dengan kode yang lain"; balloonHelp.ShowBalloon(supplierIdTextBox); supplierIdTextBox.Focus(); return; } } else { DataMaster.UpdatePersistence(supp); } BindData(); }
private void transactionByTextBox_Validating(object sender, CancelEventArgs e) { if (!string.IsNullOrEmpty(transactionByTextBox.Text.Trim())) { if (trans.Equals(ListOfTransaction.Sales) || trans.Equals(ListOfTransaction.ReturSales) || trans.Equals(ListOfTransaction.SalesVIP) || trans.Equals(ListOfTransaction.ReturSalesVIP)) { MCustomer cust = (MCustomer)DataMaster.GetObjectByProperty(typeof(MCustomer), MCustomer.ColumnNames.CustomerId, transactionByTextBox.Text); if (cust != null) { transactionByTextBox_Name.Text = cust.CustomerName; } else { transactionByTextBox_Name.ResetText(); } } else if (trans.Equals(ListOfTransaction.Usage) || trans.Equals(ListOfTransaction.Correction)) { MEmployee emp = (MEmployee)DataMaster.GetObjectByProperty(typeof(MEmployee), MEmployee.ColumnNames.EmployeeId, transactionByTextBox.Text); if (emp != null) { transactionByTextBox_Name.Text = emp.EmployeeName; } else { transactionByTextBox_Name.ResetText(); } } else if (trans.Equals(ListOfTransaction.PurchaseOrder) || trans.Equals(ListOfTransaction.Purchase) || trans.Equals(ListOfTransaction.ReturPurchase)) { MSupplier supp = (MSupplier)DataMaster.GetObjectByProperty(typeof(MSupplier), MSupplier.ColumnNames.SupplierId, transactionByTextBox.Text); if (supp != null) { transactionByTextBox_Name.Text = supp.SupplierName; if (trans.Equals(ListOfTransaction.Purchase)) { ModuleControlSettings.SetTransactionTextBoxSuggest(transactionReferenceIdTextBox, ListOfTransaction.PurchaseOrder, supp.SupplierId); } } else { transactionByTextBox_Name.ResetText(); } } } }
private void updateSupplier(string _kode, string _nama, string _alamat, string _tlp, string _email, string _kontak, string _keterangan) { InsertController ic = new InsertController(); ListController lc = new ListController(); MSupplier i = new MSupplier() { kode = _kode, nama = _nama, alamat = _alamat, tlp = _tlp, email = _email, kontak = _kontak, keterangan = _keterangan, }; OBJSQL obj = ic.UpdateSupplier(i, kode); }
private object GetSupplierName(string supplierId) { IDictionary <string, object> param = new Dictionary <string, object>(); param.Add("Id", supplierId); MSupplier supplier = _mSupplierRepository.FindOne(param); if (supplier != null) { return(supplier.SupplierName); } else { return(string.Empty); } }
public static PaymentViewModel Create(EnumPaymentType paymentType, ITPaymentRepository tPaymentRepository, ITPaymentDetRepository tPaymentDetRepository, IMSupplierRepository mSupplierRepository, IMCustomerRepository mCustomerRepository, IMCostCenterRepository mCostCenterRepository) { PaymentViewModel viewModel = new PaymentViewModel(); TPayment p = new TPayment(); p.SetAssignedIdTo(Guid.NewGuid().ToString()); p.PaymentDate = DateTime.Today; p.PaymentDesc = string.Empty; p.PaymentType = paymentType.ToString(); viewModel.Payment = p; viewModel.Title = string.Format("Pembayaran {0}", paymentType.ToString()); IList <MCostCenter> list = mCostCenterRepository.GetAll(); MCostCenter costCenter = new MCostCenter(); costCenter.CostCenterName = "-Pilih Cost Center-"; list.Insert(0, costCenter); viewModel.CostCenterList = new SelectList(list, "Id", "CostCenterName"); //get label text switch (paymentType) { case EnumPaymentType.Piutang: viewModel.CashAccountLabel = "Deposit ke : "; //fill cust var values = from MCustomer cust in mCustomerRepository.GetAll() select new { Id = cust.Id, Name = cust.PersonId != null ? cust.PersonId.PersonName : "-Pilih Konsumen-" }; viewModel.TransByList = new SelectList(values, "Id", "Name"); break; case EnumPaymentType.Hutang: viewModel.CashAccountLabel = "Deposit dari : "; IList <MSupplier> listAcc = mSupplierRepository.GetAll(); MSupplier supplier = new MSupplier(); supplier.SupplierName = "-Pilih Supplier-"; listAcc.Insert(0, supplier); viewModel.TransByList = new SelectList(listAcc, "Id", "SupplierName"); break; } return(viewModel); }
public ActionResult Delete(int id, MSupplier pMsupplier) { try { var lMessage = this.LiSupplier.bll_DeleteSupplier(id); if (lMessage == null) { return(this.RedirectToAction("Index")); } pMsupplier.LMessageException = lMessage; return(this.View()); } catch (Exception e) { pMsupplier.LMessageException = e.Message; return(this.View()); } }