Beispiel #1
0
        public LetterEntity getByGroupId(int id)
        {
            LetterEntity entity = new LetterEntity();
            string       cond   = LetterEntity.FIELD_GROUP_ID + "=" + provider.getSQLString(id);

            return(get(entity, cond, false));
        }
Beispiel #2
0
        public LetterEntity get(string ids)
        {
            LetterEntity entity = new LetterEntity();
            string       cond   = LetterEntity.FIELD_ID + " in (" + ids + ")";

            return(get(entity, cond, false));
        }
Beispiel #3
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 #4
0
        private void fillLists()
        {
            string       colorField = "COLOR";
            LetterEntity entity     = _letterBL.get(_letterIds);

            bindToGrid(entity, gridCurLetterAll, colorField);
        }
Beispiel #5
0
        public LetterEntity getRefferedToUser(int userid, bool showLastChained)
        {
            LetterEntity entity = new LetterEntity();
            string       cond   = LetterEntity.VIEW_FIELD_REFERENCED_USER_ID + "=" + provider.getSQLString(userid);

            return(get(entity, cond, showLastChained));
        }
Beispiel #6
0
        private void FillGrids()
        {
            if (UsersBS.loginedUser != null && UsersBS.loginedUser.get(UsersEntity.FIELD_ID) != null)
            {
                int userid = int.Parse(UsersBS.loginedUser.get(UsersEntity.FIELD_ID).ToString());

                LetterEntity entityRecieve = _letterBL.get(LetterBL.LETTER_TYPE_RECIEVE, false, userid, true);
                LetterEntity entitySend    = _letterBL.get(LetterBL.LETTER_TYPE_SEND, false, userid, true);

                ChequeEntity entityCheque = _chequeBL.get("(" + ChequeEntity.FIELD_PRICE + "<>" + ChequeEntity.VIEW_FIELD_REMAINED +
                                                          " OR " + ChequeEntity.VIEW_FIELD_REMAINED + " IS NULL)", false, userid);

                System.Collections.Hashtable hash = new Hashtable();
                hash.Add("colorField", "COLOR");

                _gridTools.bindDataToGrid(gridRecieveds, entityRecieve, new GridTools.changingRow(_gridTools.changeColor), hash);

                System.Collections.Hashtable hash2 = new Hashtable();
                hash2.Add("colorField", "COLOR_1");

                _gridTools.bindDataToGrid(gridSends, entitySend, new GridTools.changingRow(_gridTools.changeColor), hash2);

                //checque
                System.Collections.Hashtable hash3 = new Hashtable();
                hash3.Add("colorField", "COLOR_2");

                _gridTools.bindDataToGrid(chequeGridView, entityCheque, new GridTools.changingRow(_gridTools.changeColor), hash3);

                fastActionCheckBank_Tick(null, null);
            }
        }
Beispiel #7
0
        public void loadForm()
        {
            lblTextMessage.Text = "";


            _userTreeIds = getSameUserIdsLikeThisNode(_userTreeId);

            LetterEntity letterentity1 = _letterBl.getByUserTreeIds(_userTreeIds);
            ChequeEntity chequeEntity2 = _chequeBL.getByUserTreeIds(_userTreeIds);

            LetterEntity letterentity3 = _letterBl.getByUserTreeId(_userTreeId);
            ChequeEntity chequeEntity4 = _chequeBL.getByUserTreeId(_userTreeId);

            if (letterentity1.Tables[letterentity1.FilledTableName].Rows.Count <= 0 &&
                chequeEntity2.Tables[chequeEntity2.FilledTableName].Rows.Count <= 0)
            {
                cmbReferenceUserId.Enabled = false;
                btnReffferLetter.Enabled   = false;

                lblTextMessage.Text = "این کاربر نامه ای   یا چکی در اختیار ندارد";
            }
            else
            {
                cmbReferenceUserId.Enabled = true;
                btnReffferLetter.Enabled   = true;
                lblTextMessage.Text        = "ارجاعات";
                lbl1.Text = letterentity1.RowCount().ToString();
                lbl2.Text = chequeEntity2.RowCount().ToString();
                lbl3.Text = letterentity3.RowCount().ToString();
                lbl4.Text = chequeEntity4.RowCount().ToString();

                fillUserRefferenceCombo(-1);
            }
        }
Beispiel #8
0
        public void loadForm()
        {
            lblTextMessage.Text = "";


            ChequeEntity chequeEntity = _chequeBL.getByUserTreeId(_userTreeId);
            LetterEntity letterentity = _letterBl.getByUserTreeId(_userTreeId);

            if (letterentity.Tables[letterentity.FilledTableName].Rows.Count <= 0 &&
                chequeEntity.Tables[chequeEntity.FilledTableName].Rows.Count <= 0)
            {
                cmbReferenceUserId.Enabled = false;
                btnReffferLetter.Enabled   = false;
                btnDeleteUser.Enabled      = true;
                lbl3.Text           = "0";
                lbl4.Text           = "0";
                lblTextMessage.Text = "این کاربر نامه ای   و چکی در اختیار ندارد ، می توان این کاربر را حدف نمود";
            }
            else
            {
                btnDeleteUser.Enabled      = false;
                cmbReferenceUserId.Enabled = true;
                btnReffferLetter.Enabled   = true;
                lblTextMessage.Text        = "ارجاعات";
                lbl3.Text = letterentity.RowCount().ToString();
                lbl4.Text = chequeEntity.RowCount().ToString();

                fillUserRefferenceCombo(-1);
            }
        }
