protected void Page_Load(object sender, EventArgs e) { try { Hashtable ht = new Hashtable(); string id = Request.QueryString["IDs"]; ht.Add("SourceTableName", Request.QueryString["hidSourceTableName"]); ht.Add("ID", Request.QueryString["IDs"]); ht.Add("AcademicYearID", Request.QueryString["hidAcademicYearID"]); DataTable dt = new DataTable(); clsOthers oImportFromExcel = new clsOthers(); dt = oImportFromExcel.GetImportPRNFromExcelDiscrepancyStudentList(ht); GVStudent.DataSource = dt; GVStudent.DataBind(); } catch (Exception ex) { //Response.Redirect(clsGetSettings.SitePath + "Logout.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { hidFlag.Value = "0"; FillAcademicYear("0"); clsOthers oImportFromExcel = new clsOthers(); //Folllowing code is added to move the imported files source table/s (in ERPS) into Work db oImportFromExcel.MoveSucceededTableIntoWorkDB(); } }
protected void btnCancel_Click(object sender, EventArgs e) { clsOthers oImportFromExcel = new clsOthers(); string result = string.Empty; try { // setVariables(); result = oImportFromExcel.Cancelrecords(hidAcademicYearID.Value, hidSourceTableName.Value); if (result.Equals("Successful")) { lblMessage.Text = "Filed Cancelled Successfully."; lblMessage.CssClass = "saveNote"; btnConfirm.Enabled = false; // btnGetDetails.Enabled = false; btnCancel.Enabled = false; tblDiscrepancyStats.Visible = false; divFileUplToHide.Disabled = false; fileUploadExcel.Enabled = true; btnUploadProceed.Enabled = true; } else { lblFileError.Text = result; lblFileError.CssClass = "saveNote"; } } catch (Exception ex2) { lblMessage.Text = ex2.Message; lblMessage.CssClass = "errorNote"; } if (oImportFromExcel != null) { oImportFromExcel = null; } }
protected void btnConfirm_Click(object sender, EventArgs e) { clsOthers oImportFromExcel = new clsOthers(); string result = string.Empty; try { clsUser oUser = (clsUser)Session["user"]; int res = oImportFromExcel.ImportPRNFromExcel(hidSourceTableName.Value, oUser.User_ID); //int res = 1; if (res != 0) { lblMessage.Text = "Data Imported Successfully."; lblMessage.CssClass = "saveNote"; btnConfirm.Enabled = false; btnCancel.Enabled = false; // btnGetDetails.Enabled = false; //ShowDiscrepancyStats(); } else { //tnGetDetails.Enabled = true; } } catch (Exception ex1) { lblFileError.Text = ex1.Message; lblFileError.CssClass = "errorNote"; } if (oImportFromExcel != null) { oImportFromExcel = null; } }
void CancelStudentAdmission(string UniStudID, string sCancelReason) { string[] StudentIDs = UniStudID.Split('|'); string sResult = string.Empty; //string sISDirectAdmission = string.Empty; Classes.clsUser user = (Classes.clsUser)Session["User"]; Hashtable oHt = new Hashtable(); oHt["pk_Uni_ID"] = StudentIDs[0]; oHt["pk_Year"] = StudentIDs[1]; oHt["pk_Student_ID"] = StudentIDs[2]; oHt["pk_Fac_ID"] = StudentIDs[3]; oHt["pk_Cr_ID"] = StudentIDs[4]; oHt["pk_MoLrn_ID"] = StudentIDs[5]; oHt["pk_Ptrn_ID"] = StudentIDs[6]; oHt["pk_Brn_ID"] = StudentIDs[7]; oHt["pk_CrPr_Details_ID"] = StudentIDs[9]; oHt["pk_CrPrCh_ID"] = StudentIDs[10]; oHt["CrPr_Seq"] = StudentIDs[8]; oHt["CrPrCh_Seq"] = StudentIDs[11]; //oHt["Admission_Form_No"] = StudentIDs[12]; //oHt["AdmissionMode"] = StudentIDs[13]; //oHt["CrPr_OrderNo"] = StudentIDs[14]; //oHt["MINumber"] = StudentIDs[15]; //oHt["IsDirectAdmission"] = sISDirectAdmission; //oHt["Prn_number "] = ((Label)((Repeater)(source)).Items[e.Item.ItemIndex].FindControl("lblPRN")).Text; oHt["User"] = user.User_ID; oHt["CancellationReason"] = sCancelReason; //string sAdmissionFormNo = StudentIDs[12]; //string sAdmissionMode = StudentIDs[13]; //int sCrPr_OrderNo = Convert.ToInt16(StudentIDs[14]); //string sMINumber = StudentIDs[15]; //bool isDirectAdmission = StudentIDs[16].Equals("1") ? true : false; //oHt["CancellationReason"]=txtReasonforCancellation. clsStudent oStudent = new clsStudent(); clsOthers sOthers = new clsOthers(); sResult = oStudent.CancelAdmission(oHt); switch (sResult) { case "N": //#region Followng code is added to cancel the admission at OA side, call to API //string OaMessage = string.Empty; //Hashtable oHs = new Hashtable(); //oHs.Add("pk_Uni_ID", StudentIDs[0]); //if (sOthers.Allow_CancelAdmissionAtOASide(oHs)) //{ // if (sAdmissionMode == "11" || sAdmissionMode == "12") //OA unregistered // { // if (sCrPr_OrderNo.Equals(1) || isDirectAdmission) // { // clsUserLogin userLogin = new clsUserLogin(); // DataSet ds = new DataSet(); // DataTable dt = new DataTable("CancelAdmissionTable"); // dt.Columns.Add(new DataColumn("ApplicationID", typeof(string))); // dt.Columns.Add(new DataColumn("DUDCFlag", typeof(string))); // dt.Columns.Add(new DataColumn("Username", typeof(string))); // dt.Columns.Add(new DataColumn("MINumber", typeof(string))); // DataRow dr = dt.NewRow(); // dr["ApplicationID"] = sAdmissionFormNo; // dr["DUDCFlag"] = "DU"; // dr["Username"] = user.User_Name; // dr["MINumber"] = sMINumber; // dt.Rows.Add(dr); // ds.Tables.Add(dt); // string dtToJson = string.Empty; // dtToJson = JsonConvert.SerializeObject(ds, Formatting.Indented); // //old Code commented for API CALL // /* // try // { // string apiPath = userLogin.getSyncURL() + "PostStudentCancelAdmission"; // using (ExtendedWebClient client = new ExtendedWebClient()) // { // client.Headers.Add("content-type", "application/json; charset=utf-8"); // client.Encoding = System.Text.Encoding.UTF8; // OaMessage = client.UploadString(apiPath, "POST", dtToJson); // } // }*/ // try // { // string apiPath = userLogin.getSyncURL() + "PostStudentCancelAdmission"; // var httpWebRequest = (HttpWebRequest)WebRequest.Create(apiPath); // httpWebRequest.Method = "POST"; // httpWebRequest.ContentType = "application/json"; // using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) // { // streamWriter.Write(dtToJson); // streamWriter.Flush(); // streamWriter.Close(); // var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); // using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) // { // OaMessage = streamReader.ReadToEnd(); // } // } // } // catch (Exception exOA) // { // //Log the error in database Table // Hashtable oHsErrorLog = new Hashtable(); // string[] sStudentIDs = UniStudID.Split('|'); // oHsErrorLog.Add("pk_Uni_ID", sStudentIDs[0]); // oHsErrorLog.Add("pk_Year", sStudentIDs[1]); // oHsErrorLog.Add("pk_Student_ID", sStudentIDs[2]); // oHsErrorLog.Add("pk_Fac_ID", sStudentIDs[3]); // oHsErrorLog.Add("pk_Cr_ID", sStudentIDs[4]); // oHsErrorLog.Add("pk_MoLrn_ID", sStudentIDs[5]); // oHsErrorLog.Add("pk_Ptrn_ID", sStudentIDs[6]); // oHsErrorLog.Add("pk_Brn_ID", sStudentIDs[7]); // oHsErrorLog.Add("pk_CrPr_Details_ID", sStudentIDs[8]); // oHsErrorLog.Add("CrPr_Seq", sStudentIDs[9]); // oHsErrorLog.Add("CrPrCh_ID", sStudentIDs[10]); // oHsErrorLog.Add("CrPrCh_Seq", sStudentIDs[11]); // oHsErrorLog.Add("Error_Msg", exOA.Message); // oHsErrorLog.Add("UserName", user.User_Name); // sOthers.WriteOAErrorLog(oHsErrorLog); // OaMessage = "There is some issue while updating at OA side, Please contact Administrator."; // } // } // } //} ///*******************************************************************************************/ //#endregion lblMsg.Text = "Admission of the selected term cancelled successfully."; lblMsg.CssClass = "saveNote"; break; case "Y": lblMsg.Text = "Admission of the selected term cannot be cancelled."; lblMsg.CssClass = "errorNote"; break; case "E": lblMsg.Text = "Admission of the selected term could not be cancelled as the Seat number is generated for this Term."; lblMsg.CssClass = "errorNote"; break; case "I": lblMsg.Text = "Admission of the selected term could not be cancelled as the Invoice is generated for this Term."; lblMsg.CssClass = "errorNote"; break; case "": lblMsg.Text = "Admission of the selected term cannot be cancelled."; lblMsg.CssClass = "errorNote"; break; default: break; } DisplayStudentDetails(); }
protected void btnUploadProceed_Click(object sender, EventArgs e) { try { string folderPath = this.Server.MapPath(@"..\ImportFromExcelFile"); if (fileUploadExcel.HasFile) { //checking extension if (!(fileUploadExcel.FileName.EndsWith(".xls", StringComparison.OrdinalIgnoreCase) || fileUploadExcel.FileName.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase))) { lblFileError.Text = "Invalid File Extension."; return; } //code to upload file. CreateFileInServer(folderPath); //checking if data and columns of Excel are valid string proceed = CheckExcelForValidData(folderPath + "\\" + fileUploadExcel.FileName); if (proceed.Equals(string.Empty)) { clsOthers oImportFromExcel = new clsOthers(); string SourceTableName = string.Empty; SourceTableName = "ImportPRN_" + String.Format("{0:d_M_yyyy_HH_mm_ss}", System.DateTime.Now);// System.DateTime.Now.ToShortDateString(); //SourceTableName = SourceTableName.Replace(':', '_'); //SourceTableName = SourceTableName.Replace(':', '_'); string message = oImportFromExcel.CreateTable(folderPath + "\\" + fileUploadExcel.FileName, SourceTableName); Hashtable oHt = new Hashtable(); oHt.Add("AcademicYearID", hidAcademicYearID.Value); oHt.Add("SourceFileName", fileUploadExcel.FileName); oHt.Add("SourceTableName", SourceTableName); clsUser oUser = (clsUser)Session["user"]; oHt.Add("ImportedBy", oUser.User_ID); bool insertTableEntryFlag = oImportFromExcel.SavePRNImportSourceTableEntry(oHt); if (message.Equals("0") && insertTableEntryFlag) { hidSourceFileName.Value = fileUploadExcel.FileName; hidSourceTableName.Value = SourceTableName; divFileUplToHide.Disabled = true; fileUploadExcel.Enabled = false; btnUploadProceed.Enabled = false; ShowDiscrepancyStats(); } else { lblFileError.Text = message; lblFileError.CssClass = "errorNote"; } oImportFromExcel = null; } else { FileInfo fi = new FileInfo(folderPath + "\\" + fileUploadExcel.FileName); if (fi.Exists) { fi.Delete(); } lblFileError.Text = proceed; return; } } else { lblFileError.Text = "Please select valid file"; return; } } catch (Exception ex) { lblFileError.Text = ex.Message; } }
void ShowDiscrepancyStats() { clsOthers oImportFromExcel = new clsOthers(); DataSet oDGetImport = oImportFromExcel.GetImportPRNFromExcelDiscrepancyStatistics(hidAcademicYearID.Value, hidSourceTableName.Value); DataTable odt = new DataTable(); odt.Columns.Add("Section"); odt.Columns.Add("NoOfRecords"); odt.Columns.Add("SrNo"); int i = 0; if (oDGetImport != null) { foreach (DataTable oDataTable in oDGetImport.Tables) { if (oDataTable.Rows.Count > 0) { object[] rowData = oDataTable.Rows[0].ItemArray; odt.Rows.Add(odt.NewRow()); odt.Rows[i].ItemArray = rowData; i++; } } } if (odt.Rows.Count > 0) { oGvDetails.DataSource = odt; oGvDetails.DataBind(); tblDiscrepancyStats.Visible = true; lblMessage.Text = ""; if (Convert.ToInt32(odt.Rows[6]["NoOfRecords"].ToString()) > 0) { btnConfirm.Enabled = true; } else { btnConfirm.Enabled = false; lblMessage.Text = "No Valid data found for import"; //tblDiscrepancyStats.Visible = false; hidFlag.Value = "1"; string result = string.Empty; try { // setVariables(); //result = oImportFromExcel.Cancelrecords(hidAcademicYearID.Value, hidSourceTableName.Value); if (result.Equals("Successful")) { oGvDetails.Enabled = false; //lblMessage.Text = "Cancelled Successfully."; //lblMessage.CssClass = "saveNote"; //btnConfirm.Enabled = false; //// btnGetDetails.Enabled = false; //btnCancel.Enabled = false; } else { //lblFileError.Text = result; //lblFileError.CssClass = "saveNote"; } } catch (Exception ex2) { lblMessage.Text = ex2.Message; lblMessage.CssClass = "errorNote"; } } } btnCancel.Enabled = true; oImportFromExcel = null; }