Пример #1
0
 public uc_StallDetail(uc_Stall parent, PRO_tblStallDTO item)
 {
     InitializeComponent();
     parentForm = parent;
     Initialize();
     LoadDataToEdit(item);
     SetPermission();
 }
Пример #2
0
 private void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (curRow != null)
     {
         PRO_tblStallDTO item = busStall.GetDataByID(curRow["StallID"] + "", User.UserInfo.Username, User.UserInfo.LanguageID);
         if (item != null)
         {
             Commons.OpenInputForm(new uc_StallDetail(this, item), "Cập Nhật Quầy Bán", "Update Stall", new Size(395, 280));
         }
     }
 }
Пример #3
0
 public uc_StallDetail(uc_Stall _parent_form, PRO_tblStallDTO item = null)
 {
     CommonEngine.ShowWaitForm(this);
     InitializeComponent();
     Initialize();
     parent_form = _parent_form;
     if (item != null)
     {
         LoadDataToEdit(item);
     }
     CommonEngine.LoadUserPermission("19", txtStallID, btnSaveClose, btnSaveInsert);
 }
Пример #4
0
 private void LoadDataToEdit(PRO_tblStallDTO item)
 {
     txtStallID.EditValue   = item == null ? null : item.StallID;
     txtStallCode.EditValue = item == null ? null : item.StallCode;
     txtVNName.EditValue    = item == null ? null : item.VNName;
     txtENName.EditValue    = item == null ? null : item.ENName;
     gluWarehouse.EditValue = item == null ? null : item.WarehouseID;
     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 = (User.UserInfo.LanguageID.Equals("VN")) ? "Thêm Mới Quầy Bán" : "Insert New Stall";
     }
     txtStallCode.Focus();
 }
Пример #5
0
 private void LoadDataToEdit(PRO_tblStallDTO item)
 {
     txtStallID.EditValue   = (item == null) ? null : item.StallID;
     txtStallCode.EditValue = (item == null) ? null : item.StallCode;
     //txtStallCode.Properties.ReadOnly = (item == null) ? false : true;
     txtVNName.EditValue    = (item == null) ? null : item.VNName;
     txtENName.EditValue    = (item == null) ? null : item.ENName;
     gluStore.EditValue     = (item == null) ? null : item.StoreID;
     gluWarehouse.EditValue = (item == null) ? null : item.WarehouseID;
     speRank.EditValue      = (item == null) ? null : item.Rank;
     mmoNote.EditValue      = (item == null) ? null : item.Note;
     if (item == null)
     {
         depError.ClearErrors();
         this.ParentForm.Text = LanguageEngine.GetOpenFormText(this.Name, ConfigEngine.Language, false);
         txtStallCode.Focus();
     }
 }
Пример #6
0
        public async static Task <PRO_tblStallDRO> InsertUpdateStall(PRO_tblStallDTO item, SYS_tblActionLogDTO actionLog)
        {
            PRO_tblStallDRO result = new PRO_tblStallDRO();

            try
            {
                string url      = string.Format(@"{0}/InsertUpdateStall", GetBaseUrl());
                var    postData = new PRO_tblStallDCO
                {
                    StallID     = item.StallID,
                    StallCode   = item.StallCode,
                    VNName      = item.VNName,
                    ENName      = item.ENName,
                    StoreID     = item.StoreID,
                    WarehouseID = item.WarehouseID,
                    Rank        = item.Rank,
                    Used        = item.Used,
                    Note        = item.Note,
                    UserID      = item.UserID,
                    Activity    = item.Activity,
                    LanguageID  = item.LanguageID
                };
                var json_data = "{\"stall\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
                }) + "}";

                result = await PRO_tblStallDAO.InsertUpdateStall(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);
        }
Пример #7
0
        public PRO_tblStallDTO GetDataByID(string username, string language_id, string stall_id)
        {
            PRO_tblStallDTO result = new PRO_tblStallDTO();

            try
            {
                DataTable data = db.GetDataTable("PRO_spfrmStall", new string[] { "Activity", "Username", "LanguageID", "StallID" }, new object[] { BaseConstant.COMMAND_GET_DATA_BY_ID_EN, username, language_id, stall_id });
                if (data != null && data.Rows.Count > 0)
                {
                    result = ConvertEngine.ConvertDataTableToObjectList <PRO_tblStallDTO>(data)[0];
                    return(result);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }

            return(result);
        }
Пример #8
0
        private bool SaveStall(bool isEdit)
        {
            string strError = "";

            try
            {
                PRO_tblStallDTO item = new PRO_tblStallDTO
                {
                    Activity    = (isEdit) ? "Update" : "Insert",
                    Username    = User.UserInfo.Username,
                    LanguageID  = User.UserInfo.LanguageID,
                    StallID     = txtStallID.Text,
                    StallCode   = txtStallCode.Text,
                    VNName      = txtVNName.Text,
                    ENName      = txtENName.Text,
                    WarehouseID = gluWarehouse.EditValue + "",
                    Rank        = speRank.EditValue,
                    Used        = chkUsed.Checked,
                    Note        = mmoNote.Text
                };
                strError = (isEdit) ? busStall.UpdateStall(item) : busStall.InsertStall(item);
                if (strError != "")
                {
                    Commons.ShowMessage(strError, 0);
                    txtStallCode.Focus();
                    return(false);
                }
                else
                {
                    parentForm.LoadAllData();
                }
            }
            catch (Exception ex)
            {
                Commons.ShowExceptionMessage(ex);
                return(false);
            }

            return(true);
        }
Пример #9
0
        public string UpdateStall(PRO_tblStallDTO item)
        {
            string strError = "";

            strError = db.sExecuteSQL("PRO_spfrmStall", new string[] { "Activity", "Username", "LanguageID", "StallID", "StallCode", "VNName", "ENName", "WarehouseID", "Rank", "Used", "Note" }, new object[] { item.Activity, item.Username, item.LanguageID, item.StallID, item.StallCode, item.VNName, item.ENName, item.WarehouseID, item.Rank, item.Used, item.Note });

            if (strError.Equals(""))
            {
                strError = this.InsertActionLog(new DTO.System.SYS_tblActionLogDTO
                {
                    Activity      = "Insert",
                    Username      = item.Username,
                    LanguageID    = item.LanguageID,
                    ActionVN      = "Cập Nhật",
                    ActionEN      = "Update",
                    FunctionID    = "19",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa cập nhật thành công quầy bán có mã '{1}'.", item.Username, item.StallCode),
                    DescriptionEN = string.Format("Account '{0}' has updated new stall successfully with stall code is '{1}'.", item.Username, item.StallCode)
                });
            }

            return(strError);
        }
Пример #10
0
        public string InsertStall(PRO_tblStallDTO item)
        {
            string strError = "";

            try
            {
                strError = db.sExecuteSQL("PRO_spfrmStall", new string[] { "Activity", "Username", "LanguageID", "StallID", "StallCode", "VNName", "ENName", "Rank", "Used", "Note", "StoreID", "WarehouseID" }, new object[] { item.Activity, item.UserID, item.LanguageID, item.StallID, item.StallCode, item.VNName, item.ENName, item.Rank, item.Used, item.Note, item.StoreID, item.WarehouseID });

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

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

            return(strError);
        }
Пример #11
0
 public string UpdateStall(PRO_tblStallDTO item)
 {
     return(daoStall.UpdateStall(item));
 }
Пример #12
0
 public string InsertStall(PRO_tblStallDTO item)
 {
     return(daoStall.InsertStall(item));
 }