Пример #1
0
        public async void GetAllStall(string store_id, string warehouse_id)
        {
            try
            {
                gridStall.DataBindings.Clear();
                PRO_tblStallDRO stalls = await PRO_tblStallBUS.GetAllStall(CommonEngine.userInfo.UserID, ConfigEngine.Language, false, store_id, warehouse_id, 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    = "19",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa tải thành công dữ liệu quầy bán.", CommonEngine.userInfo.UserID),
                    DescriptionEN = string.Format("Account '{0}' downloaded successfully data of stalls.", CommonEngine.userInfo.UserID)
                });

                if (!CommonEngine.CheckValidResponseItem(stalls.ResponseItem))
                {
                    return;
                }
                gridStall.DataSource = stalls.StallList != null ? stalls.StallList : null;
                barFooter.Visible    = (stalls.StallList != null && stalls.StallList.Count > 0) ? true : false;
                CommonEngine.LoadUserPermission("19", btnDelete, btnPrint, btnImport, btnExport);
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
        }
Пример #2
0
        public async static Task <PRO_tblStallDRO> GetAllStall(string username, string language_id, bool is_combobox, string store_id, string warehouse_id, SYS_tblActionLogDTO actionLog)
        {
            PRO_tblStallDRO result = new PRO_tblStallDRO();

            try
            {
                string url = string.Format(@"{0}/GetAllStalls?Username={1}&LanguageID={2}&StoreID={3}&WarehouseID={4}&GetCombobox={5}", GetBaseUrl(), username, language_id, store_id, warehouse_id, is_combobox ? "True" : "False");

                result = await PRO_tblStallDAO.GetAllStalls(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);
        }
Пример #3
0
        public async static Task <PRO_tblStallDRO> InsertUpdateStall(string url, string json_data)
        {
            PRO_tblStallDRO result = new PRO_tblStallDRO();

            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_tblStallDRO>(response_data + "");

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

            return(result);
        }
Пример #4
0
        public async static Task<PRO_tblStallDRO> InsertUpdateStall(string url, string json_data)
        {
            PRO_tblStallDRO result = new PRO_tblStallDRO();
            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_tblStallDRO>(response_data + "");

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

            return result;
        }
Пример #5
0
        private async void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (curItem.Count > 0)
            {
                PRO_tblStallDRO item = await PRO_tblStallBUS.GetStallItem(CommonEngine.userInfo.UserID, ConfigEngine.Language, curItem[0].StallID);

                if (!CommonEngine.CheckValidResponseItem(item.ResponseItem))
                {
                    return;
                }

                if (item != null && item.StallItem != null)
                {
                    CommonEngine.OpenInputForm(new uc_StallDetail(this, item.StallItem), new Size(395, 300), true);
                }
            }
        }
Пример #6
0
        public async static Task<PRO_tblStallDRO> GetStallItem(string username, string language_id, string stall_id)
        {
            PRO_tblStallDRO result = new PRO_tblStallDRO();
            try
            {
                string url = string.Format(@"{0}/GetStallByID?Username={1}&LanguageID={2}&StallID={3}", GetBaseUrl(), username, language_id, stall_id);

                result = await PRO_tblStallDAO.GetStallItem(url);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result.ResponseItem.Message = ex.Message;
            }

            return result;
        }
Пример #7
0
        public async static Task <PRO_tblStallDRO> GetStallItem(string username, string language_id, string stall_id)
        {
            PRO_tblStallDRO result = new PRO_tblStallDRO();

            try
            {
                string url = string.Format(@"{0}/GetStallByID?Username={1}&LanguageID={2}&StallID={3}", GetBaseUrl(), username, language_id, stall_id);

                result = await PRO_tblStallDAO.GetStallItem(url);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                result.ResponseItem.Message = ex.Message;
            }

            return(result);
        }
