Exemplo n.º 1
0
        private void initTree()
        {
            UsersEntity    entity         = _usersBS.get(UsersEntity.FIELD_USER_TYPE + "=" + UsersBS.ADMIN);
            UserTreeEntity userTreeEntity = null;

            for (int i = 0; i < entity.Tables[entity.FilledTableName].Rows.Count; i++)
            {
                userTreeEntity = new UserTreeEntity();
                DataRow dr = userTreeEntity.Tables[userTreeEntity.TableName].NewRow();
                dr[UserTreeEntity.FIELD_USER_ID]   = entity.get(UsersEntity.FIELD_ID);
                dr[UserTreeEntity.FIELD_USER_PATH] = entity.get(UsersEntity.FIELD_ID).ToString();
                userTreeEntity.Tables[userTreeEntity.TableName].Rows.Add(dr);
                _userTreeBL.add(userTreeEntity);
            }

            userTreeEntity = _userTreeBL.get();
            for (int i = 0; i < userTreeEntity.Tables[userTreeEntity.FilledTableName].Rows.Count; i++)
            {
                entity = _usersBS.get(int.Parse(userTreeEntity.get(UserTreeEntity.FIELD_USER_ID).ToString()));
                TreeNode node = new TreeNode(entity.ToString());
                node.ForeColor = Color.Green;
                node.Tag       = NodeItem.ToNodeItem(userTreeEntity, i);
                treeView1.Nodes.Add(node);
            }
        }
Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 3
0
        private void fillCombo()
        {
            UsersEntity entity = _usersBs.getMasterUsers();

            //کاربران اصلی را در کاکبو لیست می کند
            for (int i = 0; i < entity.Tables[entity.FilledTableName].Rows.Count; i++)
            {
                string name = entity.get(i, UsersEntity.FIELD_NAME).ToString() + " " +
                              entity.get(i, UsersEntity.FIELD_FAMILY).ToString() + "(" + entity.get(i, UsersEntity.FIELD_USERNAME).ToString() + ")";

                int          masterUserId = int.Parse(entity.get(i, UsersEntity.FIELD_ID).ToString());
                ComboBoxItem item         = new ComboBoxItem();
                item.Text  = name;
                item.Value = masterUserId.ToString();
            }
            //الگو ها را لیست می کند
            LetterNumberPatternBL     letPatt = new LetterNumberPatternBL();
            LetterNumberPatternEntity pEntity = letPatt.get();

            for (int i = 0; i < pEntity.Tables[pEntity.FilledTableName].Rows.Count; i++)
            {
                string       name = pEntity.get(i, LetterNumberPatternEntity.FIELD_PATTERN_NAME).ToString();
                string       id   = pEntity.get(i, LetterNumberPatternEntity.FIELD_ID).ToString();
                ComboBoxItem item = new ComboBoxItem();
                item.Text  = name;
                item.Value = id;
                cmbLetterPattern.Items.Add(item);
            }
        }
Exemplo n.º 4
0
        public int delete(int id)
        {
            int userid = int.Parse(loginedUser.get(UsersEntity.FIELD_ID).ToString());

            LetterItemsPermissionBL letterItemPerm   = new LetterItemsPermissionBL();
            UserpropertiesBL        userpropertiesBL = new UserpropertiesBL();

            letterItemPerm.deleteByUser(userid);
            userpropertiesBL.deleteByUser(userid);

            return(_usersDal.delete(id));
        }
Exemplo n.º 5
0
        private void txtEnter_Click(object sender, EventArgs e)
        {
            string check = checkData();

            if (check != null)
            {
                MessageBox.Show(check);
                return;
            }
            UsersBS     isb      = new UsersBS();
            UsersEntity entity   = new UsersEntity();
            string      userName = txtUserName.Text;
            string      password = txtPassword.Text;

            entity = isb.checkUser(userName, password, _checkJustManager);
            int userCount = entity.Tables[entity.FilledTableName].Rows.Count;

            if (userCount > 0)
            {
                UsersBS.loginedUser            = entity;
                UsersBS.LogginedUserProperties = new UserpropertiesBL().get(int.Parse(entity.get(UsersEntity.FIELD_ID).ToString()));
                _loggined = true;
                this.Hide();
            }
            else
            {
                MessageBox.Show("نام کاربر یا کلمه عبور معتبر نیست! چنین کاربری یافت نشد!");
            }
        }
Exemplo n.º 6
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;
            }
        }