public uc_WarehouseDetail(uc_Warehouse parent, PRO_tblWarehouseDTO item) { InitializeComponent(); parentForm = parent; Initialize(); LoadDataToEdit(item); SetPermission(); }
private void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (curRow != null) { PRO_tblWarehouseDTO item = busWarehouse.GetDataByID(curRow["StoreID"] + "", User.UserInfo.Username, User.UserInfo.LanguageID); if (item != null) { Commons.OpenInputForm(new uc_WarehouseDetail(this, item), "Cập Nhật Kho Hàng", "Update Warehouse", new Size(410, 400)); } } }
public uc_WarehouseDetail(uc_Warehouse _parent_form, PRO_tblWarehouseDTO item = null) { CommonEngine.ShowWaitForm(this); InitializeComponent(); Initialize(); parent_form = _parent_form; if (item != null) { LoadDataToEdit(item); } CommonEngine.LoadUserPermission("18", txtWarehouseID, btnSaveClose, btnSaveInsert); }
public async static Task <PRO_tblWarehouseDRO> InsertUpdateStore(PRO_tblWarehouseDTO item, SYS_tblActionLogDTO actionLog) { PRO_tblWarehouseDRO result = new PRO_tblWarehouseDRO(); try { string url = string.Format(@"{0}/InsertUpdateWarehouse", GetBaseUrl()); var postData = new PRO_tblWarehouseDCO { WarehouseID = item.WarehouseID, WarehouseCode = item.WarehouseCode, VNName = item.VNName, ENName = item.ENName, StoreID = item.StoreID, AddressVN = item.AddressVN, AddressEN = item.AddressEN, Phone = item.Phone, Fax = item.Fax, ProvinceID = string.IsNullOrEmpty(item.ProvinceID) ? null : item.ProvinceID, DistrictID = string.IsNullOrEmpty(item.DistrictID) ? null : item.DistrictID, Rank = item.Rank, Used = item.Used, Note = item.Note, UserID = item.UserID, Activity = item.Activity, LanguageID = item.LanguageID }; var json_data = "{\"warehouse\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.MicrosoftDateFormat }) + "}"; result = await PRO_tblWarehouseDAO.InsertUpdateWarehouse(url, json_data); if (string.IsNullOrEmpty(result.ResponseItem.Message)) { result.ResponseItem = await SYS_tblActionLogBUS.InsertUpdateLog(actionLog); } } catch (Exception ex) { logger.Error(ex); result.ResponseItem.Message = ex.Message; } return(result); }
private bool SaveWarehouse(bool isEdit) { string strError = ""; try { PRO_tblWarehouseDTO item = new PRO_tblWarehouseDTO { Activity = (isEdit) ? "Update" : "Insert", Username = User.UserInfo.Username, LanguageID = User.UserInfo.LanguageID, WarehouseID = txtWarehouseID.Text, WarehouseCode = txtWarehouseCode.Text, VNName = txtVNName.Text, ENName = txtENName.Text, StoreID = gluStore.EditValue + "", AddressVN = txtAddressVN.Text, AddressEN = txtAddressEN.Text, Phone = txtPhone.Text, Fax = txtFax.Text, ProvinceID = gluProvince.EditValue + "", DistrictID = gluDistrict.EditValue + "", Rank = speRank.EditValue, Used = chkUsed.Checked, Note = mmoNote.Text }; strError = (isEdit) ? busWarehouse.UpdateWarehouse(item) : busWarehouse.InsertWarehouse(item); if (strError != "") { Commons.ShowMessage(strError, 0); txtWarehouseCode.Focus(); return(false); } else { parentForm.LoadAllData(); } } catch (Exception ex) { Commons.ShowExceptionMessage(ex); return(false); } return(true); }
public PRO_tblWarehouseDTO GetDataByID(string username, string language_id, string warehouse_id) { PRO_tblWarehouseDTO result = new PRO_tblWarehouseDTO(); try { DataTable data = db.GetDataTable("PRO_spfrmWarehouse", new string[] { "Activity", "Username", "LanguageID", "WarehouseID" }, new object[] { BaseConstant.COMMAND_GET_DATA_BY_ID_EN, username, language_id, warehouse_id }); if (data != null && data.Rows.Count > 0) { result = ConvertEngine.ConvertDataTableToObjectList <PRO_tblWarehouseDTO>(data)[0]; return(result); } } catch (Exception ex) { logger.Error(ex); } return(result); }
public string UpdateWarehouse(PRO_tblWarehouseDTO item) { string strError = ""; strError = db.sExecuteSQL("PRO_spfrmWarehouse", new string[] { "Activity", "Username", "LanguageID", "WarehouseID", "WarehouseCode", "VNName", "ENName", "AddressVN", "AddressEN", "Phone", "Fax", "Rank", "Used", "Note", "StoreID", "ProvinceID", "DistrictID" }, new object[] { item.Activity, item.Username, item.LanguageID, item.WarehouseID, item.WarehouseCode, item.VNName, item.ENName, item.AddressVN, item.AddressEN, item.Phone, item.Fax, item.Rank, item.Used, item.Note, item.StoreID, item.ProvinceID, item.DistrictID }); if (strError.Equals("")) { strError = this.InsertActionLog(new DTO.System.SYS_tblActionLogDTO { Activity = "Insert", Username = item.Username, LanguageID = item.LanguageID, ActionVN = "Cập Nhật", ActionEN = "Update", FunctionID = "18", DescriptionVN = string.Format("Tài khoản '{0}' vừa cập nhật thành công kho hàng có mã '{1}'.", item.Username, item.WarehouseCode), DescriptionEN = string.Format("Account '{0}' has updated new warehouse successfully with warehouse code is '{1}'.", item.Username, item.WarehouseCode) }); } return(strError); }
public string InsertWarehouse(PRO_tblWarehouseDTO item) { string strError = ""; try { strError = db.sExecuteSQL("PRO_spfrmWarehouse", new string[] { "Activity", "Username", "LanguageID", "WarehouseID", "WarehouseCode", "VNName", "ENName", "AddressVN", "AddressEN", "Phone", "Fax", "Rank", "Used", "Note", "StoreID", "ProvinceID", "DistrictID" }, new object[] { item.Activity, item.UserID, item.LanguageID, item.WarehouseID, item.WarehouseCode, item.VNName, item.ENName, item.AddressVN, item.AddressEN, item.Phone, item.Fax, item.Rank, item.Used, item.Note, item.StoreID, item.ProvinceID, item.DistrictID }); if (!string.IsNullOrEmpty(strError)) { logger.Error(strError); } return(strError); } catch (Exception ex) { logger.Error(ex); strError = ex.Message; } return(strError); }
private void LoadDataToEdit(PRO_tblWarehouseDTO item) { txtWarehouseID.EditValue = (item == null) ? null : item.WarehouseID; txtWarehouseCode.EditValue = (item == null) ? null : item.WarehouseCode; txtVNName.EditValue = (item == null) ? null : item.VNName; txtENName.EditValue = (item == null) ? null : item.ENName; txtAddressVN.EditValue = (item == null) ? null : item.AddressVN; txtAddressEN.EditValue = (item == null) ? null : item.AddressEN; txtPhone.EditValue = (item == null) ? null : item.Phone; txtFax.EditValue = (item == null) ? null : item.Fax; gluStore.EditValue = (item == null) ? null : item.StoreID; mmoNote.EditValue = (item == null) ? null : item.Note; speRank.EditValue = (item == null) ? null : item.Rank; chkUsed.Checked = (item == null) ? true : item.Used; gluProvince.EditValue = (item == null) ? null : item.ProvinceID; gluDistrict.EditValue = (item == null) ? null : item.DistrictID; if (item == null) { depError.ClearErrors(); this.ParentForm.Text = (User.UserInfo.LanguageID.Equals("VN")) ? "Thêm Mới Kho Hàng" : "Insert New Warehouse"; } txtWarehouseCode.Focus(); }
private void LoadDataToEdit(PRO_tblWarehouseDTO item) { txtWarehouseID.EditValue = (item == null) ? null : item.WarehouseID; txtWarehouseCode.EditValue = (item == null) ? null : item.WarehouseCode; //txtWarehouseCode.Properties.ReadOnly = (item == null) ? false : true; txtVNName.EditValue = (item == null) ? null : item.VNName; txtENName.EditValue = (item == null) ? null : item.ENName; gluStore.EditValue = (item == null) ? null : item.StoreID; txtAddressEN.EditValue = (item == null) ? null : item.AddressEN; txtAddressVN.EditValue = (item == null) ? null : item.AddressVN; gluProvince.EditValue = (item == null) ? null : item.ProvinceID; gluDistrict.EditValue = (item == null) ? null : item.DistrictID; txtPhone.EditValue = (item == null) ? null : item.Phone; txtFax.EditValue = (item == null) ? null : item.Fax; speRank.EditValue = (item == null) ? null : item.Rank; chkUsed.Checked = (item == null) ? true : item.Used; mmoNote.EditValue = (item == null) ? null : item.Note; if (item == null) { depError.ClearErrors(); this.ParentForm.Text = LanguageEngine.GetOpenFormText(this.Name, ConfigEngine.Language, false); txtWarehouseCode.Focus(); } }
public string UpdateWarehouse(PRO_tblWarehouseDTO item) { return(daoWarehouse.UpdateWarehouse(item)); }
public string InsertWarehouse(PRO_tblWarehouseDTO item) { return(daoWarehouse.InsertWarehouse(item)); }