Пример #1
0
        public static void fillComboBox(ComboBox cmb, int defaultItem)
        {
            cmb.Items.Clear();
            ChequeBL bl = new ChequeBL();

            ChequeEntity entity     = bl.get();
            var          dataSource = new List <ComboBoxItem>();

            BasicInfoUtil.AddUnKnown(dataSource);

            for (int i = 0; i < entity.Tables[entity.FilledTableName].Rows.Count; i++)
            {
                string id   = entity.Tables[entity.FilledTableName].Rows[i][ChequeEntity.FIELD_ID].ToString();
                string desc = entity.Tables[entity.FilledTableName].Rows[i][ChequeEntity.FIELD_BANK_ID].ToString();

                dataSource.Add(new ComboBoxItem(desc, id, ""));
            }
            cmb.DataSource    = dataSource;
            cmb.DisplayMember = "Text";
            cmb.ValueMember   = "Value";

            for (int i = 0; i < cmb.Items.Count; i++)
            {
                if (((ComboBoxItem)cmb.Items[i]).Value.Equals(defaultItem.ToString()))
                {
                    cmb.SelectedIndex = i;
                    break;
                }
            }
        }
Пример #2
0
        public static void fillComboWithUsers(ComboBox cmb, int defaultId)
        {
            UsersDA     da     = new UsersDA();
            String      cond   = "ACTIVE=1";
            UsersEntity entity = da.load(cond);

            var dataSource = new List <ComboBoxItem>();

            cmb.DataSource = null;
            cmb.Items.Clear();
            BasicInfoUtil.AddUnKnown(dataSource);

            for (int i = 0; i < entity.Tables[entity.FilledTableName].Rows.Count; i++)
            {
                string name = entity.get(i, UsersEntity.FIELD_NAME) + " " + entity.get(i, UsersEntity.FIELD_FAMILY) + " ( " +
                              entity.get(i, UsersEntity.FIELD_USERNAME) + " ) ";
                string id = entity.get(i, UsersEntity.FIELD_ID).ToString();

                dataSource.Add(new ComboBoxItem(name, id));
            }

            cmb.DataSource    = dataSource;
            cmb.DisplayMember = "Text";
            cmb.ValueMember   = "Value";
            for (int i = 0; i < cmb.Items.Count; i++)
            {
                if (((ComboBoxItem)cmb.Items[i]).Value.Equals(defaultId.ToString()))
                {
                    cmb.SelectedIndex = i;
                    break;
                }
            }
        }
Пример #3
0
        private void initSearch()
        {
            _searchFields = new string[7];
            _searchPanels = new Panel[7];

            BasicInfoUtil.fillComboBox(cmbSemat, "Semat", -1);

            _searchFields[0] = CompanyEntity.FIELD_COMPANY_NAME;
            _searchFields[1] = CompanyEntity.FIELD_OFFICER;
            _searchFields[2] = CompanyEntity.VIEW_FIELD_SEMAT;
            _searchFields[3] = CompanyEntity.FIELD_TEL;
            _searchFields[4] = CompanyEntity.FIELD_FAX;
            _searchFields[5] = CompanyEntity.FIELD_ADDRESS;
            _searchFields[6] = CompanyEntity.FIELD_DESCRIPTION;

            _searchPanels[00] = pnlCompanyName;
            _searchPanels[01] = pnlOfficer;
            _searchPanels[02] = pnlSemat;
            _searchPanels[03] = pnlTel;
            _searchPanels[04] = pnlFax;
            _searchPanels[05] = pnlAddress;
            _searchPanels[06] = pnlDescription;

            selectSearchPanel(0);
        }
