public uc_StoreDetail(uc_Store parent, PRO_tblStoreDTO item) { InitializeComponent(); parentForm = parent; Initialize(); LoadDataToEdit(item); SetPermission(); }
public string UpdateStore(PRO_tblStoreDTO item) { return daoStore.UpdateStore(item); }
public string InsertStore(PRO_tblStoreDTO item) { return daoStore.InsertStore(item); }
public string InsertStore(PRO_tblStoreDTO item) { string strError = ""; strError = db.sExecuteSQL("PRO_spfrmStore", new string[] { "Activity", "Username", "LanguageID", "StoreID", "StoreCode", "ShortCode", "VNName", "ENName", "BuildDate", "EndDate", "AddressVN", "AddressEN", "Phone", "Fax", "Rank", "TaxCode", "Used", "IsRoot", "Representives", "Note", "Photo", "ProvinceID", "DistrictID" }, new object[] { item.Activity, item.Username, item.LanguageID, item.StoreID, item.StoreCode, item.ShortCode, item.VNName, item.ENName, item.BuildDate, item.EndDate, item.AddressVN, item.AddressEN, item.Phone, item.Fax, item.Rank, item.TaxCode, item.Used, item.IsRoot, item.Representatives, item.Note, item.Photo, item.ProvinceID, item.DistrictID }); if (strError.Equals("")) { strError = this.InsertActionLog(new DTO.System.SYS_tblActionLogDTO { Activity = item.Activity, Username = item.Username, LanguageID = item.LanguageID, ActionVN = "Thêm Mới", ActionEN = "Insert", FunctionID = "13", DescriptionVN = string.Format("Tài khoản '{0}' vừa thêm mới thành công cửa hàng có mã '{1}'.", item.Username, item.StoreCode), DescriptionEN = string.Format("Account '{0}' has inserted new store successfully with store code is '{1}'.", item.Username, item.StoreCode) }); } return strError; }
private bool SaveStore(bool isEdit) { string strError = ""; try { PRO_tblStoreDTO item = new PRO_tblStoreDTO { Activity = (isEdit) ? "Update" : "Insert", Username = User.UserInfo.Username, LanguageID = User.UserInfo.LanguageID, StoreID = txtStoreID.Text, StoreCode = txtStoreCode.Text, ShortCode = txtShortCode.Text, VNName = txtVNName.Text, ENName = txtENName.Text, BuildDate = dteBuildDate.EditValue, EndDate = dteEndDate.EditValue, AddressVN = txtAddressVN.Text, AddressEN = txtAddressEN.Text, Phone = txtPhone.Text, Fax = txtFax.Text, Rank = speRank.EditValue, TaxCode = txtTaxCode.Text, Used = chkUsed.Checked, IsRoot = chkIsRoot.Checked, Representatives = txtRepresentives.Text, Note = mmoNote.Text, Photo = picPhoto.EditValue, ProvinceID = gluProvince.EditValue + "", DistrictID = gluDistrict.EditValue + "" }; strError = (isEdit) ? busStore.UpdateStore(item) : busStore.InsertStore(item); if (strError != "") { Commons.ShowMessage(strError, 0); txtStoreCode.Focus(); return false; } else parentForm.LoadAllData(); } catch (Exception ex) { Commons.ShowExceptionMessage(ex); return false; } return true; }
private void LoadDataToEdit(PRO_tblStoreDTO item) { txtStoreID.EditValue = (item == null) ? null : item.StoreID; txtStoreCode.EditValue = (item == null) ? null : item.StoreCode; txtShortCode.EditValue = (item == null) ? null : item.ShortCode; txtVNName.EditValue = (item == null) ? null : item.VNName; txtENName.EditValue = (item == null) ? null : item.ENName; dteBuildDate.EditValue = (item == null) ? null : item.BuildDate; dteEndDate.EditValue = (item == null) ? null : item.EndDate; picPhoto.EditValue = (item == null) ? null : item.Photo; txtAddressVN.EditValue = (item == null) ? null : item.AddressVN; txtAddressEN.EditValue = (item == null) ? null : item.AddressEN; 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; txtTaxCode.EditValue = (item == null) ? null : item.TaxCode; speRank.EditValue = (item == null) ? null : item.Rank; txtRepresentives.EditValue = (item == null) ? null : item.Representatives; chkIsRoot.Checked = (item == null) ? false : item.IsRoot; chkUsed.Checked = (item == null) ? true : item.Used; mmoNote.EditValue = (item == null) ? null : item.Note; if (item == null) { depError.ClearErrors(); this.ParentForm.Text = (User.UserInfo.LanguageID.Equals("VN")) ? "Thêm Mới Cửa Hàng" : "Insert New Store"; } txtStoreCode.Focus(); }