Exemplo n.º 1
0
        public string InsertStore(PRO_tblStoreDTO item)
        {
            string strError = "";

            try
            {
                if (string.IsNullOrEmpty(item.Photo))
                {
                    item.Photo = @"Data\Images\no_image.png";
                }
                strError = db.sExecuteSQL("PRO_spfrmStore", new string[] { "Activity", "Username", "LanguageID", "StoreID", "StoreCode", "ShortCode", "VNName", "ENName", "BuildDate", "EndDate", "AddressVN", "AddressEN", "Phone", "Fax", "Rank", "TaxCode", "Used", "IsRoot", "Representives", "Note", "Photo", "ProvinceID", "DistrictID" }, new object[] { item.Activity, item.UserID, item.LanguageID, item.StoreID, item.StoreCode, item.ShortCode, item.VNName, item.ENName, item.BuildDate, item.EndDate, item.AddressVN, item.AddressEN, item.Phone, item.Fax, item.Rank, item.TaxCode, item.Used, item.IsRoot, item.Representatives, item.Note, item.Photo, item.ProvinceID, item.DistrictID });

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

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

            return(strError);
        }
Exemplo n.º 2
0
 private void LoadDataToEdit(PRO_tblStoreDTO item)
 {
     txtStoreID.EditValue       = (item == null) ? null : item.StoreID;
     txtStoreCode.EditValue     = (item == null) ? null : item.StoreCode;
     txtShortCode.EditValue     = (item == null) ? null : item.ShortCode;
     txtVNName.EditValue        = (item == null) ? null : item.VNName;
     txtENName.EditValue        = (item == null) ? null : item.ENName;
     dteBuildDate.EditValue     = (item == null) ? null : item.BuildDate;
     dteEndDate.EditValue       = (item == null) ? null : item.EndDate;
     picPhoto.EditValue         = (item == null) ? null : item.Photo;
     txtAddressVN.EditValue     = (item == null) ? null : item.AddressVN;
     txtAddressEN.EditValue     = (item == null) ? null : item.AddressEN;
     gluProvince.EditValue      = (item == null) ? null : item.ProvinceID;
     gluDistrict.EditValue      = (item == null) ? null : item.DistrictID;
     txtPhone.EditValue         = (item == null) ? null : item.Phone;
     txtFax.EditValue           = (item == null) ? null : item.Fax;
     txtTaxCode.EditValue       = (item == null) ? null : item.TaxCode;
     speRank.EditValue          = (item == null) ? null : item.Rank;
     txtRepresentives.EditValue = (item == null) ? null : item.Representatives;
     chkIsRoot.Checked          = (item == null) ? false : item.IsRoot;
     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 Cửa Hàng" : "Insert New Store";
     }
     txtStoreCode.Focus();
 }
Exemplo n.º 3
0
 public uc_StoreDetail(uc_Store parent, PRO_tblStoreDTO item)
 {
     InitializeComponent();
     parentForm = parent;
     Initialize();
     LoadDataToEdit(item);
     SetPermission();
 }
Exemplo n.º 4
0
 private void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (curRow != null)
     {
         PRO_tblStoreDTO item = busStore.GetDataByID(curRow["StoreID"] + "", User.UserInfo.Username, User.UserInfo.LanguageID);
         if (item != null)
         {
             Commons.OpenInputForm(new uc_StoreDetail(this, item), "Cập Nhật Cửa Hàng", "Update Store", new Size(660, 400));
         }
     }
 }
Exemplo n.º 5
0
 public uc_StoreDetail(uc_Store _parent_form, PRO_tblStoreDTO item = null)
 {
     CommonEngine.ShowWaitForm(this);
     InitializeComponent();
     Initialize();
     parent_form = _parent_form;
     if (item != null)
     {
         LoadDataToEdit(item);
     }
     CommonEngine.LoadUserPermission("13", txtStoreID, btnSaveClose, btnSaveInsert);
 }
Exemplo n.º 6
0
        public async static Task <PRO_tblStoreDRO> InsertUpdateStore(PRO_tblStoreDTO item, SYS_tblActionLogDTO actionLog)
        {
            PRO_tblStoreDRO result = new PRO_tblStoreDRO();

            try
            {
                string url      = string.Format(@"{0}/InsertUpdateStore", GetBaseUrl());
                var    postData = new PRO_tblStoreDCO
                {
                    StoreID         = item.StoreID,
                    StoreCode       = item.StoreCode,
                    ShortCode       = item.ShortCode,
                    VNName          = item.VNName,
                    ENName          = item.ENName,
                    BuildDate       = item.BuildDate,
                    EndDate         = item.EndDate,
                    AddressVN       = item.AddressVN,
                    AddressEN       = item.AddressEN,
                    Phone           = item.Phone,
                    Fax             = item.Fax,
                    TaxCode         = item.TaxCode,
                    Rank            = item.Rank,
                    Used            = item.Used,
                    IsRoot          = item.IsRoot,
                    Representatives = item.Representatives,
                    Note            = item.Note,
                    Photo           = item.Photo,
                    ProvinceID      = string.IsNullOrEmpty(item.ProvinceID) ? null : item.ProvinceID,
                    DistrictID      = string.IsNullOrEmpty(item.DistrictID) ? null : item.DistrictID,
                    UserID          = item.UserID,
                    Activity        = item.Activity,
                    LanguageID      = item.LanguageID
                };
                var json_data = "{\"store\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
                }) + "}";

                result = await PRO_tblStoreDAO.InsertUpdateStore(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);
        }