Пример #4
0
        private void fillUserRefferenceCombo(int defaultValue)
        {
            UserTreeBL     userTreeBL     = new UserTreeBL();
            int            loggineduserid = int.Parse(UsersBS.loginedUser.get(UsersEntity.FIELD_ID).ToString());
            UserTreeEntity entity         = userTreeBL.getUserAllAccessPath(loggineduserid);

            cmbReferenceUserId.DataSource = null;
            cmbReferenceUserId.Items.Clear();

            var dataSource = new List <ComboBoxItem>();

            BasicInfoUtil.AddUnKnown(dataSource);
            for (int i = 0; i < entity.Tables[entity.FilledTableName].Rows.Count; i++)
            {
                string name   = entity.get(i, UserTreeEntity.VIEW_FIELD_USER_NAME).ToString();
                string treeid = entity.get(i, UserTreeEntity.FIELD_ID).ToString();
                string userid = entity.get(i, UserTreeEntity.FIELD_USER_ID).ToString();
                dataSource.Add(new ComboBoxItem(name, treeid, userid));
            }

            cmbReferenceUserId.DataSource    = dataSource;
            cmbReferenceUserId.DisplayMember = "Text";
            cmbReferenceUserId.ValueMember   = "Value";
            for (int i = 0; i < cmbReferenceUserId.Items.Count; i++)
            {
                string c = ((ComboBoxItem)cmbReferenceUserId.Items[i]).CustomData;
                if (c != null && c.Equals(defaultValue.ToString()))
                {
                    cmbReferenceUserId.SelectedIndex = i;
                    break;
                }
            }
        }
Пример #5
0
        private void btnLetterState_Click(object sender, EventArgs e)
        {
            int biId = BasicInfoUtil.getId("LetterState");
            //  MultiBasicInfoForm bi = new MultiBasicInfoForm(biId);

            // bi.load();
            //   bi.ShowDialog();
        }
Пример #6
0
        private void init()
        {
            int sematId = 0;

            if (_id > 0)
            {
                CompanyEntity entity = null;
                entity = _companyBL.get(_id);

                txtCompanyName.Text = entity.get(CompanyEntity.FIELD_COMPANY_NAME).ToString();
                txtTel.Text         = entity.get(CompanyEntity.FIELD_TEL).ToString();
                txtOfficer.Text     = entity.get(CompanyEntity.FIELD_OFFICER).ToString();
                txtFax.Text         = entity.get(CompanyEntity.FIELD_FAX).ToString();
                txtAddress.Text     = entity.get(CompanyEntity.FIELD_ADDRESS).ToString();
                txtDescription.Text = entity.get(CompanyEntity.FIELD_DESCRIPTION).ToString();
                if (entity.get(CompanyEntity.FIELD_SEMAT) != null && entity.get(CompanyEntity.FIELD_SEMAT).ToString().Length > 0)
                {
                    sematId = int.Parse(entity.get(CompanyEntity.FIELD_SEMAT).ToString());
                }
                if (entity.get(CompanyEntity.FIELD_ACTIVE) != null &&
                    entity.get(CompanyEntity.FIELD_ACTIVE).ToString().Length > 0 &&
                    ((bool)entity.get(CompanyEntity.FIELD_ACTIVE)) == false)
                {
                    cmbActive.SelectedIndex = 1;
                }
                else
                {
                    cmbActive.SelectedIndex = 0;
                }
            }
            else
            {
                if (_id == 0)
                {
                    _readOnly = true;
                }
                sematId = 0;
                cmbActive.SelectedIndex = 0;
            }

            BasicInfoUtil.fillComboBox(cmbSemat, "Semat", sematId);
            if (_readOnly)
            {
                txtTel.Enabled         = false;
                txtFax.Enabled         = false;
                txtDescription.Enabled = false;
                txtCompanyName.Enabled = false;
                txtAddress.Enabled     = false;
                btnSave.Enabled        = false;
                txtOfficer.Enabled     = false;
                cmbSemat.Enabled       = false;
                cmbActive.Enabled      = false;
            }
        }
