public async static Task <PRO_tblLevel1DRO> GetAllLevel1(string username, string language_id, bool is_combobox, SYS_tblActionLogDTO actionLog) { PRO_tblLevel1DRO result = new PRO_tblLevel1DRO(); try { string url = string.Format(@"{0}/GetAllLevel1?Username={1}&LanguageID={2}&GetCombobox={3}", GetBaseUrl(), username, language_id, is_combobox ? "True" : "False"); result = await PRO_tblLevel1DAO.GetAllLevel1(url); if (string.IsNullOrEmpty(result.ResponseItem.Message)) { if (actionLog != null) { result.ResponseItem = await SYS_tblActionLogBUS.InsertUpdateLog(actionLog); } } } catch (Exception ex) { logger.Error(ex); result.ResponseItem.Message = ex.Message; } return(result); }
public async void GetAllLevel1() { try { gridLevel1.DataBindings.Clear(); PRO_tblLevel1DRO level1s = await PRO_tblLevel1BUS.GetAllLevel1(CommonEngine.userInfo.UserID, ConfigEngine.Language, false, new DTO.Systems.SYS_tblActionLogDTO { Activity = BaseConstant.COMMAND_INSERT_EN, UserID = CommonEngine.userInfo.UserID, LanguageID = ConfigEngine.Language, ActionEN = BaseConstant.COMMAND_LOAD_ALL_DATA_EN, ActionVN = BaseConstant.COMMAND_LOAD_ALL_DATA_VI, FunctionID = "20", DescriptionVN = string.Format("Tài khoản '{0}' vừa tải thành công dữ liệu ngành hàng.", CommonEngine.userInfo.UserID), DescriptionEN = string.Format("Account '{0}' downloaded successfully data of product sector.", CommonEngine.userInfo.UserID) }); if (!CommonEngine.CheckValidResponseItem(level1s.ResponseItem)) { return; } gridLevel1.DataSource = level1s.Level1List != null ? level1s.Level1List : null; barBottom.Visible = (level1s.Level1List != null && level1s.Level1List.Count > 0) ? true : false; CommonEngine.LoadUserPermission("20", btnDelete, btnPrint, btnImport, btnExport); } catch (Exception ex) { CommonEngine.ShowExceptionMessage(ex); } }
public async static Task <PRO_tblLevel1DRO> InsertUpdateLevel1(string url, string json_data) { PRO_tblLevel1DRO result = new PRO_tblLevel1DRO(); try { var response_data = await HttpPost(url, json_data); if (response_data.ToLower().StartsWith("error")) { result.ResponseItem.IsError = true; string[] tmp = response_data.Split('|'); result.ResponseItem.ErrorCode = tmp[1]; result.ResponseItem.ErrorMessage = tmp[2]; } else { var response_collection = JsonConvert.DeserializeObject <PRO_tblLevel1DRO>(response_data + ""); if (response_collection != null) { result.ResponseItem = response_collection.ResponseItem; } } } catch (Exception ex) { logger.Error(ex); result.ResponseItem.Message = ex.Message; } return(result); }
private async void LoadLevel1() { PRO_tblLevel1DRO level1s = await PRO_tblLevel1BUS.GetAllLevel1(CommonEngine.userInfo.UserID, ConfigEngine.Language, true, null); gluLevel1.DataBindings.Clear(); if (level1s.ResponseItem.IsError) { CommonEngine.ShowHTTPErrorMessage(level1s.ResponseItem); return; } gluLevel1.Properties.DataSource = level1s.Level1List; gluLevel1.Properties.ValueMember = "Level1ID"; gluLevel1.Properties.DisplayMember = "FullLevel1Name"; }
private async void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (curItem.Count > 0) { PRO_tblLevel1DRO item = await PRO_tblLevel1BUS.GetLevel1ByID(CommonEngine.userInfo.UserID, ConfigEngine.Language, curItem[0].Level1ID); if (!CommonEngine.CheckValidResponseItem(item.ResponseItem)) { return; } if (item != null && item.Level1Item != null) { CommonEngine.OpenInputForm(new uc_Level1Detail(this, item.Level1Item), new Size(450, 300), true); } } }
public async static Task <PRO_tblLevel1DRO> GetLevel1ByID(string username, string language_id, string level1_id) { PRO_tblLevel1DRO result = new PRO_tblLevel1DRO(); try { string url = string.Format(@"{0}/GetLevel1ByID?Username={1}&LanguageID={2}&Level1ID={3}", GetBaseUrl(), username, language_id, level1_id); result = await PRO_tblLevel1DAO.GetLevel1ByID(url); } catch (Exception ex) { logger.Error(ex); result.ResponseItem.Message = ex.Message; } return(result); }
public async static Task <PRO_tblLevel1DRO> InsertUpdateLevel1(PRO_tblLevel1DTO item, SYS_tblActionLogDTO actionLog) { PRO_tblLevel1DRO result = new PRO_tblLevel1DRO(); try { string url = string.Format(@"{0}/InsertUpdateLevel1", GetBaseUrl()); var postData = new PRO_tblLevel1DCO { Level1ID = item.Level1ID, Level1Code = item.Level1Code, Level1ShortCode = item.Level1ShortCode, VNName = item.VNName, ENName = item.ENName, Rank = string.IsNullOrEmpty(item.Rank) ? null : item.Rank, Note = item.Note, Description = item.Description, Used = item.Used, Activity = item.Activity, UserID = item.UserID, LanguageID = item.LanguageID }; var json_data = "{\"level1\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.MicrosoftDateFormat }) + "}"; result = await PRO_tblLevel1DAO.InsertUpdateLevel1(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); }
public async static Task <PRO_tblLevel1DRO> DeleteLevel1(string username, string language_id, string level1_id_list, SYS_tblActionLogDTO actionLog) { PRO_tblLevel1DRO result = new PRO_tblLevel1DRO(); try { string url = string.Format(@"{0}/DeleteLevel1?Username={1}&LanguageID={2}&Level1IDList={3}", GetBaseUrl(), username, language_id, level1_id_list); result = await PRO_tblLevel1DAO.DeleteLevel1(url); 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 async Task DeleteLevel1() { level1_code_list = ""; level1_id_list = ""; foreach (int index in grvLevel1.GetSelectedRows()) { level1_code_list = string.Join("$", level1_code_list, grvLevel1.GetRowCellDisplayText(index, gcolLevel1Code)); level1_id_list = string.Join("$", level1_id_list, grvLevel1.GetRowCellDisplayText(index, gcolLevel1ID)); } if (level1_code_list.Length > 0) { level1_code_list = level1_code_list.Substring(1); } if (level1_id_list.Length > 0) { level1_id_list = level1_id_list.Substring(1); } if (!string.IsNullOrEmpty(level1_id_list)) { PRO_tblLevel1DRO result = new PRO_tblLevel1DRO(); result.ResponseItem.Message = "ready"; try { if (level1_id_list.Contains("$")) { if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000012", ConfigEngine.Language).Replace("$Count$", level1_id_list.Split('$').Length.ToString()))) { CommonEngine.ShowWaitForm(this); result = await PRO_tblLevel1BUS.DeleteLevel1(CommonEngine.userInfo.Username, ConfigEngine.Language, level1_id_list, new SYS_tblActionLogDTO { Activity = BaseConstant.COMMAND_INSERT_EN, UserID = CommonEngine.userInfo.UserID, LanguageID = ConfigEngine.Language, ActionVN = BaseConstant.COMMAND_DELETE_VI, ActionEN = BaseConstant.COMMAND_DELETE_EN, FunctionID = "20", DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công những ngành hàng có mã '{1}'.", CommonEngine.userInfo.UserID, level1_code_list.Replace("$", ", ")), DescriptionEN = string.Format("Account '{0}' has deleted product sectors successfully with sector codes are '{1}'.", CommonEngine.userInfo.UserID, level1_code_list.Replace("$", ", ")) }); } } else { if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000005", ConfigEngine.Language))) { CommonEngine.ShowWaitForm(this); result = await PRO_tblLevel1BUS.DeleteLevel1(CommonEngine.userInfo.Username, ConfigEngine.Language, level1_id_list, new SYS_tblActionLogDTO { Activity = BaseConstant.COMMAND_INSERT_EN, UserID = CommonEngine.userInfo.UserID, LanguageID = ConfigEngine.Language, ActionVN = BaseConstant.COMMAND_DELETE_VI, ActionEN = BaseConstant.COMMAND_DELETE_EN, FunctionID = "20", DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công ngành hàng có mã '{1}'.", CommonEngine.userInfo.UserID, level1_code_list), DescriptionEN = string.Format("Account '{0}' has deleted product sector successfully with sector code is '{1}'.", CommonEngine.userInfo.UserID, level1_code_list) }); } } if (!CommonEngine.CheckValidResponseItem(result.ResponseItem)) { return; } if (!result.ResponseItem.Message.Equals("ready")) { if (string.IsNullOrEmpty(result.ResponseItem.Message)) { GetAllLevel1(); } else { CommonEngine.ShowMessage(result.ResponseItem.Message, 0); } } } catch (Exception ex) { CommonEngine.ShowExceptionMessage(ex); } finally { CommonEngine.CloseWaitForm(); } } else { CommonEngine.ShowMessage(LanguageEngine.GetMessageCaption("000027", ConfigEngine.Language), MessageType.Error); } }
private async Task <bool> SaveLevel1(bool isEdit) { CommonEngine.ShowWaitForm(this); PRO_tblLevel1DRO result = new PRO_tblLevel1DRO(); try { result = await PRO_tblLevel1BUS.InsertUpdateLevel1(new PRO_tblLevel1DTO { Level1ID = isEdit ? txtLevel1ID.Text : "0", Level1Code = txtLevel1Code.Text.Trim(), Level1ShortCode = txtLevel1ShortCode.Text.Trim(), VNName = txtVNName.Text.Trim(), ENName = txtENName.Text.Trim(), Rank = speRank.Text.Trim(), Used = chkUsed.Checked, Note = mmoNote.Text.Trim(), Description = mmoDescription.Text.Trim(), Activity = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN, UserID = CommonEngine.userInfo.UserID, LanguageID = ConfigEngine.Language }, new DTO.Systems.SYS_tblActionLogDTO { Activity = BaseConstant.COMMAND_INSERT_EN, UserID = CommonEngine.userInfo.UserID, LanguageID = ConfigEngine.Language, ActionEN = isEdit ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN, ActionVN = isEdit ? BaseConstant.COMMAND_UPDATE_VI : BaseConstant.COMMAND_INSERT_VI, FunctionID = "20", DescriptionVN = string.Format("Tài khoản '{0}' vừa {1} thành công ngành hàng có mã ngành hàng là '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "cập nhật" : "thêm mới", txtLevel1Code.Text), DescriptionEN = string.Format("Account '{0}' has {1} product sector successfully with sector code is '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "updated" : "inserted", txtLevel1Code.Text) }); if (CommonEngine.CheckValidResponseItem(result.ResponseItem)) { if (!string.IsNullOrEmpty(result.ResponseItem.Message)) { CommonEngine.CloseWaitForm(); CommonEngine.ShowMessage(result.ResponseItem.Message, 0); txtLevel1Code.Focus(); return(false); } else if (parent_form != null) { parent_form.GetAllLevel1(); } } else { CommonEngine.CloseWaitForm(); return(false); } } catch (Exception ex) { CommonEngine.ShowExceptionMessage(ex); return(false); } finally { CommonEngine.CloseWaitForm(); } return(true); }