Example #1
0
        private void BindGrid(int stat1, int stat2)
        {
            var reqlist = new List <RequestFR>();
            var isMasouleDorehKootahModat = UtilityFunction.IsMasouleDorehKootahModat(Convert.ToInt32(Session["RoleID"]));

            if (isMasouleDorehKootahModat == 13) //رئییس کوتاه مدت
            {
                reqlist = rq.GetRequestListByDaneshID(5);
            }
            else
            {
                if (rq.GetRequestListByDaneshID(5) != null)
                {
                    reqlist = rq.GetRequestListByDaneshID(5);

                    reqlist = reqlist.Where(c => c.IssuerID == Convert.ToInt32(Session[sessionNames.userID_Karbar].ToString())).ToList();
                }
            }



            if (reqlist != null)
            {
                if (stat1 != 4)
                {
                    var rl = from r in reqlist
                             where r.Status == stat1 || r.Status == stat2
                             select r;
                    grdProfessorReview.DataSource = rl;
                }
                else
                {
                    grdProfessorReview.DataSource = reqlist;
                }
            }
            grdProfessorReview.DataBind();
        }
Example #2
0
        private void LoadPanels(string userId, string UserRole, int daneshId, int IssuerId, int SectionId)
        {
            RequestHandler ReqHandler = new RequestHandler();
            mainViewModel  ReqsCount  = null;
            mainViewModel  ReqsCount1 = null;

            if (UtilityFunction.IsMasouleDorehKootahModat(Convert.ToInt32(UserRole)) > 0)
            {
                if (!(daneshId == 0 || daneshId == 5))
                {
                    dvWaitingForSend.Visible = true;
                    dvSent.Visible           = true;
                    dvApproved.Visible       = true;
                    dvDenied.Visible         = true;
                    ReqsCount  = ReqHandler.GetRequestCountByStatusAndDaneshId(daneshId);
                    ReqsCount1 = ReqHandler.GetRequestCountByStatusAndDaneshIdForDefence(daneshId);
                }
                if (daneshId == 5)
                {
                    dvWaitingForSend.Visible = true;
                    dvSent.Visible           = true;
                    dvApproved.Visible       = true;
                    dvDenied.Visible         = true;
                    dvWaitingForSend.Visible = false;
                    ReqsCount  = ReqHandler.GetRequestCountByStatusAndIssuerId(IssuerId);
                    ReqsCount1 = ReqHandler.GetRequestCountByStatusAndIssuerIdForDefence(IssuerId);
                }
                if (daneshId == 0)
                {
                    dvWaitingForSend.Visible = true;
                    dvSent.Visible           = true;
                    dvApproved.Visible       = true;
                    dvDenied.Visible         = true;
                    dvInformed.Visible       = true;
                    dvLost.Visible           = true;
                    ReqsCount  = ReqHandler.GetRequestCountByStatusForAdmin();
                    ReqsCount1 = ReqHandler.GetRequestCountByStatusForAdminForDefence();

                    //  ReqsCount = ReqHandler.GetRequestCountByStatus();
                }
            }
            if (UserRole == "26" || UserRole == "27" || UserRole == "28" || UserRole == "68" ||
                UserRole == "15" || UserRole == "16" || UserRole == "17" || UserRole == "67" ||
                UserRole == "66" || UserRole == "53" || UserRole == "52" || UserRole == "51")  //amoozesh
            {
                dvWaitingForSend.Visible = true;
                dvSent.Visible           = true;
                dvApproved.Visible       = true;
                dvDenied.Visible         = true;
                dvLost.Visible           = false;
                dvDenied2.Visible        = true;
                dvDenied3.Visible        = true;



                dvWaitingForSend1.Visible = true;
                dvSent1.Visible           = true;
                dvApproved1.Visible       = true;
                //dvDenied1.Visible = true;
                //dvLost1.Visible = false;
                //dvDenied21.Visible = true;
                //dvDenied31.Visible = true;

                //var rq = new RequestHandler();
                //var lostCount = rq.GetRequestListBystatusAnddaneshID(5, daneshId).Where(c => c.Status == 0).ToList().Count;
                ReqsCount  = ReqHandler.GetRequestCountByStatusAndDaneshId(daneshId);
                ReqsCount1 = ReqHandler.GetDefenceRequestCountByLocationForEducation(daneshId);

                //ReqsCount.LostCount = lostCount;
            }
            if (UserRole == "38" || UserRole == "37")//edari molasadra
            {
                dvSent.Visible     = true;
                dvApproved.Visible = true;
                dvDenied.Visible   = true;
                dvLost.Visible     = true;

                //ReqsCount = ReqHandler.GetRequestCountByLocation(1);
                ReqsCount  = ReqHandler.GetRequestCountByLocationForEdari(1);
                ReqsCount1 = ReqHandler.GetRequestCountByLocationForEdariForDefence(1);
            }

            if (UtilityFunction.IsMasouleDaftarUser(Convert.ToInt32(UserRole)))//Masoul daftar -bonyan -omoumi
            {
                // dvWaitingForSend.Visible = true;
                dvSent.Visible     = true;
                dvApproved.Visible = true;
                dvDenied.Visible   = true;
                //ReqsCount = ReqHandler.GetRequestCountByStatusAndDaneshId(daneshId);
                ReqsCount  = ReqHandler.GetRequestCountByStatusAndIssuerId(IssuerId);
                ReqsCount1 = ReqHandler.GetRequestCountByStatusAndIssuerIdForDefence(IssuerId);
            }
            //if (UserRole=="62" || UserRole == "32" || UserRole=="21")// M_daneshjoyi - moAven AMouzeshi
            //{
            //    // dvWaitingForSend.Visible = true;
            //    dvSent.Visible = true;
            //    dvApproved.Visible = true;
            //    dvDenied.Visible = true;
            //    //ReqsCount = ReqHandler.GetRequestCountByStatusAndDaneshId(daneshId);
            //    ReqsCount = ReqHandler.GetRequestCountByStatusAndIssuerId(IssuerId);

            //}


            if (UserRole == "39" || UserRole == "40")//edari pasdaran
            {
                dvSent.Visible      = true;
                dvApproved.Visible  = true;
                dvDenied.Visible    = true;
                dvSent1.Visible     = true;
                dvApproved1.Visible = true;

                //ReqsCount = ReqHandler.GetRequestCountByLocation(2);

                ReqsCount  = ReqHandler.GetRequestCountByLocationForEdari(2);
                ReqsCount1 = ReqHandler.GetDefenceRequestCountByLocationForEdari(2);
            }
            if (UserRole == "50")//moAven edari mali
            {
                dvSent.Visible     = true;
                dvApproved.Visible = true;
                dvDenied.Visible   = true;
                dvLost.Visible     = true;
                ReqsCount          = ReqHandler.GetRequestCountByStatus();
                ReqsCount1         = ReqHandler.GetRequestCountByStatusForDefence();
            }
            if (UserRole == "1")//admin
            {
                dvWaitingForSend.Visible = true;
                dvSent.Visible           = true;
                dvApproved.Visible       = true;
                dvDenied.Visible         = true;
                dvInformed.Visible       = true;
                dvLost.Visible           = true;
                //ReqsCount = ReqHandler.GetRequestCountByStatus();
                ReqsCount  = ReqHandler.GetRequestCountByStatusForAdmin();
                ReqsCount1 = ReqHandler.GetRequestCountByStatusForAdminForDefence();
            }
            //UserRole = "7";
            if (UserRole == "7")//fani
            {
                dvWaitingForSend1.Visible = true;
                //dvSent1.Visible = true;
                dvApproved1.Visible = true;

                ReqsCount1 = ReqHandler.GetDefenceRequestCountByLocationForTechnical();
            }
            lblWaitingForSend.Text  = ReqsCount?.WaitingForSendCount.ToString();
            lblSent.Text            = ReqsCount?.SentCount.ToString();
            lblApproved1.Text       = ReqsCount?.ApprovedCount.ToString();
            lblDenid1.Text          = ReqsCount?.DeniedCount.ToString();
            lblInformed.Text        = ReqsCount?.InformedCount.ToString();
            lblLost.Text            = ReqsCount?.LostCount.ToString();
            lblWaitingForSend1.Text = ReqsCount1?.WaitingForSendCount.ToString();
            //lblSent1.Text = ReqsCount1?.SentCount.ToString();
            if (UserRole != "7")
            {
                lblApproved11.Text = ReqsCount1?.ApprovedCount.ToString();
            }
            else
            {
                lblApproved11.Text = ReqsCount1?.SentCount.ToString();
            }

            lblDenid11.Text   = ReqsCount1?.DeniedCount.ToString();
            lblInformed1.Text = ReqsCount1?.InformedCount.ToString();
            lblLost1.Text     = ReqsCount1?.LostCount.ToString();
            RequestHandler rq = new RequestHandler();
            var            countDeniedByEdari     = 0;
            var            countDeniedByAmouzesh  = 0;
            var            countDeniedByEdari1    = 0;
            var            countDeniedByAmouzesh1 = 0;

            if (rq.GetRequestListBystatusAnddaneshID(5, daneshId) != null)
            {
                countDeniedByEdari    = rq.GetRequestListBystatusAnddaneshID(5, daneshId).Where(c => c.Status == 0).ToList().Count;
                countDeniedByAmouzesh = rq.GetRequestListBystatusAnddaneshID(5, daneshId).Where(c => c.Status == 1).ToList().Count;
            }

            if (rq.GetRequestListBystatusAnddaneshIDForDefence(5, daneshId) != null)
            {
                countDeniedByEdari1    = rq.GetRequestListBystatusAnddaneshIDForDefence(5, daneshId).Where(c => c.Status == 0).ToList().Count;
                countDeniedByAmouzesh1 = rq.GetRequestListBystatusAnddaneshIDForDefence(5, daneshId).Where(c => c.Status == 1).ToList().Count;
            }

            lblDenied3.Text  = countDeniedByAmouzesh.ToString();
            lblDenied2.Text  = countDeniedByEdari.ToString();
            lblDenied31.Text = countDeniedByAmouzesh1.ToString();
            lblDenied21.Text = countDeniedByEdari1.ToString();


            if (UserRole == 62.ToString() ||
                UserRole == 32.ToString() ||
                UserRole == 64.ToString() ||
                UserRole == 50.ToString())
            {
                dvWaitingForSend.Visible = false;
                dvSent.Visible           = false;
                dvApproved.Visible       = false;
                dvDenied.Visible         = false;
                dvInformed.Visible       = false;
                dvLost.Visible           = false;
            }
        }