예제 #1
0
 public uc_WarehouseDetail(uc_Warehouse parent, PRO_tblWarehouseDTO item)
 {
     InitializeComponent();
     parentForm = parent;
     Initialize();
     LoadDataToEdit(item);
     SetPermission();
 }
예제 #2
0
 private void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (curRow != null)
     {
         PRO_tblWarehouseDTO item = busWarehouse.GetDataByID(curRow["StoreID"] + "", User.UserInfo.Username, User.UserInfo.LanguageID);
         if (item != null)
         {
             Commons.OpenInputForm(new uc_WarehouseDetail(this, item), "Cập Nhật Kho Hàng", "Update Warehouse", new Size(410, 400));
         }
     }
 }
예제 #3
0
 public uc_WarehouseDetail(uc_Warehouse _parent_form, PRO_tblWarehouseDTO item = null)
 {
     CommonEngine.ShowWaitForm(this);
     InitializeComponent();
     Initialize();
     parent_form = _parent_form;
     if (item != null)
     {
         LoadDataToEdit(item);
     }
     CommonEngine.LoadUserPermission("18", txtWarehouseID, btnSaveClose, btnSaveInsert);
 }
예제 #4
0
        public async static Task <PRO_tblWarehouseDRO> InsertUpdateStore(PRO_tblWarehouseDTO item, SYS_tblActionLogDTO actionLog)
        {
            PRO_tblWarehouseDRO result = new PRO_tblWarehouseDRO();

            try
            {
                string url      = string.Format(@"{0}/InsertUpdateWarehouse", GetBaseUrl());
                var    postData = new PRO_tblWarehouseDCO
                {
                    WarehouseID   = item.WarehouseID,
                    WarehouseCode = item.WarehouseCode,
                    VNName        = item.VNName,
                    ENName        = item.ENName,
                    StoreID       = item.StoreID,
                    AddressVN     = item.AddressVN,
                    AddressEN     = item.AddressEN,
                    Phone         = item.Phone,
                    Fax           = item.Fax,
                    ProvinceID    = string.IsNullOrEmpty(item.ProvinceID) ? null : item.ProvinceID,
                    DistrictID    = string.IsNullOrEmpty(item.DistrictID) ? null : item.DistrictID,
                    Rank          = item.Rank,
                    Used          = item.Used,
                    Note          = item.Note,
                    UserID        = item.UserID,
                    Activity      = item.Activity,
                    LanguageID    = item.LanguageID
                };
                var json_data = "{\"warehouse\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings
                {
                    DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
                }) + "}";

                result = await PRO_tblWarehouseDAO.InsertUpdateWarehouse(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);
        }
예제 #5
0
        private bool SaveWarehouse(bool isEdit)
        {
            string strError = "";

            try
            {
                PRO_tblWarehouseDTO item = new PRO_tblWarehouseDTO
                {
                    Activity      = (isEdit) ? "Update" : "Insert",
                    Username      = User.UserInfo.Username,
                    LanguageID    = User.UserInfo.LanguageID,
                    WarehouseID   = txtWarehouseID.Text,
                    WarehouseCode = txtWarehouseCode.Text,
                    VNName        = txtVNName.Text,
                    ENName        = txtENName.Text,
                    StoreID       = gluStore.EditValue + "",
                    AddressVN     = txtAddressVN.Text,
                    AddressEN     = txtAddressEN.Text,
                    Phone         = txtPhone.Text,
                    Fax           = txtFax.Text,
                    ProvinceID    = gluProvince.EditValue + "",
                    DistrictID    = gluDistrict.EditValue + "",
                    Rank          = speRank.EditValue,
                    Used          = chkUsed.Checked,
                    Note          = mmoNote.Text
                };
                strError = (isEdit) ? busWarehouse.UpdateWarehouse(item) : busWarehouse.InsertWarehouse(item);
                if (strError != "")
                {
                    Commons.ShowMessage(strError, 0);
                    txtWarehouseCode.Focus();
                    return(false);
                }
                else
                {
                    parentForm.LoadAllData();
                }
            }
            catch (Exception ex)
            {
                Commons.ShowExceptionMessage(ex);
                return(false);
            }

            return(true);
        }
예제 #6
0
        public PRO_tblWarehouseDTO GetDataByID(string username, string language_id, string warehouse_id)
        {
            PRO_tblWarehouseDTO result = new PRO_tblWarehouseDTO();

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

            return(result);
        }
