public uc_WarehouseDetail(uc_Warehouse parent, PRO_tblWarehouseDTO item)
 {
     InitializeComponent();
     parentForm = parent;
     Initialize();
     LoadDataToEdit(item);
     SetPermission();
 }
        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;
        }
 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();
 }
        public string InsertWarehouse(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 = item.Activity,
                    Username = item.Username,
                    LanguageID = item.LanguageID,
                    ActionVN = "Thêm Mới",
                    ActionEN = "Insert",
                    FunctionID = "18",
                    DescriptionVN = string.Format("Tài khoản '{0}' vừa thêm mới thành công kho hàng có mã '{1}'.", item.Username, item.WarehouseCode),
                    DescriptionEN = string.Format("Account '{0}' has inserted new warehouse successfully with warehouse code is '{1}'.", item.Username, item.WarehouseCode)
                });
            }

            return strError;
        }
 public string UpdateWarehouse(PRO_tblWarehouseDTO item)
 {
     return daoWarehouse.UpdateWarehouse(item);
 }
 public string InsertWarehouse(PRO_tblWarehouseDTO item)
 {
     return daoWarehouse.InsertWarehouse(item);
 }