Beispiel #9
0
        public int getLetterType(int id)
        {
            LetterEntity letterEntity = getByLetterId(id);
            int          type         = int.Parse(letterEntity.get(LetterEntity.FIELD_LETTER_TYPE).ToString());

            return(type);
        }
Beispiel #10
0
        public LetterEntity get(int letterType, bool showLastChained)
        {
            LetterEntity entity = new LetterEntity();
            string       cond   = LetterEntity.FIELD_LETTER_TYPE + "=" + provider.getSQLString(letterType);

            return(get(entity, cond, showLastChained));
        }
Beispiel #11
0
        public LetterEntity getByLetterNumber(string letterNumber)
        {
            LetterEntity entity = new LetterEntity();
            string       cond   = LetterEntity.FIELD_LETTER_NUMBER + "=" + provider.getSQLString(letterNumber);

            return(get(entity, cond, false));
        }
Beispiel #12
0
        private int getLetters(int userId)
        {
            LetterBL     letter = new LetterBL();
            LetterEntity e      = letter.getRefferedToUser(userId, false);
            int          i      = e.Tables[e.FilledTableName].Rows.Count;

            return(i);
        }
Beispiel #13
0
        public LetterEntity getByUserTreeIds(string userTreeids)
        {
            LetterEntity entity = new LetterEntity();
            string       cond   = LetterEntity.FIELD_USER_TREE_ID + " in(" + userTreeids + ")" +
                                  " and  (" + LetterEntity.FIELD_ARCHIVE + "= 0 or " + LetterEntity.FIELD_ARCHIVE + " is null)";

            return(get(entity, cond, false));
        }
Beispiel #14
0
        public LetterEntity getByUserTreeId(int userTreeid)
        {
            LetterEntity entity = new LetterEntity();
            string       cond   = LetterEntity.FIELD_USER_TREE_ID + "=" + provider.getSQLString(userTreeid) +
                                  " and  (" + LetterEntity.FIELD_ARCHIVE + "= 0 or " + LetterEntity.FIELD_ARCHIVE + " is null)";

            return(get(entity, cond, false));
        }
Beispiel #15
0
        private void fillLists()
        {
            string       colorField = "COLOR";
            LetterEntity entity     = _letterBL.getFastActions(_userid, true);

            entity = util.Util.filterChainedLetters(entity);

            bindToGrid(entity, gridCurLetterAll, colorField);
        }
Beispiel #16
0
        public int delete(int id)
        {
            AbstractCommonData entity   = new LetterEntity();
            string             delQuery = "update " + entity.TableName + " set " + LetterEntity.FIELD_CANCEL + "=" +
                                          provider.getSQLString(1) + " where " + LetterEntity.indexField + "=" + provider.getSQLString(id);

            //delQuery = "DELETE FROM " + entity.TableName +  " WHERE " + LetterEntity.indexField + "=" + provider.getSQLString(id);
            return(provider.delete(delQuery));
        }
Beispiel #17
0
        public LetterEntity getFastActions(int userid, bool showLastChained)
        {
            LetterEntity entity  = new LetterEntity();
            string       archive = " (ARCHIVE is null OR ARCHIVE=0) ";

            string cond = archive + " AND " + LetterEntity.VIEW_FIELD_REFERENCED_USER_ID + "=" + provider.getSQLString(userid);

            cond += " AND FASTACTION=1";
            return(get(entity, cond, showLastChained));
        }
Beispiel #18
0
        public LetterEntity getCurLetterAll(int userid) //1
        {
            String CUR_LETTER_ALL = "SELECT * FROM dbo.VIEW_LETTER WHERE (ARCHIVE IS NULL OR ARCHIVE = 0) AND (REFFERDATE < GETDATE()) " +
                                    "AND USERTREEID IN(SELECT USERTREE.ID FROM USERTREE WHERE USERID = @userid@) AND NEXTLETTERID is null";

            LetterEntity entity = new LetterEntity();

            RMX_TOOLS.data.Config.provider.executeSelect(CUR_LETTER_ALL.Replace(_userLable, userid + ""), entity, entity.Tables[1].TableName);
            return(entity);
        }
Beispiel #19
0
        private void fillGrid(string cond)
        {
            _entity = _letterBl.get(cond, _letterType, cbWithChainig.Checked);

            //_letterBl.get(LetterType);
            System.Collections.Hashtable hash = new Hashtable();
            hash.Add("colorField", "COLOR");

            _gridTools.bindDataToGrid(dataGridView1, _entity, new GridTools.changingRow(_gridTools.changeColor), hash);
        }
        public void StoreId(string letterId, string clockworkId)
        {
            _table.CreateIfNotExists();

            var letterEntity = new LetterEntity(letterId, clockworkId);

            var insertOperation = TableOperation.Insert(letterEntity);

            _table.Execute(insertOperation);
        }
