Example #1
0
        public void Timer1_Tick(object sender, EventArgs e)
        {
            var taskInstanceManager = new TaskInstanceManager();

            var q = from i in taskInstanceManager.GetQuery().Where(r => r.PerformerID == CurrentUserCode && r.TaskInstanceStatusID == 0)
                    where !_primaryKeys.Contains(i.TaskInstanceID)
                    select i;

            if (q.Any())
            {
                var count = q.Count();
                //PopUpLbl.Text = "شما درخواست جدید دارید ( " + Extensions.ToPersianDigit(count.ToString()) + " )";
                PopUpLbl.Text = "شما  " + count.ToString().ToPersianDigit() + " درخواست جدید دارید.";
                radNotification.VisibleOnPageLoad = true;
                FillGrid();
                TaskInstanceRadGrid.Rebind();
            }
            else
            {
                PopUpLbl.Text = "";
                radNotification.VisibleOnPageLoad = false;
            }

            _primaryKeys = taskInstanceManager
                           .GetQuery(r => r.PerformerID == CurrentUserCode && r.TaskInstanceStatusID == 0)
                           .Select(r => r.TaskInstanceID)
                           .ToList();
        }
Example #2
0
        //-----------------------------------------------------------------------------------------
        #region "Request Worker"

        private List <Worker> GetListRequestByWorker(long _Worker, List <BusinessObjects.Request> _Requests)
        {
            List <Worker> _workerClass        = new List <Worker>();
            var           taskInstanceManager = new TaskInstanceManager();
            MemberManager memberManager       = new MemberManager();
            EntityManager entityManager       = new EntityManager();

            var typeEntity = entityManager.GetQuery(e => e.EntityID == _Worker).ToList();

            if (typeEntity.Count == 0)
            {
                return(_workerClass);
            }

            int entityTypeID = typeEntity.FirstOrDefault().EntityTypeID.Value;

            switch (entityTypeID)
            {
            case 2:     //     User = 2,
                string PersonalCardNo1 = typeEntity.FirstOrDefault().PersonalCardNo;
                var    tis             = taskInstanceManager.GetQuery(c => c.PerformerID == PersonalCardNo1).ToList();
                foreach (var g in tis)
                {
                    _workerClass.Add(new Worker {
                        RequestID = long.Parse(g.EntityID), WorkerPersonalCardNo = g.PerformerID
                    });
                }
                break;

            case 9:      //Group = 9,

                var groups             = memberManager.GetQuery(p => p.EntityID1 == _Worker).Select(m => m.EntityID2).ToList();
                var ListPersonalCardNo = entityManager.GetQuery().Where(en => groups.Contains(en.EntityID)).Select(c => c.PersonalCardNo).ToList();
                var taskInstanceg      = taskInstanceManager.GetQuery(c => ListPersonalCardNo.Contains(c.PerformerID)).ToList();
                foreach (var g2 in taskInstanceg)
                {
                    _workerClass.Add(new Worker {
                        RequestID = long.Parse(g2.EntityID), WorkerPersonalCardNo = g2.PerformerID
                    });
                }
                break;

            case 7:       //Role = 7

                var Roles = memberManager.GetQuery(p => p.EntityID1 == _Worker).Select(m => m.EntityID2).ToList();
                var Group = memberManager.GetQuery(p => Roles.Contains(p.EntityID1)).Select(q => q.EntityID2).ToList();
                var ListPersonalCardNoRoles = entityManager.GetQuery().Where(en => Group.Contains(en.EntityID)).Select(c => c.PersonalCardNo).ToList();
                var taskInstancegRoles      = taskInstanceManager.GetQuery(c => ListPersonalCardNoRoles.Contains(c.PerformerID)).ToList();
                foreach (var g2 in taskInstancegRoles)
                {
                    _workerClass.Add(new Worker {
                        RequestID = long.Parse(g2.EntityID), WorkerPersonalCardNo = g2.PerformerID
                    });
                }
                break;
            }
            return(_workerClass);
        }
Example #3
0
        protected void FillGrid()
        {
            var taskInstanceManager = new TaskInstanceManager();
            var kartableList        =
                taskInstanceManager.GetQuery()
                .Where(r => r.PerformerID == CurrentUserCode && r.TaskInstanceStatusID == 0)
                .ToList();

            foreach (var taskInstance in kartableList)
            {
                var date           = taskInstance.InsertDate;
                var differenceDate = DateTime.Now - date;
                if (differenceDate != null)
                {
                    var daysCount = differenceDate.Value.Days;
                    if (daysCount > 0)
                    {
                        taskInstance.PriorityID += Convert.ToInt32(Math.Floor(daysCount * Constants.PriorityCoefficient));
                    }
                }
                var instance = taskInstance;
                var entity   = _entityManager.GetQuery(it => it.PersonalCardNo == instance.InsertUser).FirstOrDefault();
                if (entity != null)
                {
                    taskInstance.InsertUser = entity.Title;
                }
                taskInstance.InsertDatePrescriptive = UIUtils.ToPersianDate(taskInstance.InsertDate).ToPersianDigit();
                //Mahyar Mahyar Mahyar
                //taskInstance.InsertDatePrescriptive = UIUtils.ToPersianDate(taskInstance.InsertDate);
            }

            TaskInstanceRadGrid.DataSource = kartableList.OrderByDescending(r => r.PriorityID);
            _primaryKeys = kartableList.Select(m => m.TaskInstanceID).ToList();
        }
