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 PRO_tblProvinceDTO GetDataByID(string province_id, string username, string language_id)
        {
            PRO_tblProvinceDTO result = new PRO_tblProvinceDTO();
            try
            {
                DataTable data = db.GetDataTable("PRO_spfrmProvince", new string[] { "Activity", "Username", "LanguageID", "ProvinceID" }, new object[] { BaseConstant.COMMAND_GET_DATA_BY_ID_EN, username, language_id, province_id });
                if (data != null && data.Rows.Count > 0)
                {
                    result = ConvertEngine.ConvertDataTableToObjectList<PRO_tblProvinceDTO>(data)[0];
                    return result;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }

            return result;
        }
        public string InsertProvince(PRO_tblProvinceDTO item)
        {
            string strError = "";
            try
            {
                strError = db.sExecuteSQL("PRO_spfrmProvince", new string[] { "Activity", "Username", "LanguageID", "ProvinceID", "ProvinceCode", "VNName", "ENName", "Rank", "Used", "Note" }, new object[] { item.Activity, item.UserID, item.LanguageID, item.ProvinceID, item.ProvinceCode, 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;
        }
 public uc_ProvinceDetail(uc_Province _parent_form, PRO_tblProvinceDTO item = null)
 {
     CommonEngine.ShowWaitForm(this);
     InitializeComponent();
     Initialize();
     parent_form = _parent_form;
     if (item != null)
         LoadDataToEdit(item);
     CommonEngine.LoadUserPermission("8", txtProvinceID, btnSaveClose, btnSaveInsert);
 }
 private void LoadDataToEdit(PRO_tblProvinceDTO item)
 {
     txtProvinceID.EditValue = (item == null) ? null : item.ProvinceID;
     txtProvinceCode.EditValue = (item == null) ? null : item.ProvinceCode;
     //txtProvinceCode.Properties.ReadOnly = (item == null) ? false : true;
     txtVNName.EditValue = (item == null) ? null : item.VNName;
     txtENName.EditValue = (item == null) ? null : item.ENName;
     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);
         txtProvinceCode.Focus();
     }
 }