Пример #8
0
        public async static Task<PRO_tblStallDRO> GetAllStall(string username, string language_id, bool is_combobox, string store_id, string warehouse_id, SYS_tblActionLogDTO actionLog)
        {
            PRO_tblStallDRO result = new PRO_tblStallDRO();
            try
            {
                string url = string.Format(@"{0}/GetAllStalls?Username={1}&LanguageID={2}&StoreID={3}&WarehouseID={4}&GetCombobox={5}", GetBaseUrl(), username, language_id, store_id, warehouse_id, is_combobox ? "True" : "False");

                result = await PRO_tblStallDAO.GetAllStalls(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;
        }
Пример #9
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);
        }
Пример #10
0
        public async static Task <PRO_tblStallDRO> DeleteStall(string username, string language_id, string stall_id_list, SYS_tblActionLogDTO actionLog)
        {
            PRO_tblStallDRO result = new PRO_tblStallDRO();

            try
            {
                string url = string.Format(@"{0}/DeleteStall?Username={1}&LanguageID={2}&StallIDList={3}", GetBaseUrl(), username, language_id, stall_id_list);

                result = await PRO_tblStallDAO.DeleteStall(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);
        }
Пример #11
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;
        }
Пример #12
0
        private async Task DeleteStall()
        {
            stall_code_list = "";
            stall_id_list   = "";
            foreach (int index in grvStall.GetSelectedRows())
            {
                stall_code_list = string.Join("$", stall_code_list, grvStall.GetRowCellDisplayText(index, gcolStallCode));
                stall_id_list   = string.Join("$", stall_id_list, grvStall.GetRowCellDisplayText(index, gcolStallID));
            }

            if (stall_code_list.Length > 0)
            {
                stall_code_list = stall_code_list.Substring(1);
            }
            if (stall_id_list.Length > 0)
            {
                stall_id_list = stall_id_list.Substring(1);
            }

            PRO_tblStallDRO result = new PRO_tblStallDRO();

            result.ResponseItem.Message = "ready";
            if (!string.IsNullOrEmpty(stall_id_list))
            {
                try
                {
                    if (stall_id_list.Contains("$"))
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000012", ConfigEngine.Language).Replace("$Count$", stall_id_list.Split('$').Length.ToString())))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await PRO_tblStallBUS.DeleteStall(stall_id_list, CommonEngine.userInfo.Username, ConfigEngine.Language, 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    = "19",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công những quầy bán có mã '{1}'.", CommonEngine.userInfo.UserID, stall_code_list.Replace("$", ", ")),
                                DescriptionEN = string.Format("Account '{0}' has deleted stalls successfully with stall codes are '{1}'.", CommonEngine.userInfo.UserID, stall_code_list.Replace("$", ", "))
                            });
                        }
                    }
                    else
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000005", ConfigEngine.Language)))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await PRO_tblStallBUS.DeleteStall(stall_id_list, CommonEngine.userInfo.Username, ConfigEngine.Language, 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    = "19",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công quầy bán có mã '{1}'.", CommonEngine.userInfo.UserID, stall_code_list),
                                DescriptionEN = string.Format("Account '{0}' has deleted stall successfully with stall code is '{1}'.", CommonEngine.userInfo.UserID, stall_code_list)
                            });
                        }
                    }

                    if (!CommonEngine.CheckValidResponseItem(result.ResponseItem))
                    {
                        return;
                    }
                    if (!result.ResponseItem.Message.Equals("ready"))
                    {
                        if (string.IsNullOrEmpty(result.ResponseItem.Message))
                        {
                            GetAllStall("", "");
                        }
                        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);
            }
        }
