private StiReport CreateDefenceSessionReport_Manual(string requestId, string studentCode, int defenceSessionDate, string defenceDate, bool bySign = false)
        {
            CheckOutRequestBusiness _reqBusiness = new CheckOutRequestBusiness();
            var entryYear = _reqBusiness.GetSaleVoroodByStCode(studentCode);

            StiReport rpt = new StiReport();

            if (!bySign)
            {
                if (Convert.ToUInt32(entryYear) < 95)
                {
                    //کمی
                    rpt.Load(Server.MapPath("../report/QuantityDefenceSession_Manual.mrt"));
                }
                else
                {
                    //کیفی
                    rpt.Load(Server.MapPath("../report/QualityDefenceSession_Manual.mrt"));
                }
                rpt.Dictionary.Databases.Clear();

                rpt.Dictionary.Databases.Add(new StiSqlDatabase("Connection1", CB.SupplementaryReportConnection));
                rpt.Compile();
                rpt.CompiledReport
                .DataSources["[Resource_Control].[GetDefenceSessionInformation]"]
                .Parameters["@stcode"]
                .ParameterValue =
                    studentCode;
                rpt.CompiledReport
                .DataSources["[Resource_Control].[GetDefenceSessionInformation]"]
                .Parameters["@requestId"]
                .ParameterValue = Convert.ToInt32(requestId);

                rpt.CompiledReport
                .DataSources["[Resource_Control].[GetDefenceSessionInformation]"]
                .Parameters["@defenceSessionDate"]
                .ParameterValue = defenceSessionDate;

                rpt["defenceDate"] = defenceDate;
                return(rpt);
            }
            else
            {
                if (Convert.ToUInt32(entryYear) < 95)
                {
                    //کمی
                    rpt.Load(Server.MapPath("../report/QuantityDefenceSession_Manual_BySign.mrt"));
                }
                else
                {
                    //کیفی
                    rpt.Load(Server.MapPath("../report/QualityDefenceSession_Manual_BySign.mrt"));
                }
                rpt.Dictionary.Databases.Clear();

                rpt.Dictionary.Databases.Add(new StiSqlDatabase("Connection1", CB.SupplementaryReportConnection));
                rpt.Compile();
                rpt.CompiledReport
                .DataSources["[Resource_Control].[GetDefenceSessionInformation]"]
                .Parameters["@stcode"]
                .ParameterValue =
                    studentCode;
                rpt.CompiledReport
                .DataSources["[Resource_Control].[GetDefenceSessionInformation]"]
                .Parameters["@requestId"]
                .ParameterValue = Convert.ToInt32(requestId);

                rpt.CompiledReport
                .DataSources["[Resource_Control].[GetDefenceSessionInformation]"]
                .Parameters["@defenceSessionDate"]
                .ParameterValue = defenceSessionDate;

                rpt["defenceDate"] = defenceDate;
                RequestHandler _requestHandler = new RequestHandler();
                var            address         = Request.Url.OriginalString.Replace(Request.Url.PathAndQuery, "") + Request.ApplicationPath; //Server.MapPath("../../").ToString();
                var            signs           = _requestHandler.GetSignutreOstadByImage(studentCode, address).OrderBy(c => c.IdTypeOs);
                var            score           = _requestHandler.GetScoreForDefence(Convert.ToInt32(requestId));

                rpt["modirSign"]   = signs.Where(c => c.IdTypeOs == 1)?.FirstOrDefault()?.singAddress;
                rpt["osMoshSign"]  = signs.Where(c => c.IdTypeOs == 2)?.FirstOrDefault()?.singAddress;
                rpt["osRahSign"]   = signs.Where(c => c.IdTypeOs == 3)?.FirstOrDefault()?.singAddress;
                rpt["osDavInSign"] = signs.Where(c => c.IdTypeOs == 4)?.FirstOrDefault()?.singAddress;
                rpt["osDOSign"]    = signs.Where(c => c.IdTypeOs == 5)?.FirstOrDefault()?.singAddress;

                if (Convert.ToUInt32(entryYear) < 95)
                {
                    //کمی
                    rpt["Score"]        = (score.Score);
                    rpt["ScoreLetters"] = score.ScoreLetters;
                }
                else
                {
                    //کیفی
                    rpt["Degree"] = UtilityFunction.ConvertScoreToDegree((score.Score == null ? -1 : score.Score.Value));
                }
                return(rpt);
            }
        }