Beispiel #21
0
        public int getFastActionCount(bool showLastChained)
        {
            if (UsersBS.loginedUser == null)
            {
                return(0);
            }
            int          userid = int.Parse(UsersBS.loginedUser.get(UsersEntity.FIELD_ID).ToString());
            LetterEntity entity = ((LetterDA)_abstractDA).getFastActions(userid, showLastChained);

            return(entity.Tables[entity.FilledTableName].Rows.Count);
        }
Beispiel #22
0
        public LetterEntity get(string cond, int letterType, bool showLastChained)
        {
            LetterEntity entity = new LetterEntity();

            if (cond != null && cond.Length > 0)
            {
                cond += " AND ";
            }
            cond += " " + LetterEntity.FIELD_LETTER_TYPE + "=" + provider.getSQLString(letterType);
            return(get(entity, cond, showLastChained));
        }
Beispiel #23
0
        public LetterEntity getgridRateDecOralMarked(int userid)
        {
            String CUR_LETTER_ALL = " SELECT * FROM dbo.VIEW_LETTER WHERE (ARCHIVE IS NULL OR ARCHIVE = 0) AND " +
                                    "(REFFERDATE < GETDATE() - CAST('1900-01-04' AS DATETIME)) AND (LETTERSTATEID = 24) " +
                                    " AND USERTREEID IN(SELECT USERTREE.ID FROM USERTREE WHERE USERID = @userid@) AND NEXTLETTERID is null";

            LetterEntity entity = new LetterEntity();

            RMX_TOOLS.data.Config.provider.executeSelect(CUR_LETTER_ALL.Replace(_userLable, userid + ""), entity, entity.Tables[1].TableName);
            return(entity);
        }
Beispiel #24
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 #25
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);
        }
Beispiel #26
0
        public LetterEntity get(int letterType, bool isArchived, bool showLastChained)
        {
            LetterEntity entity  = new LetterEntity();
            string       archive = "";

            if (!isArchived)
            {
                archive = " (ARCHIVE is null OR ARCHIVE=0) ";
            }
            else
            {
                archive = " ARCHIVE=1 ";
            }
            string cond = LetterEntity.FIELD_LETTER_TYPE + "=" + provider.getSQLString(letterType) +
                          " AND " + archive;

            return(get(entity, cond, showLastChained));
        }
Beispiel #27
0
        private LetterEntity get(LetterEntity entity, string cond, bool showLastChained)
        {
            if (cond != null && cond.Length > 0)
            {
                cond += " AND (" + LetterEntity.FIELD_CANCEL + "= 0 OR " + LetterEntity.FIELD_CANCEL + " IS NULL )";
            }
            else
            {
                cond += " (" + LetterEntity.FIELD_CANCEL + "= 0 OR" + LetterEntity.FIELD_CANCEL + " IS NULL )";
            }

            if (showLastChained)
            {
                cond += " AND " + addChainedCondition();
            }

            provider.loadToDataSet(entity, cond);
            return(entity);
        }
        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 #29
0
        private void btnDeleteGroup_Click(object sender, EventArgs e)
        {
            DataGridView gv = gridLetterGroup;

            if (gv.SelectedCells.Count <= 0)
            {
                return;
            }

            DataGridViewColumn col = gv.Columns[gv.SelectedCells[0].ColumnIndex];

            bool isAnySelected = col.DataGridView.SelectedCells.Count > 0 && gv.SelectedCells[0].Selected;

            if (!isAnySelected)
            {
                return;
            }
            DataGridViewRow dr      = gv.SelectedCells[0].OwningRow;
            int             groupId = int.Parse(dr.Cells[0].Value.ToString());

            LetterEntity letterEntity = _letterBL.getByGroupId(groupId);
            int          letterCount  = letterEntity.Tables[letterEntity.FilledTableName].Rows.Count;

            if (letterCount > 0)
            {
                MessageBox.Show("گروهی که عضوی داشته باشد را نمی توان حذف نمود");
                return;
            }

            DialogResult dres = MessageBox.Show("آیا مایلید حذف کنید ؟", "", MessageBoxButtons.YesNo);

            if (dres.Equals(DialogResult.Yes))
            {
                _letterGroupBL.delete(groupId);
                fillGrid();
                fillLetterGrid();
            }
        }
Beispiel #30
0
        private void fillGrid()
        {
            //lblMsg.Text = "";

            if (rbDisplayAll.Checked)
            {
                _entity = _letterBl.get(LetterType, cbWithChainig.Checked);
            }
            else if (rbDisplayArchived.Checked)
            {
                _entity = _letterBl.get(LetterType, cbWithChainig.Checked);
            }
            else
            {
                _entity = _letterBl.get(LetterType, cbWithChainig.Checked);
            }

            //_letterBl.get(LetterType);
            System.Collections.Hashtable hash = new Hashtable();
            hash.Add("colorField", "COLOR");

            _gridTools.bindDataToGrid(dataGridView1, _entity, new GridTools.changingRow(_gridTools.changeColor), hash);
        }