Exemple #1
0
        public async static Task<PRO_tblLevel3DRO> InsertUpdateLevel3(string url, string json_data)
        {
            PRO_tblLevel3DRO result = new PRO_tblLevel3DRO();
            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_tblLevel3DRO>(response_data + "");

                    if (response_collection != null)
                    {
                        result.ResponseItem = response_collection.ResponseItem;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result.ResponseItem.Message = ex.Message;
            }

            return result;
        }
Exemple #2
0
        private async Task<bool> SaveLevel3(bool isEdit)
        {
            CommonEngine.ShowWaitForm(this);
            PRO_tblLevel3DRO result = new PRO_tblLevel3DRO();
            try
            {
                result = await PRO_tblLevel3BUS.InsertUpdateLevel3(new PRO_tblLevel3DTO
                {
                    Level3ID = isEdit ? txtLevel3ID.Text : "0",
                    Level3Code = txtLevel3Code.Text.Trim(),
                    Level3ShortCode = txtLevel3ShortCode.Text.Trim(),
                    Level1ID = gluLevel1.EditValue + "",
                    Level2ID = gluLevel2.EditValue + "",
                    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 = "22",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa {1} thành công phân nhóm có mã phân nhóm là '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "cập nhật" : "thêm mới", txtLevel3Code.Text),
                    DescriptionEN = string.Format("Account '{0}' has {1} product subgroup successfully with subgroup code is '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "updated" : "inserted", txtLevel3Code.Text)
                });

                if (CommonEngine.CheckValidResponseItem(result.ResponseItem))
                {
                    if (!string.IsNullOrEmpty(result.ResponseItem.Message))
                    {
                        CommonEngine.CloseWaitForm();
                        CommonEngine.ShowMessage(result.ResponseItem.Message, 0);
                        txtLevel3Code.Focus();
                        return false;
                    }
                    else if (parent_form != null) parent_form.GetAllLevel3();
                }
                else
                {
                    CommonEngine.CloseWaitForm();
                    return false;
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
                return false;
            }
            finally
            {
                CommonEngine.CloseWaitForm();
            }

            return true;
        }