Example #4
0
        public List <RequestInsertUserAction> ReportBySupportGroup(long roleId, DateTime?fromDate, DateTime?toDate, long exeprtEntityId)
        {
            var memberManager       = new MemberManager();
            var entityManager       = new EntityManager();
            var requestManager      = new RequestManager();
            var taskInstanceManager = new TaskInstanceManager();

            var performerPersonalCardNo =
                entityManager.GetQuery(it => it.EntityID == exeprtEntityId).Select(it => it.PersonalCardNo).
                FirstOrDefault();
            var tis = taskInstanceManager.GetQuery(p => p.PerformerID == performerPersonalCardNo).Select(instance => instance.PerformerID).Distinct().ToList();

            var taskInstanceDistinct = taskInstanceManager.GetQuery(p => tis.Contains(p.PerformerID)).ToList();//.Select(p => p.EntityID);

            var taskInstances = new List <long>();

            foreach (var taskInstance in taskInstanceDistinct)
            {
                if (taskInstance.PerformerID != null)
                {
                    taskInstances.Add(long.Parse(taskInstance.EntityID));
                }
            }

            var entitiesList = requestManager.GetQuery(p => taskInstances.Contains(p.RequestID)).ToList().Where(p => p.InsertDate >= fromDate && p.InsertDate <= toDate).ToList();

            var x = (from r in entitiesList
                     join
                     t in taskInstanceDistinct on r.RequestID.ToString() equals t.EntityID
                     select new RequestInsertUserAction
            {
                RequestId = r.RequestID,
                RegisterByName = r.RegisterByName,
                RequesterID = r.InsertUser,
                InsertDateEn = r.InsertDate,
                OptionalLocation = r.OptionalLocation,
                //RequestPriority = r.Priority.Title,
                RequertTypeId = r.RequestTypeID,
                //RequertType = r.RequestType.Title,
                PerformerID = t.PerformerID
            }).OrderBy(p => p.PerformerID).ToList();

            return(x);
        }
Example #5
0
        protected void TaskInstanceRadGrid_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
            {
                var target = e.Item.FindControl("targetControl");
                if (!Equals(target, null))
                {
                    //if (!Equals(RadToolTipManager1, null))
                    //{
                    //    //Add the button (target) id to the tooltip manager
                    //    var item = (GridDataItem)e.Item;
                    //    RadToolTipManager1.TargetControls.Add(target.ClientID, item["EntityID"].Text, true);
                    //}
                }
            }
            else if (e.Item is GridEditFormItem)
            {
                var item = (GridEditFormItem)e.Item;
                item["ExtraInfo"].Text = item["ExtraInfo"].Text.ToPersianDigit();
                item["WorkflowInstanceInsertUser"].Text = item["WorkflowInstanceInsertUser"].Text.ToPersianDigit();
                var personalCardNo = item["InsertUser"].Text;
                //var entity = _entityManager.GetQuery(it => it.PersonalCardNo == personalCardNo).FirstOrDefault();
                //item["InsertUser"].Text = entity.Title;
            }

            if (e.Item is GridDataItem)
            {
                var       dataItem = (GridDataItem)e.Item;
                TableCell myCell   = dataItem["TaskCode"];
                if (myCell.Text == "Verify_By_Oprator")
                {
                    dataItem.ForeColor = System.Drawing.Color.Maroon;
                    dataItem.Font.Bold = true;
                }
                else if (myCell.Text == "Verify_By_Leader")
                {
                    dataItem.ForeColor = System.Drawing.Color.MidnightBlue;
                    dataItem.Font.Bold = true;
                }

                var taskInstanceId = Guid.Parse(dataItem["taskInstanceId"].Text);
                var taskInstance   = _taskInstanceManager.GetQuery(it => it.TaskInstanceID == taskInstanceId).FirstOrDefault();
                var entityId       = long.Parse(taskInstance.EntityID);
                var request        = _attachmentManager.GetQuery(it => it.RequestID == entityId);
                var image          = (Image)dataItem.FindControl("img");
                if (request.Any())
                {
                    image.ImageUrl = "~/Images/attachment.png";
                }
                else
                {
                    image.Visible = false;
                    image.Enabled = false;
                }
            }
        }
Example #6
0
        public List <Request> GetRequestWithPriority(DateTime?toDate, DateTime?fromDate, long value1, long value2)
        {
            //var requests = this.GetQuery(r => r.RequestPriority == value
            //                                            && r.InsertDate <= toDate
            //                                            && r.InsertDate >= fromDate)
            //    .ToList();


            //return requests;

            var taskinstanceManager = new TaskInstanceManager();

            var requestEntitites = taskinstanceManager.GetQuery(p => p.PriorityID > value1 && p.PriorityID <= value2).Select(p => p.EntityID).ToList();
            var stringIdnetities = new List <long>();

            foreach (var requestEntitity in requestEntitites)
            {
                stringIdnetities.Add(long.Parse(requestEntitity));
            }
            var requests = this.GetQuery(p => stringIdnetities.Contains(p.RequestID)).ToList();

            return(requests);
        }