예제 #7
0
        public string UpdateWarehouse(PRO_tblWarehouseDTO item)
        {
            string strError = "";

            strError = db.sExecuteSQL("PRO_spfrmWarehouse", new string[] { "Activity", "Username", "LanguageID", "WarehouseID", "WarehouseCode", "VNName", "ENName", "AddressVN", "AddressEN", "Phone", "Fax", "Rank", "Used", "Note", "StoreID", "ProvinceID", "DistrictID" }, new object[] { item.Activity, item.Username, item.LanguageID, item.WarehouseID, item.WarehouseCode, item.VNName, item.ENName, item.AddressVN, item.AddressEN, item.Phone, item.Fax, item.Rank, item.Used, item.Note, item.StoreID, 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    = "18",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa cập nhật thành công kho hàng có mã '{1}'.", item.Username, item.WarehouseCode),
                    DescriptionEN = string.Format("Account '{0}' has updated new warehouse successfully with warehouse code is '{1}'.", item.Username, item.WarehouseCode)
                });
            }

            return(strError);
        }
예제 #8
0
        public string InsertWarehouse(PRO_tblWarehouseDTO item)
        {
            string strError = "";

            try
            {
                strError = db.sExecuteSQL("PRO_spfrmWarehouse", new string[] { "Activity", "Username", "LanguageID", "WarehouseID", "WarehouseCode", "VNName", "ENName", "AddressVN", "AddressEN", "Phone", "Fax", "Rank", "Used", "Note", "StoreID", "ProvinceID", "DistrictID" }, new object[] { item.Activity, item.UserID, item.LanguageID, item.WarehouseID, item.WarehouseCode, item.VNName, item.ENName, item.AddressVN, item.AddressEN, item.Phone, item.Fax, item.Rank, item.Used, item.Note, item.StoreID, item.ProvinceID, item.DistrictID });

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

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

            return(strError);
        }
예제 #9
0
 private void LoadDataToEdit(PRO_tblWarehouseDTO item)
 {
     txtWarehouseID.EditValue   = (item == null) ? null : item.WarehouseID;
     txtWarehouseCode.EditValue = (item == null) ? null : item.WarehouseCode;
     txtVNName.EditValue        = (item == null) ? null : item.VNName;
     txtENName.EditValue        = (item == null) ? null : item.ENName;
     txtAddressVN.EditValue     = (item == null) ? null : item.AddressVN;
     txtAddressEN.EditValue     = (item == null) ? null : item.AddressEN;
     txtPhone.EditValue         = (item == null) ? null : item.Phone;
     txtFax.EditValue           = (item == null) ? null : item.Fax;
     gluStore.EditValue         = (item == null) ? null : item.StoreID;
     mmoNote.EditValue          = (item == null) ? null : item.Note;
     speRank.EditValue          = (item == null) ? null : item.Rank;
     chkUsed.Checked            = (item == null) ? true : item.Used;
     gluProvince.EditValue      = (item == null) ? null : item.ProvinceID;
     gluDistrict.EditValue      = (item == null) ? null : item.DistrictID;
     if (item == null)
     {
         depError.ClearErrors();
         this.ParentForm.Text = (User.UserInfo.LanguageID.Equals("VN")) ? "Thêm Mới Kho Hàng" : "Insert New Warehouse";
     }
     txtWarehouseCode.Focus();
 }
예제 #10
0
 private void LoadDataToEdit(PRO_tblWarehouseDTO item)
 {
     txtWarehouseID.EditValue   = (item == null) ? null : item.WarehouseID;
     txtWarehouseCode.EditValue = (item == null) ? null : item.WarehouseCode;
     //txtWarehouseCode.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;
     txtAddressEN.EditValue = (item == null) ? null : item.AddressEN;
     txtAddressVN.EditValue = (item == null) ? null : item.AddressVN;
     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;
     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);
         txtWarehouseCode.Focus();
     }
 }
예제 #11
0
 public string UpdateWarehouse(PRO_tblWarehouseDTO item)
 {
     return(daoWarehouse.UpdateWarehouse(item));
 }
예제 #12
0
 public string InsertWarehouse(PRO_tblWarehouseDTO item)
 {
     return(daoWarehouse.InsertWarehouse(item));
 }