public void SimulateChangeWarehouseProperties(CWarehouse objWarehouse, enumActionSaveCancel enActionType, System.Boolean bIsNewWarehouse) { // Создаем объект, хранящий информацию, которую нужно передать // объектам, получающим уведомление о событии ChangeWarehousePropertieEventArgs e = new ChangeWarehousePropertieEventArgs(objWarehouse, enActionType, bIsNewWarehouse); // Вызываем виртуальный метод, уведомляющий наш объект о возникновении события // Если нет типа, переопределяющего этот метод, наш объект уведомит все объекты, // подписавшиеся на уведомление о событии OnChangeWarehouseProperties(e); }
public ctrlWarehous(UniXP.Common.CProfile objProfile, UniXP.Common.MENUITEM objMenuItem) { InitializeComponent(); m_objProfile = objProfile; m_objMenuItem = objMenuItem; m_bIsChanged = false; //m_bDisableEvents = false; m_bNewWareHouse = false; m_objSelectedWareHouse = null; frmAddress = new ERP_Mercury.Common.ctrlAddress(ERP_Mercury.Common.EnumObject.Warehouse, m_objProfile, m_objMenuItem, System.Guid.Empty); frmAddress.InitAddressControl(); layoutControlAddress.Size = new Size(layoutControlAddress.Size.Width, (frmAddress.Size.Height)); layoutControlAddress.MaximumSize = new Size(layoutControlAddress.Size.Width, layoutControlAddress.Size.Height); layoutControlGroupAddress.Size = new Size(layoutControlGroupAddress.Size.Width, (frmAddress.Size.Height)); this.layoutControlItemAddress = new DevExpress.XtraLayout.LayoutControlItem(); this.layoutControlItemAddress.Parent = layoutControlGroupAddress; this.layoutControlItemAddress.Control = frmAddress; this.layoutControlItemAddress.CustomizationFormText = "layoutControlItemAddress"; this.layoutControlItemAddress.Location = new System.Drawing.Point(0, 0); this.layoutControlItemAddress.Name = "layoutControlItemAddress"; this.layoutControlItemAddress.Padding = new DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5); this.layoutControlItemAddress.Size = new System.Drawing.Size(642, 38); this.layoutControlItemAddress.Spacing = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0); this.layoutControlItemAddress.Text = "layoutControlItemAddress"; this.layoutControlItemAddress.TextSize = new System.Drawing.Size(93, 20); this.layoutControlItemAddress.TextVisible = false; /* * this.frmAddress.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top // | System.Windows.Forms.AnchorStyles.Bottom ) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))));*/ this.frmAddress.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); frmAddress.ChangeAddressPropertie += OnChangeAddressPropertie; LoadComboBoxItems(); m_bIsReadOnly = false; CheckClientsRight(); }
/// <summary> /// Новое хранилище /// </summary> public void NewWarehouse() { //m_bDisableEvents = true; m_bNewWareHouse = true; ShowWarningPnl(false); try { this.Refresh(); frmAddress.StartThreadWithLoadData(); m_objSelectedWareHouse = new ERP_Mercury.Common.CWarehouse(); if (m_objSelectedWareHouse.AddressForDeleteList == null) { m_objSelectedWareHouse.AddressForDeleteList = new List <CAddress>(); } else { m_objSelectedWareHouse.AddressForDeleteList.Clear(); } this.SuspendLayout(); txtFullName.Text = ""; txtCod.Text = ""; checkActive.Checked = true; checkIsForShiping.Checked = true; cboxTypeWarehouse.SelectedItem = null; txtFullName.Text = m_objSelectedWareHouse.Name; // Адреса frmAddress.LoadAddressList(m_objSelectedWareHouse.ID, null); frmAddress.ClearAllPropertiesControls(); SetModeReadOnly(false); btnEdit.Enabled = false; SetPropertiesModified(true); } catch (System.Exception f) { SendMessageToLog("Ошибка создания клиента. Текст ошибки: " + f.Message); } finally { this.ResumeLayout(false); //m_bDisableEvents = false; } return; }
public ChangeWarehousePropertieEventArgs(CWarehouse objWarehouse, enumActionSaveCancel enActionType, System.Boolean bIsNewobjWarehouse) { m_objWarehouse = objWarehouse; m_enActionType = enActionType; m_bIsNewWarehouse = bIsNewobjWarehouse; }
/// <summary> /// Сохраняет изменения в базе данных /// </summary> /// <returns>true - удачное завершение операции;false - ошибка</returns> private System.Boolean bSaveChanges() { System.Boolean bRet = false; System.Boolean bOkSave = false; CWarehouse objWarehouseForSave = new CWarehouse(); try { objWarehouseForSave.ID = m_objSelectedWareHouse.ID; objWarehouseForSave.Name = txtFullName.Text; // проверить, как работатет этот кусочек кода objWarehouseForSave.IsAcitve = checkActive.Checked; objWarehouseForSave.IsForShipping = checkIsForShiping.Checked; if (txtCod.Text == "") { objWarehouseForSave.IBId = 0; } else { objWarehouseForSave.IBId = Convert.ToInt32(txtCod.Text); } if (cboxTypeWarehouse.SelectedItem != null) { objWarehouseForSave.WarehouseType = (CWareHouseType)cboxTypeWarehouse.SelectedItem; } if (objWarehouseForSave.AddressList == null) { objWarehouseForSave.AddressList = new List <CAddress>(); } objWarehouseForSave.AddressList.Clear(); objWarehouseForSave.AddressList.AddRange(frmAddress.AddressList); if (objWarehouseForSave.AddressForDeleteList == null) { objWarehouseForSave.AddressForDeleteList = new List <CAddress>(); } objWarehouseForSave.AddressForDeleteList.Clear(); objWarehouseForSave.AddressForDeleteList.AddRange(frmAddress.AddressDeletedList); System.String strErr = ""; if (m_bNewWareHouse == true) { // новая компания bOkSave = objWarehouseForSave.Add(m_objProfile, null, ref strErr); } else { // Update в CWarehouse // дописать потом bOkSave = objWarehouseForSave.Update(m_objProfile, null, ref strErr); } SendMessageToLog(strErr); if (bOkSave == true) { m_objSelectedWareHouse.ID = objWarehouseForSave.ID; m_objSelectedWareHouse.Name = objWarehouseForSave.Name; m_objSelectedWareHouse.WarehouseType = objWarehouseForSave.WarehouseType; m_objSelectedWareHouse.IsAcitve = objWarehouseForSave.IsAcitve; m_objSelectedWareHouse.IsForShipping = objWarehouseForSave.IsForShipping; m_objSelectedWareHouse.AddressList = objWarehouseForSave.AddressList; if (frmAddress.AddressDeletedList != null) { frmAddress.AddressDeletedList.Clear(); } if (m_objSelectedWareHouse.AddressForDeleteList != null) { m_objSelectedWareHouse.AddressForDeleteList.Clear(); } ShowWarningPnl(false); bRet = true; } else { SetWarningInfo(strErr); ShowWarningPnl(true); } } catch (System.Exception f) { SendMessageToLog("Ошибка сохранения изменений в описании хранилища. Текст ошибки: " + f.Message); } finally { objWarehouseForSave = null; } return(bRet); }
/// <summary> /// !! Загружает свойства хранилища для редактирования/подробного порсмотра /// </summary> /// <param name="objWarehouse">компания</param> public void EditWarehouse(ERP_Mercury.Common.CWarehouse objWarehouse) { if (objWarehouse == null) { return; } //m_bDisableEvents = true; m_bNewWareHouse = false; ShowWarningPnl(false); try { //System.String strErr = ""; m_objSelectedWareHouse = objWarehouse; // ЗДЕСЬ !!!!!!!!!!!!!!!!!!!!! // Заполняем не здесь, а ниже. Здесь (в этом блоке и чуть выше) заполняются combobox-ы, // которые НЕ возвращаются из конструкотора. А заполняются те, которые имеют тип данных List <> //m_objSelectedWareHouse.CompanyType = CCompanyType.GetCompanyTypeListForCompany(m_objProfile, null, m_objSelectedWareHouse.ID); // написать метод GetCompanyTypeListForCompany) if (m_objSelectedWareHouse.AddressForDeleteList == null) { m_objSelectedWareHouse.AddressForDeleteList = new List <CAddress>(); } else { m_objSelectedWareHouse.AddressForDeleteList.Clear(); } this.SuspendLayout(); txtFullName.Text = ""; txtCod.Text = ""; cboxTypeWarehouse.SelectedItem = null; txtFullName.Text = m_objSelectedWareHouse.Name; txtCod.Text = Convert.ToString(m_objSelectedWareHouse.IBId); checkActive.Checked = m_objSelectedWareHouse.IsAcitve; checkIsForShiping.Checked = m_objSelectedWareHouse.IsForShipping; // Тип хранилища if ((m_objSelectedWareHouse.WarehouseType != null) && (cboxTypeWarehouse.Properties.Items.Count > 0)) { foreach (Object objWarehouseTypes in cboxTypeWarehouse.Properties.Items) { if (((CWareHouseType)objWarehouseTypes).ID.CompareTo(m_objSelectedWareHouse.WarehouseType.ID) == 0) { cboxTypeWarehouse.SelectedItem = objWarehouseTypes; break; } } } // Адреса frmAddress.LoadAddressList(m_objSelectedWareHouse.ID, null); frmAddress.ClearAllPropertiesControls(); SetPropertiesModified(false); //tabControl.SelectedTabPage = tabGeneral; btnCancel.Enabled = true; btnCancel.Focus(); SetModeReadOnly(true); } catch (System.Exception f) { SendMessageToLog("Ошибка редактирования хранилища. Текст ошибки: " + f.Message); } finally { this.ResumeLayout(false); //tabControl.SelectedTabPage = tabGeneral; //m_bDisableEvents = false; } return; }