Пример #7
0
        private void init()
        {
            pnlLetterStateColor.BackColor = Color.White;
            BasicInfoUtil.fillComboBox(cmbLetterStateId, "LetterState", -1);

            ApplicationPropertiesBL appPropertiesBL = new ApplicationPropertiesBL();

            pnlColorConfirmedLetter.BackColor = ColorTranslator.FromHtml(appPropertiesBL.getValue(ApplicationPropertiesBL.COLOR_CONFIRMED_LETTER));
            pnlReferenceColor.BackColor       = ColorTranslator.FromHtml(appPropertiesBL.getValue(ApplicationPropertiesBL.COLOR_REFERENCE_LIMIT));
            txtReferLimit.Text  = appPropertiesBL.getValue(ApplicationPropertiesBL.REFERENCE_COUNT);
            pnlCheque.BackColor = ColorTranslator.FromHtml(appPropertiesBL.getValue(ApplicationPropertiesBL.CHEQUE_WITHNO_REPLY));
        }
Пример #8
0
        private void init()
        {
            if (_id <= 0)
            {
                return;
            }


            _entity = _refCycleBL.get(_id);

            txtLetterNumber.Text = _entity.get(ReferenceCycleEntity.FIELD_LETTERID + "_DESC").ToString();
            txtFirstRefDate.Text = _entity.get(ReferenceCycleEntity.FIELD_FIRSTREFERDATE + "").ToString();

            DateConverter converter = new DateConverter();

            txtFirstRefDate.Text  = converter.valueToString(_entity.get(ReferenceCycleEntity.FIELD_FIRSTREFERDATE));
            txtSecondRefDate.Text = converter.valueToString(_entity.get(ReferenceCycleEntity.FIELD_SECONDREFERDATE));

            txtFirstRefFromUser.Text = _entity.get(ReferenceCycleEntity.FIELD_FIRSTFROMUSER + "_DESC").ToString();
            txtFirstRefToUser.Text   = _entity.get(ReferenceCycleEntity.FIELD_FIRSTTOUSER + "_DESC").ToString();

            txtSecondRefFromUser.Text = _entity.get(ReferenceCycleEntity.FIELD_SECONDFROMUSER + "_DESC").ToString();
            txtSecondRefToUser.Text   = _entity.get(ReferenceCycleEntity.FIELD_SECONDTOUSER + "_DESC").ToString();

            int action = 0;

            if (_entity.get(ReferenceCycleEntity.FIELD_ACTION).ToString().Length > 0)
            {
                action = int.Parse(_entity.get(ReferenceCycleEntity.FIELD_ACTION).ToString());
            }
            BasicInfoUtil.fillComboBox(cmbAction, "ReferenceCycleAction", action);

            txtActionDesc.Text = _entity.get(ReferenceCycleEntity.FIELD_ACTIONDESCRIPTION).ToString();

            bool   archive = false;
            string a       = _entity.get(ReferenceCycleEntity.FIELD_ARCHIVE).ToString();

            if (a == null || a.Length == 0)
            {
                archive = false;
            }
            else
            {
                archive = bool.Parse(a);
            }
            cbArchive.Checked = archive;
        }
Пример #9
0
        private void init()
        {
            cmbPayType.Items.Clear();
            ComboBoxItem item = new ComboBoxItem("چک", "0");

            cmbPayType.Items.Add(item);
            item = new ComboBoxItem("نقد", "1");
            cmbPayType.Items.Add(item);

            BasicInfoUtil.fillCheckBoxList(cbInsuranceCompany, "InsuranceCompany", -1);
            BasicInfoUtil.fillCheckBoxList(cbBankId, "Bank", -1);

            cmbMaturityDate.SelectedIndex = 0;
            cmbMaturityDate_SelectedIndexChanged(cmbMaturityDate, null);

            cmbEntryDate.SelectedIndex = 0;
            cmbEntryDate_SelectedIndexChanged(cmbEntryDate, null);
        }
