Пример #1
0
        public async static Task<PRO_tblDistrictDRO> InsertUpdateDistrict(PRO_tblDistrictDTO item, SYS_tblActionLogDTO actionLog)
        {
            PRO_tblDistrictDRO result = new PRO_tblDistrictDRO();
            try
            {
                string url = string.Format(@"{0}/InsertUpdateDistrict", GetBaseUrl());
                var postData = new PRO_tblDistrictDCO
                {
                    DistrictID = item.DistrictID,
                    DistrictCode = item.DistrictCode,
                    VNName = item.VNName, 
                    ENName = item.ENName,
                    ProvinceID = item.ProvinceID,
                    Rank = item.Rank,
                    Used = item.Used,
                    Note = item.Note,
                    Activity = item.Activity,
                    UserID = item.UserID,
                    LanguageID = item.LanguageID
                };
                var json_data = "{\"district\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
                }) + "}";

                result = await PRO_tblDistrictDAO.InsertUpdateDistrict(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;
        }
Пример #2
0
        public PRO_tblDistrictDTO GetDataByID(string district_id, string username, string language_id)
        {
            PRO_tblDistrictDTO result = new PRO_tblDistrictDTO();
            try
            {
                DataTable data = db.GetDataTable("PRO_spfrmDistrict", new string[] { "Activity", "Username", "LanguageID", "DistrictID" }, new object[] { BaseConstant.COMMAND_GET_DATA_BY_ID_EN, username, language_id, district_id });
                if (data != null && data.Rows.Count > 0)
                {
                    result = ConvertEngine.ConvertDataTableToObjectList<PRO_tblDistrictDTO>(data)[0];
                    return result;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }

            return result;
        }
Пример #3
0
        public string InsertDistrict(PRO_tblDistrictDTO item)
        {
            string strError = "";
            try
            {
                strError = db.sExecuteSQL("PRO_spfrmDistrict", new string[] { "Activity", "Username", "LanguageID", "DistrictID", "DistrictCode", "ProvinceID", "VNName", "ENName", "Rank", "Used", "Note" }, new object[] { item.Activity, item.UserID, item.LanguageID, item.DistrictID, item.DistrictCode, item.ProvinceID, item.VNName, item.ENName, item.Rank, item.Used, item.Note });

                if (!string.IsNullOrEmpty(strError))
                    logger.Error(strError);

                return strError;
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                strError = ex.Message;
            }

            return strError;
        }
Пример #4
0
 public uc_DistrictDetail(uc_District _parent_form, PRO_tblDistrictDTO item = null)
 {
     CommonEngine.ShowWaitForm(this);
     InitializeComponent();
     Initialize();
     parent_form = _parent_form;
     if (item != null)
         LoadDataToEdit(item);
     CommonEngine.LoadUserPermission("12", txtDistrictID, btnSaveClose, btnSaveInsert);
 }
Пример #5
0
 private void LoadDataToEdit(PRO_tblDistrictDTO item)
 {
     txtDistrictID.EditValue = (item == null) ? null : item.DistrictID;
     txtDistrictCode.EditValue = (item == null) ? null : item.DistrictCode;
     //txtDistrictCode.Properties.ReadOnly = (item == null) ? false : true;
     txtVNName.EditValue = (item == null) ? null : item.VNName;
     txtENName.EditValue = (item == null) ? null : item.ENName;
     gluProvince.EditValue = (item == null) ? null : item.ProvinceID;
     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);
         txtDistrictCode.Focus();
     }
 }