/// <summary>
 /// Создание нового клиента
 /// </summary>
 public Form4NewOrgOrClient(int orgId, string currentClient) : this()
 {
     //this.currentOrgId = orgId;
     clientInfo.Org_Id     = orgId;
     clientInfo.ClientName = currentClient;
     formMode = FormOpenMode.ForAddClient;
 }
        /// <summary>
        ///  Конструктор для редактирования существующего клиента. Заполняет поля формы реквизитами клиента.
        /// </summary>
        /// <param name="selectedValue">ID существующего клиента</param>
        public Form4NewOrgOrClient(int clientId) : this()
        {
            formMode             = FormOpenMode.ForEditClient;
            this.currentClientId = clientId;

            //var firstIdentDoc = identityDocs.First();
            //fidCurrentClient = (int)firstIdentDoc.IdentityDocType - 1;
            //currentReq = firstIdentDoc.Requisites;

            //userMachineScanUrl = firstIdentDoc.ScanLink;
            //serverScanUrl = firstIdentDoc.ScanLink;
            //currentScanName = Path.GetFileName(serverScanUrl);
        }
Esempio n. 3
0
        public PositionsForm(MainRegion region, FormOpenMode mode)
        {
            InitializeComponent();

            m_region = region;

            tvAreas.Nodes.AddRange(region.Areas.CloneNodes());
            cbStatus.Items.AddRange(region.PositionsStatuses);
            cbRole.Items.AddRange(region.Roles);
            cbCompany.Items.AddRange(region.Companies.Select(t => t.Attribute("title").Value).ToArray());

            m_openMode = mode;

            if (m_openMode == FormOpenMode.SearchAndSelect)
            {
                cbStatus.Enabled = false;
            }

            DoSearch(-1);
        }
        private void ConfigureFormControls(FormOpenMode formMode)
        {
            if (formMode == FormOpenMode.ForCreateOrganization)
            {
                button1.Text = "Создать";
                this.Text    = "Создать новую организацию";
                IdentityDocTypeCB.SelectedIndex = 0;
                orgNameTB.Enabled = true;
                return;
            }

            if (formMode == FormOpenMode.ForEditClient)
            {
                button1.Text = "Изменить";
                this.Text    = "Изменить реквизиты клиента";
                IdentityDocTypeCB.SelectedIndex = 0;
                orgNameTB.Enabled = false;

                clientInfo        = dm.GetClientInfo(currentClientId);
                orgNameTB.Text    = dm.GetOrganizationName(clientInfo.Org_Id);
                clientNameTB.Text = clientInfo.ClientName;
                IdentityDocTypeCB.SelectedIndex = (int)clientInfo.FidDocType - 1;
                maskedTextBox1.Text             = clientInfo.Requisites;
                if (!string.IsNullOrWhiteSpace(clientInfo.ServerScanLink))
                {
                    linkLabel1.Text    = Path.GetFileName(clientInfo.ServerScanLink);
                    linkLabel1.Visible = true;
                }
                return;
            }
            if (formMode == FormOpenMode.ForAddClient)
            {
                button1.Text = "Добавить";
                this.Text    = "Добавить клиента";
                IdentityDocTypeCB.SelectedIndex = 0;
                orgNameTB.Enabled = false;
                orgNameTB.Text    = dm.GetOrganizationName(clientInfo.Org_Id);
                clientNameTB.Text = clientInfo.ClientName;
                return;
            }
        }