Exemple #2
0
        protected void modalOpenScore_Click(object sender, EventArgs e)
        {
            btnAccept.Visible    = false;
            btnRejectOrDisp.Text = "بستن";

            lblModalTitle.Text = "تاییدیه نمره دفاع توسط اساتید";
            Button btn = (Button)sender;

            user = "******" + Session[sessionNames.userID_StudentOstad].ToString();
            GridDataItem data      = (GridDataItem)btn.NamingContainer;
            var          lblReqid  = data.FindControl("lblRequestId") as Label;
            var          lblStCode = data.FindControl("lblstudentcode") as Label;

            hdnReqId.Value  = lblReqid.Text;
            hdnStcode.Value = lblStCode.Text;
            resScore        = _requestHandler.GetScoreForDefence(int.Parse(lblReqid.Text));
            if (resScore.Score == null || resScore.Score < 0 || resScore.Score > 20)
            {
                lblTitle.Text = "پیام سیستم";
                lblAlert.Text = "نمره ای جهت تایید درج نشده است";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal2", "$('#ModalAlert').modal();", true);
                upModalAlert.Update();
                return;
            }
            CheckOutRequestBusiness _reqBusiness = new CheckOutRequestBusiness();
            var entryYear = _reqBusiness.GetSaleVoroodByStCode(lblStCode.Text);

            if (Convert.ToInt32(entryYear) < 95)
            {
                lblScore.Text = resScore.Score.ToString();
            }
            else
            {
                lblScore.Text = UtilityFunction.ConvertScoreToDegree((resScore.Score == null ? -1 : resScore.Score.Value));
            }

            var resDefOstads = _requestHandler.GetDefenceInformation(lblStCode.Text);

            if (resDefOstads.FirstConsultantId != "" && resDefOstads.FirstConsultantId != null)
            {
                PanelMosh1.Visible = true;
                chkMosh1.Checked   = resScore.FlagAcceptScoreMosh1.Value;
                if (user == resDefOstads.FirstConsultantId && !resScore.FlagAcceptScoreMosh1.Value)
                {
                    chkMosh1.Enabled     = true;
                    btnAccept.Visible    = true;
                    btnRejectOrDisp.Text = "انصراف";
                }
                else
                {
                    chkMosh1.Enabled = false;
                }
            }

            else
            {
                PanelMosh1.Visible = false;
                chkMosh1.Checked   = true;
            }



            if (resDefOstads.SecondConsultantId != "" && resDefOstads.SecondConsultantId != null)
            {
                PanelMosh2.Visible = true;
                chkMosh2.Checked   = resScore.FlagAcceptScoreMosh2.Value;
                if (user == resDefOstads.SecondConsultantId && !resScore.FlagAcceptScoreMosh2.Value)
                {
                    chkMosh2.Enabled     = true;
                    btnAccept.Visible    = true;
                    btnRejectOrDisp.Text = "انصراف";
                }
                else
                {
                    chkMosh2.Enabled = false;
                }
            }
            else
            {
                PanelMosh2.Visible = false;
                chkMosh2.Checked   = true;
            }

            if (resDefOstads.FirstGuideId != "" && resDefOstads.FirstGuideId != null)
            {
                PanelRah1.Visible = true;
                chkRah1.Checked   = resScore.FlagAcceptScoreRah1.Value;
                if (user == resDefOstads.FirstGuideId && !resScore.FlagAcceptScoreRah1.Value)
                {
                    chkRah1.Enabled      = true;
                    btnAccept.Visible    = true;
                    btnRejectOrDisp.Text = "انصراف";
                }
                else
                {
                    chkRah1.Enabled = false;
                }
            }
            else
            {
                PanelRah1.Visible = false;
                chkRah1.Checked   = true;
            }
            if (resDefOstads.SecondGuideId != "" && resDefOstads.SecondGuideId != null)
            {
                PanelRah2.Visible = true;
                chkRah2.Checked   = resScore.FlagAcceptScoreRah2.Value;
                if (user == resDefOstads.SecondGuideId && !resScore.FlagAcceptScoreRah2.Value)
                {
                    chkRah2.Enabled      = true;
                    btnAccept.Visible    = true;
                    btnRejectOrDisp.Text = "انصراف";
                }
                else
                {
                    chkRah2.Enabled = false;
                }
            }
            else
            {
                PanelRah2.Visible = false;
                chkRah2.Checked   = true;
            }
            if (resDefOstads.FirstRefereeId != "" && resDefOstads.FirstRefereeId != null)
            {
                PanelDav1.Visible = true;
                chkDav1.Checked   = resScore.FlagAcceptScoreDavin.Value;
                if (user == resDefOstads.FirstRefereeId && !resScore.FlagAcceptScoreDavin.Value)
                {
                    chkDav1.Enabled      = true;
                    btnAccept.Visible    = true;
                    btnRejectOrDisp.Text = "انصراف";
                }
                else
                {
                    chkDav1.Enabled = false;
                }
            }
            else
            {
                PanelDav1.Visible = false;
                chkDav1.Checked   = true;
            }
            if (resDefOstads.SecondRefereeId != "" && resDefOstads.SecondRefereeId != null)
            {
                PanelDav2.Visible = true;
                chkDav2.Checked   = resScore.FlagAcceptScoreDavOut.Value;
                if (user == resDefOstads.SecondRefereeId && !resScore.FlagAcceptScoreDavOut.Value)
                {
                    chkDav2.Enabled      = true;
                    btnAccept.Visible    = true;
                    btnRejectOrDisp.Text = "انصراف";
                }
                else
                {
                    chkDav2.Enabled = false;
                }
            }
            else
            {
                PanelDav2.Visible = false;
                chkDav2.Checked   = true;
            }

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal1", "$('#ModalAcceptScore').modal();", true);
            //upModalAccept.Update();
        }