Пример #10
0
        public void init()
        {
            if (LetterBL.LETTER_TYPE_SEND.Equals(_letterType))
            {
                txtRecievedLetterDate.Enabled     = false;
                txtRecLetterDateTo.Visible        = false;
                txtRecievedLetterNumber.Visible   = false;
                lblRecievedLetterDate.Visible     = false;
                lblRecievedLetterNumber.Visible   = false;
                pnlRecLetterDate.Visible          = false;
                cmbCompareInputLetterDate.Visible = false;
                this.Text = "نامه صادره";
                lblInputRegisterNumber.Text = "شماره ثبت ورودی : ";
            }
            else
            {
                this.Text = "نامه وارده";
                lblInputRegisterNumber.Text = "شماره ثبت خروجی : ";
            }

            //BasicInfoUtil.fillComboBox(cmbInsuranceType, "InsuranceType", -1);
            BasicInfoUtil.fillCheckBoxList(cbListInsuranceType, "InsuranceType", -1);
            BasicInfoUtil.fillCheckBoxList(cmbManagemtAction, "managementAction", -1);

            BasicInfoUtil.fillCheckBoxList(cbLetterStateId, "LetterState", -1);
            UsersBS.fillCheckedListWithUsers(cbReferenceUserId, -1);
            UsersBS.fillCheckedListWithUsers(cbRefferFrom, -1);

            cmbArchive.SelectedIndex       = 0;
            cmbFinalConfirm.SelectedIndex  = 0;
            cmbManagerAction.SelectedIndex = 0;

            cmbCompareLetterDate.SelectedIndex      = 0;
            cmbCompareInputLetterDate.SelectedIndex = 0;
            cmbCompareInsuranceDate.SelectedIndex   = 0;
            cmbCompareLetterDate_SelectedIndexChanged(cmbCompareLetterDate, null);
            cmbCompareInputLetterDate_SelectedIndexChanged(cmbCompareInputLetterDate, null);
            cmbCompareInsuranceDate_SelectedIndexChanged(cmbCompareInsuranceDate, null);
        }
Пример #11
0
        private void initSearch()
        {
            _searchFields = new string[9];
            _searchPanels = new Panel[9];

            BasicInfoUtil.fillComboBox(cmbInsuranceType, "InsuranceType", -1);
            BasicInfoUtil.fillComboBox(cmbLetterStateId, "LetterState", -1);
            UsersBS.fillComboWithUsers(cmbReferenceUserId, -1);
            UsersBS.fillComboWithUsers(cmbRefferFrom, -1);

            _searchFields[0] = LetterEntity.FIELD_LETTER_NUMBER;
            _searchFields[1] = LetterEntity.FIELD_LETTER_DATE;
            _searchFields[2] = LetterEntity.FIELD_LETTER_SUBJECT;
            _searchFields[3] = LetterEntity.FIELD_INSURANCE_TYPE_ID + "_DESC";
            _searchFields[4] = LetterEntity.FIELD_INSURANCE_DATE;
            _searchFields[5] = LetterEntity.FIELD_LETTER_STATE_ID + "_DESC";
            _searchFields[6] = LetterEntity.VIEW_FIELD_REFERENCED_USER_ID + "_DESC";
            _searchFields[7] = LetterEntity.FIELD_COMPANY_ID + "_DESC";
            _searchFields[8] = LetterEntity.FIELD_REFER_FROM_USER_ID + "_DESC";

            _searchPanels[00] = pnlLetterNumber;
            _searchPanels[01] = pnlLetterDate;
            _searchPanels[02] = pnlSubject;
            _searchPanels[03] = pnlInsurance;
            _searchPanels[04] = pnlInsuranceDate;
            _searchPanels[05] = pnlLetterState;
            _searchPanels[06] = pnlReferenceUser;
            _searchPanels[07] = pnlCompanyName;
            _searchPanels[08] = pnlRefferFrom;

            selectSearchPanel(0);

            cmbCompareInsuranceDate.SelectedIndex = 0;
            cmbCompareLetterDate.SelectedIndex    = 0;

            cmbCompareInsuranceDate_SelectedIndexChanged(cmbCompareInsuranceDate, null);
            cmbCompareLetterDate_SelectedIndexChanged(cmbCompareLetterDate, null);
        }