Exemplo n.º 7
0
        private bool SaveStore(bool isEdit)
        {
            string strError = "";

            try
            {
                PRO_tblStoreDTO item = new PRO_tblStoreDTO
                {
                    Activity        = (isEdit) ? "Update" : "Insert",
                    Username        = User.UserInfo.Username,
                    LanguageID      = User.UserInfo.LanguageID,
                    StoreID         = txtStoreID.Text,
                    StoreCode       = txtStoreCode.Text,
                    ShortCode       = txtShortCode.Text,
                    VNName          = txtVNName.Text,
                    ENName          = txtENName.Text,
                    BuildDate       = dteBuildDate.EditValue,
                    EndDate         = dteEndDate.EditValue,
                    AddressVN       = txtAddressVN.Text,
                    AddressEN       = txtAddressEN.Text,
                    Phone           = txtPhone.Text,
                    Fax             = txtFax.Text,
                    Rank            = speRank.EditValue,
                    TaxCode         = txtTaxCode.Text,
                    Used            = chkUsed.Checked,
                    IsRoot          = chkIsRoot.Checked,
                    Representatives = txtRepresentives.Text,
                    Note            = mmoNote.Text,
                    Photo           = picPhoto.EditValue,
                    ProvinceID      = gluProvince.EditValue + "",
                    DistrictID      = gluDistrict.EditValue + ""
                };
                strError = (isEdit) ? busStore.UpdateStore(item) : busStore.InsertStore(item);
                if (strError != "")
                {
                    Commons.ShowMessage(strError, 0);
                    txtStoreCode.Focus();
                    return(false);
                }
                else
                {
                    parentForm.LoadAllData();
                }
            }
            catch (Exception ex)
            {
                Commons.ShowExceptionMessage(ex);
                return(false);
            }

            return(true);
        }
Exemplo n.º 8
0
        public PRO_tblStoreDTO GetDataByID(string username, string language_id, string store_id)
        {
            PRO_tblStoreDTO result = new PRO_tblStoreDTO();

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

            return(result);
        }
Exemplo n.º 9
0
        public string UpdateStore(PRO_tblStoreDTO item)
        {
            string strError = "";

            strError = db.sExecuteSQL("PRO_spfrmStore", new string[] { "Activity", "Username", "LanguageID", "StoreID", "StoreCode", "ShortCode", "VNName", "ENName", "BuildDate", "EndDate", "AddressVN", "AddressEN", "Phone", "Fax", "Rank", "TaxCode", "Used", "IsRoot", "Representives", "Note", "Photo", "ProvinceID", "DistrictID" }, new object[] { item.Activity, item.Username, item.LanguageID, item.StoreID, item.StoreCode, item.ShortCode, item.VNName, item.ENName, item.BuildDate, item.EndDate, item.AddressVN, item.AddressEN, item.Phone, item.Fax, item.Rank, item.TaxCode, item.Used, item.IsRoot, item.Representatives, item.Note, item.Photo, item.ProvinceID, item.DistrictID });

            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    = "13",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa cập nhật thành công cửa hàng có mã '{1}'.", item.Username, item.StoreCode),
                    DescriptionEN = string.Format("Account '{0}' has updated store successfully with store code is '{1}'.", item.Username, item.StoreCode)
                });
            }

            return(strError);
        }
Exemplo n.º 10
0
 private void LoadDataToEdit(PRO_tblStoreDTO item)
 {
     txtStoreID.EditValue   = (item == null) ? null : item.StoreID;
     txtStoreCode.EditValue = (item == null) ? null : item.StoreCode;
     //txtStoreCode.Properties.ReadOnly = (item == null) ? false : true;
     txtShortCode.EditValue     = (item == null) ? null : item.ShortCode;
     txtVNName.EditValue        = (item == null) ? null : item.VNName;
     txtENName.EditValue        = (item == null) ? null : item.ENName;
     dteBuildDate.EditValue     = (item == null) ? null : item.BuildDate;
     dteEndDate.EditValue       = (item == null) ? null : item.EndDate;
     txtAddressVN.EditValue     = (item == null) ? null : item.AddressVN;
     txtAddressEN.EditValue     = (item == null) ? null : item.AddressEN;
     gluProvince.EditValue      = (item == null) ? null : item.ProvinceID;
     gluDistrict.EditValue      = (item == null) ? null : item.DistrictID;
     txtPhone.EditValue         = (item == null) ? null : item.Phone;
     txtFax.EditValue           = (item == null) ? null : item.Fax;
     txtTaxCode.EditValue       = (item == null) ? null : item.TaxCode;
     speRank.EditValue          = (item == null) ? null : item.Rank;
     txtRepresentives.EditValue = (item == null) ? null : item.Representatives;
     chkIsRoot.Checked          = (item == null) ? false : item.IsRoot;
     chkUsed.Checked            = (item == null) ? true : item.Used;
     mmoNote.EditValue          = (item == null) ? null : item.Note;
     if (item != null && !string.IsNullOrEmpty(item.PhotoUri))
     {
         picPhoto.LoadAsync(item.PhotoUri);
     }
     else
     {
         picPhoto.EditValue = null;
     }
     if (item == null)
     {
         depError.ClearErrors();
         this.ParentForm.Text = LanguageEngine.GetOpenFormText(this.Name, ConfigEngine.Language, false);
         txtStoreCode.Focus();
     }
 }
Exemplo n.º 11
0
 public string UpdateStore(PRO_tblStoreDTO item)
 {
     return(daoStore.UpdateStore(item));
 }
Exemplo n.º 12
0
 public string InsertStore(PRO_tblStoreDTO item)
 {
     return(daoStore.InsertStore(item));
 }