public async static Task <PRO_tblProvinceDRO> GetAllProvinces(string username, string language_id, bool is_combobox, SYS_tblActionLogDTO actionLog) { PRO_tblProvinceDRO result = new PRO_tblProvinceDRO(); try { string url = string.Format(@"{0}/GetAllProvinces?Username={1}&LanguageID={2}&GetCombobox={3}", GetBaseUrl(), username, language_id, is_combobox ? "True" : "False"); result = await PRO_tblProvinceDAO.GetAllProvinces(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 GetAllProvinces() { try { gridProvince.DataBindings.Clear(); PRO_tblProvinceDRO list = await PRO_tblProvinceBUS.GetAllProvinces(CommonEngine.userInfo.UserID, CommonEngine.userInfo.LanguageID, false, new 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 = "8", DescriptionVN = string.Format("Tài khoản '{0}' vừa tải thành công dữ liệu tỉnh thành.", CommonEngine.userInfo.UserID), DescriptionEN = string.Format("Account '{0}' downloaded successfully data of provinces.", CommonEngine.userInfo.UserID) }); if (!CommonEngine.CheckValidResponseItem(list.ResponseItem)) { return; } gridProvince.DataSource = list.ProvinceList != null ? list.ProvinceList : null; barBottom.Visible = (list.ProvinceList != null && list.ProvinceList.Count > 0) ? true : false; CommonEngine.LoadUserPermission("8", btnDelete, btnPrint, btnImport, btnExport); } catch (Exception ex) { CommonEngine.ShowExceptionMessage(ex); } }
public async static Task <PRO_tblProvinceDRO> InsertUpdateProvince(string url, string json_data) { PRO_tblProvinceDRO result = new PRO_tblProvinceDRO(); 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_tblProvinceDRO>(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 btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (curItem.Count > 0) { PRO_tblProvinceDRO item = await PRO_tblProvinceBUS.GetProvinceItem(CommonEngine.userInfo.UserID, ConfigEngine.Language, curItem[0].ProvinceID); if (item.ProvinceItem != null) { CommonEngine.OpenInputForm(new uc_ProvinceDetail(this, item.ProvinceItem), new Size(435, 265), true); } } }
private async Task LoadProvince() { gluProvince.DataBindings.Clear(); PRO_tblProvinceDRO provinces = await iPOS.BUS.Products.PRO_tblProvinceBUS.GetAllProvinces(CommonEngine.userInfo.UserID, ConfigEngine.Language, true, null); if (!CommonEngine.CheckValidResponseItem(provinces.ResponseItem)) { return; } gluProvince.Properties.DataSource = provinces.ProvinceList; gluProvince.Properties.ValueMember = "ProvinceID"; gluProvince.Properties.DisplayMember = "FullProvinceName"; }
private async void LoadProvince() { gluProvince.DataBindings.Clear(); PRO_tblProvinceDRO provinces = await PRO_tblProvinceBUS.GetAllProvinces(CommonEngine.userInfo.UserID, ConfigEngine.Language, true, null); if (provinces.ResponseItem.IsError) { CommonEngine.ShowHTTPErrorMessage(provinces.ResponseItem); gluProvince.Properties.DataSource = null; return; } gluProvince.Properties.DataSource = provinces.ProvinceList; gluProvince.Properties.ValueMember = "ProvinceID"; gluProvince.Properties.DisplayMember = "FullProvinceName"; }
public async static Task <PRO_tblProvinceDRO> GetProvinceItem(string username, string language_id, string province_id) { PRO_tblProvinceDRO result = new PRO_tblProvinceDRO(); try { string url = string.Format(@"{0}/GetProvinceByID?Username={1}&LanguageID={2}&ProvinceID={3}", GetBaseUrl(), username, language_id, province_id); result = await PRO_tblProvinceDAO.GetProvinceItem(url); } catch (Exception ex) { logger.Error(ex); result.ResponseItem.Message = ex.Message; } return(result); }
private async void btnDuplicated_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (curItem.Count > 0) { this.Cursor = Cursors.WaitCursor; PRO_tblProvinceDRO item = await PRO_tblProvinceBUS.GetProvinceItem(CommonEngine.userInfo.Username, ConfigEngine.Language, curItem[0].ProvinceID); if (!CommonEngine.CheckValidResponseItem(item.ResponseItem)) { return; } this.Cursor = Cursors.Default; if (item != null && item.ProvinceItem != null) { item.ProvinceItem.ProvinceID = ""; CommonEngine.OpenInputForm(new uc_ProvinceDetail(this, item.ProvinceItem), new Size(435, 265), true); } } }
public async static Task <PRO_tblProvinceDRO> InsertUpdateProvince(PRO_tblProvinceDTO item, SYS_tblActionLogDTO actionLog) { PRO_tblProvinceDRO result = new PRO_tblProvinceDRO(); try { string url = string.Format(@"{0}/InsertUpdateProvince", GetBaseUrl()); var postData = new PRO_tblProvinceDCO { ProvinceID = item.ProvinceID, ProvinceCode = item.ProvinceCode, VNName = item.VNName, ENName = item.ENName, Rank = item.Rank, Used = item.Used, Note = item.Note, Activity = item.Activity, UserID = item.UserID, LanguageID = item.LanguageID }; var json_data = "{\"province\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.MicrosoftDateFormat }) + "}"; result = await PRO_tblProvinceDAO.InsertUpdateProvince(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_tblProvinceDRO> DeleteProvince(string username, string language_id, string province_id_list, SYS_tblActionLogDTO actionLog) { PRO_tblProvinceDRO result = new PRO_tblProvinceDRO(); try { string url = string.Format(@"{0}/DeleteProvince?Username={1}&LanguageID={2}&ProvinceIDList={3}", GetBaseUrl(), username, language_id, province_id_list); result = await PRO_tblProvinceDAO.DeleteProvince(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 DeleteProvince() { province_code_list = ""; province_id_list = ""; foreach (int index in grvProvince.GetSelectedRows()) { province_code_list = string.Join("$", province_code_list, grvProvince.GetRowCellDisplayText(index, gcolProvinceCode)); province_id_list = string.Join("$", province_id_list, grvProvince.GetRowCellDisplayText(index, gcolProvinceID)); } if (province_code_list.Length > 0) { province_code_list = province_code_list.Substring(1); } if (province_id_list.Length > 0) { province_id_list = province_id_list.Substring(1); } PRO_tblProvinceDRO result = new PRO_tblProvinceDRO(); result.ResponseItem.Message = "ready"; if (!string.IsNullOrEmpty(province_id_list)) { try { if (province_id_list.Contains("$")) { if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000012", ConfigEngine.Language).Replace("$Count$", province_id_list.Split('$').Length.ToString()))) { CommonEngine.ShowWaitForm(this); result = await PRO_tblProvinceBUS.DeleteProvince(CommonEngine.userInfo.Username, ConfigEngine.Language, province_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 = "8", DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công những tỉnh thành có mã '{1}'.", CommonEngine.userInfo.UserID, province_code_list.Replace("$", ", ")), DescriptionEN = string.Format("Account '{0}' has deleted provinces successfully with province codes are '{1}'.", CommonEngine.userInfo.UserID, province_code_list.Replace("$", ", ")) }); } } else { if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000005", ConfigEngine.Language))) { CommonEngine.ShowWaitForm(this.ParentForm); result = await PRO_tblProvinceBUS.DeleteProvince(CommonEngine.userInfo.Username, ConfigEngine.Language, province_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 = "8", DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công tỉnh thành có mã '{1}'.", CommonEngine.userInfo.UserID, province_code_list), DescriptionEN = string.Format("Account '{0}' has deleted province successfully with province code is '{1}'.", CommonEngine.userInfo.UserID, province_code_list) }); } } if (!CommonEngine.CheckValidResponseItem(result.ResponseItem)) { return; } if (!result.ResponseItem.Message.Equals("ready")) { if (string.IsNullOrEmpty(result.ResponseItem.Message)) { GetAllProvinces(); } else { CommonEngine.ShowMessage(result.ResponseItem.Message, 0); } } } catch (Exception ex) { CommonEngine.ShowExceptionMessage(ex); } finally { CommonEngine.CloseWaitForm(); } } else { CommonEngine.ShowMessage("000027", IMC.Helper.MessageType.Warning, true); } }
private async Task <bool> SaveProvince(bool isEdit) { PRO_tblProvinceDRO result = new PRO_tblProvinceDRO(); CommonEngine.ShowWaitForm(this); try { result = await PRO_tblProvinceBUS.InsertUpdateProvince(new PRO_tblProvinceDTO { ProvinceID = isEdit ? txtProvinceID.Text : "0", ProvinceCode = txtProvinceCode.Text, VNName = txtVNName.Text, ENName = txtENName.Text, Rank = speRank.EditValue != null ? Convert.ToInt32(speRank.Value) : (Int32?)null, Used = chkUsed.Checked, Note = mmoNote.Text, UserID = CommonEngine.userInfo.UserID, Activity = (isEdit) ? BaseConstant.COMMAND_UPDATE_EN : BaseConstant.COMMAND_INSERT_EN, 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 = "8", DescriptionVN = string.Format("Tài khoản '{0}' vừa {1} thành công tỉnh thành có mã tỉnh là '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "cập nhật" : "thêm mới", txtProvinceCode.Text), DescriptionEN = string.Format("Account '{0}' has {1} province successfully with province code is '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "updated" : "inserted", txtProvinceCode.Text) }); if (CommonEngine.CheckValidResponseItem(result.ResponseItem)) { if (!string.IsNullOrEmpty(result.ResponseItem.Message)) { CommonEngine.CloseWaitForm(); CommonEngine.ShowMessage(result.ResponseItem.Message, 0); txtProvinceCode.Focus(); return(false); } else if (parent_form != null) { parent_form.GetAllProvinces(); } } else { CommonEngine.CloseWaitForm(); return(false); } } catch (Exception ex) { CommonEngine.ShowExceptionMessage(ex); return(false); } finally { CommonEngine.CloseWaitForm(); } return(true); }