Пример #13
0
        private async Task <bool> SaveStall(bool isEdit)
        {
            CommonEngine.ShowWaitForm(this);
            PRO_tblStallDRO result = new PRO_tblStallDRO();

            try
            {
                result = await iPOS.BUS.Products.PRO_tblStallBUS.InsertUpdateStall(new PRO_tblStallDTO
                {
                    StallID     = isEdit ? txtStallID.Text : "0",
                    StallCode   = txtStallCode.Text.Trim(),
                    VNName      = txtVNName.Text.Trim(),
                    ENName      = txtENName.Text.Trim(),
                    StoreID     = gluStore.EditValue + "",
                    WarehouseID = gluWarehouse.EditValue + "",
                    Rank        = speRank.EditValue + "",
                    Used        = chkUsed.Checked,
                    Note        = mmoNote.Text.Trim(),
                    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    = "19",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa {1} thành công quầy bán có mã quầy là '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "cập nhật" : "thêm mới", txtStallCode.Text),
                    DescriptionEN = string.Format("Account '{0}' has {1} stall successfully with stall code is '{2}'.", CommonEngine.userInfo.UserID, isEdit ? "updated" : "inserted", txtStallCode.Text)
                });

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

            return(true);
        }
Пример #14
0
        private async Task DeleteStall()
        {
            stall_code_list = "";
            stall_id_list = "";
            foreach (int index in grvStall.GetSelectedRows())
            {
                stall_code_list = string.Join("$", stall_code_list, grvStall.GetRowCellDisplayText(index, gcolStallCode));
                stall_id_list = string.Join("$", stall_id_list, grvStall.GetRowCellDisplayText(index, gcolStallID));
            }

            if (stall_code_list.Length > 0) stall_code_list = stall_code_list.Substring(1);
            if (stall_id_list.Length > 0) stall_id_list = stall_id_list.Substring(1);

            PRO_tblStallDRO result = new PRO_tblStallDRO();
            result.ResponseItem.Message = "ready";
            if (!string.IsNullOrEmpty(stall_id_list))
            {
                try
                {
                    if (stall_id_list.Contains("$"))
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000012", ConfigEngine.Language).Replace("$Count$", stall_id_list.Split('$').Length.ToString())))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await PRO_tblStallBUS.DeleteStall(stall_id_list, CommonEngine.userInfo.Username, ConfigEngine.Language, 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 = "19",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công những quầy bán có mã '{1}'.", CommonEngine.userInfo.UserID, stall_code_list.Replace("$", ", ")),
                                DescriptionEN = string.Format("Account '{0}' has deleted stalls successfully with stall codes are '{1}'.", CommonEngine.userInfo.UserID, stall_code_list.Replace("$", ", "))
                            });
                        }
                    }
                    else
                    {
                        if (CommonEngine.ShowConfirmMessageAlert(LanguageEngine.GetMessageCaption("000005", ConfigEngine.Language)))
                        {
                            CommonEngine.ShowWaitForm(this);
                            result = await PRO_tblStallBUS.DeleteStall(stall_id_list, CommonEngine.userInfo.Username, ConfigEngine.Language, 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 = "19",
                                DescriptionVN = string.Format("Tài khoản '{0}' vừa xóa thành công quầy bán có mã '{1}'.", CommonEngine.userInfo.UserID, stall_code_list),
                                DescriptionEN = string.Format("Account '{0}' has deleted stall successfully with stall code is '{1}'.", CommonEngine.userInfo.UserID, stall_code_list)
                            });
                        }
                    }

                    if (!CommonEngine.CheckValidResponseItem(result.ResponseItem)) return;
                    if (!result.ResponseItem.Message.Equals("ready"))
                        if (string.IsNullOrEmpty(result.ResponseItem.Message)) GetAllStall("", "");
                        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);
        }
Пример #15
0
        public async static Task<PRO_tblStallDRO> DeleteStall(string username, string language_id, string stall_id_list, SYS_tblActionLogDTO actionLog)
        {
            PRO_tblStallDRO result = new PRO_tblStallDRO();
            try
            {
                string url = string.Format(@"{0}/DeleteStall?Username={1}&LanguageID={2}&StallIDList={3}", GetBaseUrl(), username, language_id, stall_id_list);

                result = await PRO_tblStallDAO.DeleteStall(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;
        }