Пример #12
0
        private void initSearch()
        {
            _searchFields = new string[12];
            _searchPanels = new Panel[12];

            BasicInfoUtil.fillComboBox(cmbBankId, "Bank", -1);
            UsersBS.fillComboWithUsers(cmbRefferFrom, -1);
            UsersBS.fillComboWithUsers(cmbRefferToUser, -1);

            _searchFields[0]  = ChequeEntity.FIELD_CHEQUE_NUMBER;
            _searchFields[1]  = ChequeEntity.FIELD_MATURITY_DATE;
            _searchFields[2]  = ChequeEntity.FIELD_ENTRY_DATE;
            _searchFields[3]  = ChequeEntity.FIELD_PRICE;
            _searchFields[4]  = ChequeEntity.VIEW_FIELD_BI_BANK_DESCRIPTION;
            _searchFields[5]  = ChequeEntity.FIELD_ACCOUNT_HOLDER_NAME;
            _searchFields[6]  = ChequeEntity.FIELD_ACCOUNT_NUMBER;
            _searchFields[7]  = ChequeEntity.FIELD_DESCRIPTION;
            _searchFields[8]  = ChequeEntity.VIEW_FIELD_PAYTYPE_DESC;
            _searchFields[9]  = ChequeEntity.VIEW_FIELD_COMPANYNAME;
            _searchFields[10] = ChequeEntity.FIELD_REFER_FROM_USER_ID + "_DESC";
            _searchFields[11] = ChequeEntity.VIEW_FIELD_USERNAME;

            _searchPanels[00] = pnlChequeNumber;
            _searchPanels[01] = pnlMaturityDate;
            _searchPanels[02] = pnlEntryDate;
            _searchPanels[03] = pnlPrice;
            _searchPanels[04] = pnlBank;
            _searchPanels[05] = pnlAccountHolderName;
            _searchPanels[06] = pnlAccountNumber;
            _searchPanels[07] = pnlDescription;
            _searchPanels[08] = pnlPayType;
            _searchPanels[09] = pnlCompanyName;
            _searchPanels[10] = pnlRefferFrom;
            _searchPanels[11] = pnlRefferToUser;

            selectSearchPanel(0);
        }
Пример #13
0
 public void init()
 {
     BasicInfoUtil.fillCheckBoxList(cbReferAction, "ReferenceCycleAction", -1);
     UsersBS.fillCheckedListWithUsers(cbRefferFrom, -1);
 }
