Beispiel #1
0
        public static LetterEntity filterChainedLetters(LetterEntity entityList)
        {
            string ids = ""; //جلوگیری از تکراری بودن نامه

            LetterEntity entity = new LetterEntity();

            entity.FilledTableName = entityList.FilledTableName;

            string tableName = entityList.FilledTableName;

            for (int i = 0; i < entityList.Tables[entityList.FilledTableName].Rows.Count; i++)
            {
                object next = entityList.get(i, LetterEntity.FIELD_NEXTLETTERID);
                if (next != null && next.ToString().Length > 0 && ((int)next) > 0)
                {
                    if (ids.IndexOf(next.ToString() + ",") < 0)
                    {
                        LetterEntity last = getLastLetter((int)next);
                        RMX_TOOLS.util.EntityUtil.joinEntities(entity, last, tableName, last.FilledTableName);
                        ids += next.ToString() + ",";
                    }
                }
                else
                {
                    string id = entityList.get(i, LetterEntity.FIELD_ID).ToString();
                    if (ids.IndexOf(id + ",") < 0)
                    {
                        RMX_TOOLS.util.EntityUtil.joinRow(entity, entityList, tableName, entityList.FilledTableName, i);
                        ids += id + ",";
                    }
                }
            }

            return(entity);
        }
Beispiel #2
0
        private void btnLetter_Click(object sender, EventArgs e)
        {
            LetterBL     letterBl     = new LetterBL();
            LetterEntity letterEntity = letterBl.getByLetterNumber(txtLetterNumber.Text);


            LetterForm form = new LetterForm();

            form.LetterType = int.Parse(letterEntity.get(LetterEntity.FIELD_LETTER_TYPE).ToString());
            form.LetterId   = (int)letterEntity.get(LetterEntity.FIELD_ID);
            form.readOnly   = true;
            form.initLetter();
            form.ShowDialog();
        }
Beispiel #3
0
        public int getLetterType(int id)
        {
            LetterEntity letterEntity = getByLetterId(id);
            int          type         = int.Parse(letterEntity.get(LetterEntity.FIELD_LETTER_TYPE).ToString());

            return(type);
        }
Beispiel #4
0
        public void updateLetterNumbersInLetterGroupTable(int letterGroupId)
        {
            //1- collect  letter numbers
            string       s            = "";
            LetterEntity letterEntity = getByGroupId(letterGroupId);

            for (int i = 0; i < letterEntity.Tables[letterEntity.FilledTableName].Rows.Count; i++)
            {
                s = s + letterEntity.get(LetterEntity.FIELD_LETTER_NUMBER) + ",";
            }

            s = "".Equals(s) ? "" :  s.Substring(0, s.Length - 1);

            //2 - update letter group table
            LetterGroupBL letterGroupBL = new LetterGroupBL();

            letterGroupBL.updateLetterNumbers(letterGroupId, s);
        }
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count <= 0)
            {
                return;
            }
            int letterid = (int)(dataGridView1.SelectedRows[0].Cells[4].Value);

            LetterEntity entity = _letterBL.getByLetterId(letterid);

            int        letterType = int.Parse(entity.get(LetterEntity.FIELD_LETTER_TYPE).ToString());
            LetterForm form       = new LetterForm(letterType);

            form.LetterId     = letterid;
            form.LetterEntity = entity;
            form.initLetter();
            form.ShowDialog();
            //if (form.DataChanged)
            //    FillGrids();
        }
Beispiel #6
0
        private void btnReffferLetter_Click(object sender, EventArgs e)
        {
            LetterBL letterBL = new LetterBL();
            ChequeBL chequeBL = new ChequeBL();

            IsRefferDone = false;
            int assignedUserId = 0;

            if (LetterId > 0)
            {
                LetterEntity letterEntity       = letterBL.getByLetterId(LetterId);
                int          assignedUserTreeId = int.Parse(letterEntity.get(LetterEntity.FIELD_USER_TREE_ID).ToString());
                assignedUserId = _userTreeBL.getUserIdByTreeId(assignedUserTreeId);
                bool b = FormChecker.CheckDate(txtRefferDate, lblRefferDate);
                if (!b)
                {
                    return;
                }
            }

            if (ChequeId > 0)
            {
                ChequeEntity chequeEntity       = chequeBL.get(ChequeId);
                int          assignedUserTreeId = int.Parse(chequeEntity.get(ChequeEntity.FIELD_USER_TREE_ID).ToString());
                assignedUserId = _userTreeBL.getUserIdByTreeId(assignedUserTreeId);
            }
            if (lstUserList.Items.Count <= 0 || lstUserList.SelectedIndex < 0)
            {
                MessageBox.Show("لطفا کاربری را انتخاب نمایید !");
                return;
            }
            ComboBoxItem item       = (ComboBoxItem)lstUserList.Items[lstUserList.SelectedIndex];
            int          userTreeId = int.Parse(item.Value);


            int assigntoNewUserID = _userTreeBL.getUserIdByTreeId(userTreeId);

            if (assignedUserId == assigntoNewUserID)
            {
                MessageBox.Show("آیتم مورد نظر در حال حاضر در اختیار کاربر انتخاب شده می باشد. ");
                return;
            }

            DialogResult re = MessageBox.Show("آیا از انجام عمل ارجاع مطمئن هستید ؟  ", "", MessageBoxButtons.YesNo);

            if (re.Equals(DialogResult.No))
            {
                return;
            }


            if (_letterId >= 0)
            {
                letterBL.updateRefferenceUser(_letterId, userTreeId);

                letterBL.updateRefferenceDate(RMX_TOOLS.date.DateXFormer.persianToGreGorian(txtRefferDate.Text), LetterId);

                lblMsg.Text = "ارجاع انجام گردید!";
            }
            else if (_chequeId >= 0)
            {
                chequeBL.updateRefferenceUser(_chequeId, userTreeId);
                lblMsg.Text = "ارجاع انجام گردید!";
            }
            IsRefferDone = true;

            // this.Close();
        }