protected void grd_GovahiRequestState_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { var cmnb = new CommonBusiness(); try { if (e.CommandName == "EditEraeBe") { var txtEditEraeBe = e.Item.FindControl("txt_EditEraeBe") as TextBox; if (txtEditEraeBe != null) { GovahiBusiness.UpdateEraeBe(txtEditEraeBe.Text, int.Parse(e.CommandArgument.ToString())); } business.UpdateStudentRequestLogID(Session[sessionNames.userID_StudentOstad].ToString(), 6, 3, int.Parse(e.CommandArgument.ToString())); GovahiBusiness.UpdateStudentPOstNumber(Session[sessionNames.userID_StudentOstad].ToString(), "", 3, int.Parse(e.CommandArgument.ToString())); cmnb.InsertIntoStudentLog(Session[sessionNames.userID_StudentOstad].ToString(), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_StudentOstad].ToString()), 19, "ویرایش محل ارائه"); var dtgo = GovahiBusiness.GetGovahiStatus(Session[sessionNames.userID_StudentOstad].ToString()); if (dtgo.Rows.Count > 0) { grd_GovahiRequestState.Visible = true; grd_GovahiRequestState.DataSource = dtgo; grd_GovahiRequestState.DataBind(); } } if (e.CommandName == "pay") { var dtbedehi = GovahiBusiness.GetBedehkar(Session[sessionNames.userID_StudentOstad].ToString()); var dts = GovahiBusiness.GetStRegisterd(Session[sessionNames.userID_StudentOstad].ToString()); var bedehi = Convert.ToDouble((dtbedehi.Rows[0]["bedehi"].ToString())); var dtmojazgovahi = GovahiBusiness.GetMojazGovahi(Session[sessionNames.userID_StudentOstad].ToString()); if (!GovahiBusiness.CanPay(Session[sessionNames.userID_StudentOstad].ToString())) { rwm_Validations.RadAlert("درخواست شما برای ترم کنونی نمی باشد لطفا درخواست ها رو حذف نمایید و مجددادرخواستی ثبت نمایید", 600, 100, "خطا", null); return; } if (dtmojazgovahi.Rows.Count == 0 && bedehi > 0) { rwm_Validations.RadAlert("به علت بدهکاری درخواست گواهی اشتغال به تحصیل مقدور نمی باشد ", 420, 100, "خطا", null); return; } else if (dts.Rows.Count == 0) { rwm_Validations.RadAlert("دانشجو در این ترم ثبت نام نکرده است", 300, 100, "خطا", null); return; } long orderid;//= new bmp_PaymentBusiness().GenerateOrderId(); SetDefaultDateTime(); var pay = new PaymentDTO(); var bmp = new bmp_PaymentBusiness(); var dt = GovahiBusiness.GetAmountForPay(Session[sessionNames.userID_StudentOstad].ToString()); grd_pay.DataSource = dt; pay.Amount = int.Parse(dt.Rows[0]["mablagh"].ToString()); pay.PayDate = PayDate + "_" + PayTime; pay.stcode = Session[sessionNames.userID_StudentOstad].ToString(); pay.bankId = 2; pay.tterm = ConfigurationManager.AppSettings["Term"]; var result = bmp.pay(pay.Amount, pay.stcode, out orderid, Convert.ToInt32(Session[sessionNames.appID_StudentOstad]), 0); pay.OrderId = orderid; var resultArray = result.Split(','); pay.ReqKey = resultArray[1]; pay.AppStatus = "none"; pay.TraceNumber = 0; pay.Result = -1; pay.PayType = 1; var reqIdArray = Session["ReqID"].ToString().Split(new char[] { ',' }); var payId = Session["PayID"].ToString().Split(new char[] { ',' }); for (var i = 0; i < reqIdArray.Length; i++) { if (i == 0) { pay.RequestId = int.Parse(reqIdArray[i]); GovahiBusiness.UpdatePymentDetail(pay.OrderId, pay.PayDate, int.Parse(payId[i]), 140000, pay.ReqKey); } else { pay.RequestId = int.Parse(reqIdArray[i]); GovahiBusiness.UpdatePymentDetail(pay.OrderId, pay.PayDate, int.Parse(payId[i]), 20000, pay.ReqKey); } } Session["ReqID"] = null; Session["PayID"] = null; if (resultArray[0] == "0") { ClientScript.RegisterStartupScript(typeof(Page), "ClientScript", "<script language='javascript' type='text/javascript'> postRefId('" + resultArray[1] + "');</script> ", false); } } if (e.CommandName == "Del") { var deloCommands = e.CommandArgument.ToString().Split(new char[] { ',' }); GovahiBusiness.DeleteGovahiRequest(int.Parse(deloCommands[0]), int.Parse(deloCommands[1])); business.InsertInToStudentLog(Session[sessionNames.userID_StudentOstad].ToString(), DateTime.Now.Date, DateTime.Now.ToShortTimeString(), 1); var dtgo = GovahiBusiness.GetGovahiStatus(Session[sessionNames.userID_StudentOstad].ToString()); if (dtgo.Rows.Count > 0) { grd_GovahiRequestState.Visible = true; grd_GovahiRequestState.DataSource = dtgo; grd_GovahiRequestState.DataBind(); } var dt = GovahiBusiness.GetAmountForPay(Session[sessionNames.userID_StudentOstad].ToString()); grd_pay.DataSource = dt; grd_pay.DataBind(); if (dt.Rows.Count > 0 && (int.Parse(dt.Rows[0]["amount"].ToString())) > 0) { grd_pay.Visible = true; } else { grd_pay.Visible = false; } } } catch (Exception exp) { Response.Write("Error: " + exp.Message); } }
/// <summary> /// با فشردن کلید تایید یا رد درخواست ارسال گواهی اشتغال به تحصیل، این متد فعال می گردد /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.GridCommandEventArgs"/> instance containing the event data.</param> protected void grd_GovahiRequest_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { CommonBusiness cmnb = new CommonBusiness(); if (e.CommandName == "radedarkhast") { RadWindowManager windowManager = new RadWindowManager(); RadWindow widnow1 = new RadWindow(); widnow1.NavigateUrl = "../CMS/InsertRejectDescription.aspx?params=" + e.CommandArgument.ToString(); widnow1.ID = "RadWindow1"; windowManager.Width = System.Web.UI.WebControls.Unit.Pixel(500); windowManager.Height = System.Web.UI.WebControls.Unit.Pixel(400); widnow1.VisibleOnPageLoad = true; windowManager.Windows.Add(widnow1); ContentPlaceHolder mpContentPlaceHolder; mpContentPlaceHolder = (ContentPlaceHolder)Page.Master.FindControl("ContentPlaceHolder1"); mpContentPlaceHolder.Controls.Add(widnow1); } if (e.CommandName == "printgovahi") { this.StiWebViewer1.ResetReport(); string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' }); Session["stcode"] = commandArgs[0]; Session["RequestTypeID"] = commandArgs[1]; Session["StudentRequestID"] = commandArgs[2]; Session["Erae_Be"] = commandArgs[3]; var studentRegisterInCurrentTerm = GovahiBusiness.GetStRegisterd(Session["stcode"].ToString()); var studentsInfo = CartBusiness.GetStudentsInfo(Session["stcode"].ToString()); var studentRequest = GovahiBusiness.GetRequestByRequestID(int.Parse(Session["StudentRequestID"].ToString())); var currentTerm = unibusiness.GetTermJary(); var mashmulNumber = studentRequest?.Rows[0]["MashmulNumber"].ToString(); TextBox txt_EraeBe = (TextBox)e.Item.FindControl("txt_EraeBe"); if (studentRegisterInCurrentTerm.Rows.Count == 0) { CartBusiness.UpdateStudentRequestLogID(Session["stcode"].ToString(), 5, 3, int.Parse(Session["StudentRequestID"].ToString())); GovahiBusiness.UpdateStudentPOstNumber(Session["stcode"].ToString(), " عدم ثبت نام در ترم جاری", 3, int.Parse(Session["StudentRequestID"].ToString())); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 31, "ارائه به : " + txt_EraeBe.Text, Convert.ToInt32(Session["StudentRequestID"].ToString())); GovahiBusiness.UpdateAmount(Convert.ToInt32(Session["StudentRequestID"]), int.Parse(Session["StudentRequestID"].ToString())); rwm_Validations.RadAlert("به دلیل عدم ثبت نام در ترم جدید امکان چاپ گواهی وجود ندارد و درخواست مورد نظر رد می شود", 500, 100, "خطا", null); grd_GovahiRequest.Rebind(); return; } else { if (currentTerm.Rows[0]["termCode"].ToString() == studentRequest.Rows[0]["Term"].ToString()) { CartBusiness.UpdateStudentRequestLogID(Session["stcode"].ToString(), 7, 3, int.Parse(Session["StudentRequestID"].ToString())); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 33, "ارائه به : " + txt_EraeBe.Text, Convert.ToInt32(Session["StudentRequestID"].ToString())); StiWebViewer1.Visible = true; StiReport rpt = new StiReport(); rpt.Load(Server.MapPath("../Reports/eshteghal.mrt")); rpt.Dictionary.Databases.Clear(); rpt.Dictionary.Databases.Add(new StiSqlDatabase("Connection1", CB.ReportConnection.ToString())); rpt.Compile(); rpt.CompiledReport.DataSources["[Request].[SP_Get_StudentInfo]"].Parameters["@stcode"].ParameterValue = Session["stcode"].ToString(); rpt.CompiledReport.DataSources["[Request].[SP_GetRequestByRequestID]"].Parameters["@StudentRequestID"].ParameterValue = int.Parse(Session["StudentRequestID"].ToString()); rpt.RegData(studentsInfo); StiWebViewer1.Report = rpt; StiWebViewer1.Visible = true; } else { var requestID = int.Parse(business.InsertInToStudentRequest(Session["stcode"].ToString(), 3, 7, Session["Erae_Be"].ToString(), mashmulNumber, 1).ToString()); CartBusiness.UpdateStudentRequestLogID(Session["stcode"].ToString(), 5, 3, int.Parse(Session["StudentRequestID"].ToString())); GovahiBusiness.UpdatePayment(Convert.ToInt32(Session["StudentRequestID"]), requestID); GovahiBusiness.UpdateStudentPOstNumber(Session["stcode"].ToString(), " عدم ثبت نام در ترم جاری", 3, int.Parse(Session["StudentRequestID"].ToString())); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 31, "ارائه به : " + txt_EraeBe.Text, Convert.ToInt32(Session["StudentRequestID"].ToString())); rwm_Validations.RadAlert("درخواست مورد نظر به دلیل ثبت در ترم قبل رد و درخواست جدیدی در ترم جاری ثبت می گردد همچنین دانشجو در ترم جاری ثبت نام کرده است", 400, 100, "خطا", null); CartBusiness.UpdateStudentRequestLogID(Session["stcode"].ToString(), 7, 3, requestID); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 33, "ارائه به : " + txt_EraeBe.Text, Convert.ToInt32(Session["StudentRequestID"].ToString())); StiWebViewer1.Visible = true; StiReport rpt = new StiReport(); rpt.Load(Server.MapPath("../Reports/eshteghal.mrt")); rpt.Dictionary.Databases.Clear(); rpt.Dictionary.Databases.Add(new StiSqlDatabase("Connection1", CB.ReportConnection.ToString())); rpt.Compile(); rpt.CompiledReport.DataSources["[Request].[SP_Get_StudentInfo]"].Parameters["@stcode"].ParameterValue = Session["stcode"].ToString(); rpt.CompiledReport.DataSources["[Request].[SP_GetRequestByRequestID]"].Parameters["@StudentRequestID"].ParameterValue = requestID; rpt.RegData(studentsInfo); StiWebViewer1.Report = rpt; StiWebViewer1.Visible = true; } } } if (e.CommandName == "Edit_EraeBe") { Session["StudentRequestID"] = e.CommandArgument.ToString(); if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; TextBox txt_EraeBe = e.Item.FindControl("txt_EraeBe") as TextBox; Session["EraeBe"] = txt_EraeBe.Text; GovahiBusiness.UpdateEraeBe(Session["EraeBe"].ToString(), int.Parse(Session["StudentRequestID"].ToString())); cmnb.InsertIntoUserLog(int.Parse(Session[sessionNames.userID_Karbar].ToString()), DateTime.Now.ToShortTimeString(), int.Parse(Session[sessionNames.appID_Karbar].ToString()), 34, "ارائه به : " + txt_EraeBe.Text, Convert.ToInt32(Session["StudentRequestID"].ToString())); } } }