Пример #14
0
        public void initForm()
        {
            cmbPayType.Items.Clear();
            ComboBoxItem item = new ComboBoxItem("چک", "0");

            cmbPayType.Items.Add(item);
            item = new ComboBoxItem("نقد", "1");
            cmbPayType.Items.Add(item);

            int           bankid    = 0;
            int           companyId = 0;
            DateConverter converter = new DateConverter();

            if (_id > 0)
            {
                ChequeEntity entity = _chequeBL.get(_id);

                if (entity.get(ChequeEntity.FIELD_PAY_TYPE).ToString().Length > 0)
                {
                    if (((bool)entity.get(ChequeEntity.FIELD_PAY_TYPE)) == true)
                    {
                        cmbPayType.SelectedIndex = 1;
                    }
                    else
                    {
                        cmbPayType.SelectedIndex = 0;
                    }
                }
                else
                {
                    cmbPayType.SelectedIndex = -1;
                    lblCbArchive.Visible     = false;
                    cbArchive.Visible        = false;
                }
                if (entity.get(ChequeEntity.FIELD_USER_TREE_ID).ToString().Length > 0)
                {
                    _userTreeId = int.Parse(entity.get(ChequeEntity.FIELD_USER_TREE_ID).ToString());
                }

                txtChequeNumber.Text      = entity.get(ChequeEntity.FIELD_CHEQUE_NUMBER).ToString();
                txtMaturityDate.Text      = converter.valueToString(entity.get(ChequeEntity.FIELD_MATURITY_DATE));
                txtEntryDate.Text         = converter.valueToString(entity.get(ChequeEntity.FIELD_ENTRY_DATE));
                txtRefferDate.Text        = converter.valueToString(entity.get(ChequeEntity.FIELD_REFFER_DATE));
                txtPrice.Text             = entity.get(ChequeEntity.FIELD_PRICE).ToString();
                txtAccountNumber.Text     = entity.get(ChequeEntity.FIELD_ACCOUNT_NUMBER).ToString();
                txtInsuranceNumber.Text   = entity.get(ChequeEntity.FIELD_INSURANCE_NUMBER).ToString();
                txtAccountHolderName.Text = entity.get(ChequeEntity.FIELD_ACCOUNT_HOLDER_NAME).ToString();
                //txtDescription.Text = entity.get(ChequeEntity.FIELD_DESCRIPTION).ToString();
                txtRegistrantUser.Text = UsersBS.loginedUser.ToString();
                if (entity.get(ChequeEntity.FIELD_BANK_ID).ToString().Length > 0)
                {
                    bankid = int.Parse(entity.get(ChequeEntity.FIELD_BANK_ID).ToString());
                }

                txtCompany.Tag = 0;
                if (entity.get(ChequeEntity.FIELD_COMPANY_ID).ToString().Length > 0)
                {
                    txtCompany.Tag  = (int)entity.get(ChequeEntity.FIELD_COMPANY_ID);
                    txtCompany.Text = CompanyBL.getCompanyName((int)txtCompany.Tag);
                }

                cbArchive.Checked = (Boolean)("".Equals(entity.get(ChequeEntity.FIELD_ARCHIVE).ToString()) ? false : entity.get(ChequeEntity.FIELD_ARCHIVE));

                if (entity.get(ChequeEntity.FIELD_INSURANCE_COMPANY).ToString().Length > 0)
                {
                    companyId = int.Parse(entity.get(ChequeEntity.FIELD_INSURANCE_COMPANY).ToString());
                }

                UsersBS usersBs = new UsersBS();
                string  s       = "";
                int     id      = -1;
                if (entity.get(ChequeEntity.FIELD_REGISTRANT_USER).ToString().Length > 0)
                {
                    UsersEntity ue = usersBs.get(int.Parse(entity.get(ChequeEntity.FIELD_REGISTRANT_USER).ToString()));
                    if (ue.Tables[ue.FilledTableName].Rows.Count <= 0)
                    {
                        s  = UsersBS.loginedUser.ToString();
                        id = int.Parse(UsersBS.loginedUser.get(UsersEntity.FIELD_ID).ToString());
                    }
                    else
                    {
                        s  = ue.ToString();
                        id = int.Parse(ue.get(UsersEntity.FIELD_ID).ToString());
                    }
                }
                else
                {
                    s  = UsersBS.loginedUser.ToString();
                    id = int.Parse(UsersBS.loginedUser.get(UsersEntity.FIELD_ID).ToString());
                }
                txtRegistrantUser.Text = s;
                txtRegistrantUser.Tag  = id;

                if (entity.get(ChequeEntity.FIELD_REGISTER_DATE) != null &&
                    entity.get(ChequeEntity.FIELD_REGISTER_DATE).ToString().Length > 0)
                {
                    txtRegisterDate.Text = converter.valueToString(entity.get(ChequeEntity.FIELD_REGISTER_DATE));
                }
                else
                {
                    txtRegisterDate.Text = converter.valueToString(DateTime.Now);
                }

                cmbReferenceUserId.Visible = false;
                lblReferenceUserId.Visible = false;
            }
            else
            {
                //lblChqueReply.Visible = false;
                tblReply.Visible       = false;
                txtRegistrantUser.Tag  = UsersBS.loginedUser.get(UsersEntity.FIELD_ID);
                txtRegistrantUser.Text = UsersBS.loginedUser.ToString();

                txtRegisterDate.Text = converter.valueToString(DateTime.Now);

                cmbReferenceUserId.Visible = true;
                lblReferenceUserId.Visible = true;
                fillUserRefferenceCombo(-1);
                txtCompany.Tag = 0;
            }

            BasicInfoUtil.fillComboBox(cmbInsuranceCompany, "InsuranceCompany", companyId);
            BasicInfoUtil.fillComboBox(cmbBankId, "Bank", bankid);
            initList();

            if (readOnly == true)
            {
                btnSave.Enabled = false;
                btnReferToMasterUser.Enabled = false;
            }

            setPermision();
            if (_id < 0)
            {
                linkAttachment.Visible = false;
            }
        }