public JsonResult SaveUpdate(string Chapter) { dynamic clsChapter = JsonConvert.DeserializeObject(Chapter); MSSQL_DAC clsDAC = null; clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("SubjectChapterID", (clsChapter.SubjectChapterID == "" ? 0 : (int)clsChapter.SubjectChapterID)), new KeyValuePair <string, object>("SubjectID", (clsChapter.SubjectID == "" ? 0 : (int)clsChapter.SubjectID)), new KeyValuePair <string, object>("ChapterCode", Convert.ToString(clsChapter.ChapterCode)), new KeyValuePair <string, object>("ChapterName", Convert.ToString(clsChapter.ChapterName)), new KeyValuePair <string, object>("CreatedBy", (int)Session["UserID"]) }; clsDAC.Execute_Procedure("sp_SubjectsChaptersCRUD", lstData); ViewBag.Error = clsDAC.Error_Message; List <object> lstChapters = new List <object>(); lstChapters = new SubjectsController().getChaptersBySubjectsID((int)clsChapter.SubjectID); return(Json(lstChapters, JsonRequestBehavior.AllowGet)); }
// GET: Student/Delete/5 public ActionResult Delete(int id) { MSSQL_DAC clsDAC = null; clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("StudentID", id), new KeyValuePair <string, object>("CreatedBy", Session["UserID"]), new KeyValuePair <string, object>("Mode", "Delete") }; clsDAC.Execute_Procedure("sp_StudentsCRUD", lstData); ViewBag.Error = clsDAC.Error_Message; if (clsDAC.Error_Message.Trim() == "") { Response.Redirect("~/Students/List?removed=1"); } else { Response.Redirect("~/Students/List?removed=0"); } return(View()); }
public ActionResult ChapterQuetionsDelete(int CHID, int SCID) { MSSQL_DAC clsDAC = null; clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("SubjectsChaptersID", SCID), new KeyValuePair <string, object>("ContentHolder", CHID), new KeyValuePair <string, object>("CreatedBy", Session["UserID"]) }; clsDAC.Execute_Procedure("sp_DeleteSubjectQuestions", lstData); ViewBag.Error = clsDAC.Error_Message; if (clsDAC.Error_Message.Trim() == "") { Response.Redirect(string.Format("~/Chapters/ChapterContents?ID={0}", SCID)); } else { Response.Redirect(string.Format("~/Chapters/ChapterContents?ID={0}&removed=0", SCID)); } return(View()); }
public ActionResult Exercises(FormCollection frmCollection) { verifySessionforAdmin(); int SubjectsChapterID = 0; string Code = ""; string ExerciseName = ""; int ParentChapterID = 0; if (string.IsNullOrEmpty(frmCollection["SubjectsChaptersID"])) { SubjectsChapterID = 0; } else { SubjectsChapterID = Convert.ToInt32(frmCollection["SubjectsChaptersID"]); } Code = Convert.ToString(frmCollection["ExerciseCode"]); ExerciseName = Convert.ToString(frmCollection["ExerciseName"]); ParentChapterID = Convert.ToInt32(frmCollection["ParentChapterID"]); MSSQL_DAC clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("SubjectsChaptersID", SubjectsChapterID), new KeyValuePair <string, object>("ExerciseCode", Code), new KeyValuePair <string, object>("ExerciseName", ExerciseName), new KeyValuePair <string, object>("ParentChapterID", ParentChapterID), new KeyValuePair <string, object>("CreatedBy", Session["UserID"]) }; clsDAC.Execute_Procedure("sp_ExerciseCRUD", lstData); ViewBag.Error = clsDAC.Error_Message; List <object> lstRet = new List <object>(); lstRet = getExercisesByChapterID(ParentChapterID); string ChapterName = ""; string SubjectName = ""; if (lstRet.Count() > 0) { var ChapterContentBasic = lstRet.FirstOrDefault(); ChapterName = Convert.ToString(ChapterContentBasic.GetType().GetProperty("ChapterName").GetValue(ChapterContentBasic)); SubjectName = Convert.ToString(ChapterContentBasic.GetType().GetProperty("SubjectName").GetValue(ChapterContentBasic)); } ViewBag.ParentChapterID = ParentChapterID; ViewBag.ChapterName = ChapterName; ViewBag.SubjectName = SubjectName; ViewBag.ExercisesList = lstRet; return(View()); }
public int DeletePayPalInvoice(string TID) { var clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("InvoiceGUID", TID) }; return(clsDAC.Execute_Procedure("sp_DeletePayPalInvoice", lstData)); }
public int LogException(string InvoiceGUID, string ExceptionXML) { var clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("InvoiceGUID", InvoiceGUID), new KeyValuePair <string, object>("QuestionID", ExceptionXML) }; return(clsDAC.Execute_Procedure("sp_SavePayPalExecutePaymentException", lstData)); }
public int UpdatePayPalInvoice(PayPalInvoiceModel payPalInvoiceModel) { var clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("InvoiceGUID", payPalInvoiceModel.InvoiceGUID), new KeyValuePair <string, object>("State", payPalInvoiceModel.State), new KeyValuePair <string, object>("ResponseXML", payPalInvoiceModel.ResponseXML), }; return(clsDAC.Execute_Procedure("sp_UpdatePayPalInvoice", lstData)); }
public int CreatePayPalInvoice(PayPalInvoiceModel payPalInvoiceModel) { var clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("InvoiceGUID", payPalInvoiceModel.InvoiceGUID), new KeyValuePair <string, object>("QuestionID", payPalInvoiceModel.QuestionID), new KeyValuePair <string, object>("PaymentID", payPalInvoiceModel.PaymentID), new KeyValuePair <string, object>("RequestXML", payPalInvoiceModel.RequestXML), }; return(clsDAC.Execute_Procedure("sp_SavePayPalInvoice", lstData)); }
public void DeleteInvoiceFromPaymentQuestion(string TID) { MSSQL_DAC clsDAC = null; clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("TID", TID) }; clsDAC.Execute_Procedure("sp_DeletePaymentQuestionAgaintsTid", lstData); ViewBag.Error = clsDAC.Error_Message; }
public void QuestionPaymentSave(QuestionPayment questionPayment) { MSSQL_DAC clsDAC = null; clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("subjbectid", questionPayment.subjbectid), new KeyValuePair <string, object>("questionid", questionPayment.questionid), new KeyValuePair <string, object>("transactionid", questionPayment.transactionid), new KeyValuePair <string, object>("variant", questionPayment.variant) }; clsDAC.Execute_Procedure("sp_PaymentQuestionSave", lstData); ViewBag.Error = clsDAC.Error_Message; }
public ActionResult ExercisesDelete(int ID, int ParentID) { MSSQL_DAC clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("SubjectsChaptersID", ID), new KeyValuePair <string, object>("Mode", "Delete"), new KeyValuePair <string, object>("CreatedBy", Session["UserID"]) }; clsDAC.Execute_Procedure("sp_ExerciseCRUD", lstData); ViewBag.Error = clsDAC.Error_Message; Response.Redirect("~/Chapters/Exercises?ID=" + ParentID); return(View()); }
public JsonResult SaveDelete(int SubjectChapterID, int SubjectID) { //dynamic clsChapter = JsonConvert.DeserializeObject(Chapter); MSSQL_DAC clsDAC = null; clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("SubjectChapterID", SubjectChapterID), new KeyValuePair <string, object>("CreatedBy", (int)Session["UserID"]) }; clsDAC.Execute_Procedure("sp_SubjectsChaptersDelete", lstData); ViewBag.Error = clsDAC.Error_Message; List <object> lstChapters = new List <object>(); lstChapters = new SubjectsController().getChaptersBySubjectsID(SubjectID); return(Json(lstChapters, JsonRequestBehavior.AllowGet)); }
public ActionResult CRUD(FormCollection collection) { List <object> lstModels = new List <object>(); List <string> lstSelectedSubjects = new List <string>(); string vMode = collection["Mode"]; Students modelStudent = new Students() { StudentNumber = Convert.ToString(collection["StudentNumber"]), FirstName = Convert.ToString(collection["FirstName"]), MiddleInit = Convert.ToString(collection["MiddleInit"]), LastName = Convert.ToString(collection["LastName"]), DateofBirth = Convert.ToString(collection["DateofBirth"]) == "" ? DateTime.MinValue : Convert.ToDateTime(collection["DateofBirth"]), BatchCode = Convert.ToString(collection["BatchCode"]), Address1 = Convert.ToString(collection["Address1"]), Address2 = Convert.ToString(collection["Address2"]), City = Convert.ToString(collection["City"]), Zipcode = Convert.ToString(collection["Zipcode"]), StateCode = Convert.ToString(collection["StateCode"]), UserID = Convert.ToInt32(collection["UserID"]), Password = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(collection["Password"])) }; if (string.IsNullOrEmpty(collection["StudentID"])) { modelStudent.StudentID = 0; } else { modelStudent.StudentID = Convert.ToInt32(collection["StudentID"]); } if (!string.IsNullOrEmpty(collection["SelectedSubjects"])) { lstSelectedSubjects = Convert.ToString(collection["SelectedSubjects"]).Split(',').ToList(); } MSSQL_DAC clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("StudentID", modelStudent.StudentID), new KeyValuePair <string, object>("StudentNumber", modelStudent.StudentNumber), new KeyValuePair <string, object>("FirstName", modelStudent.FirstName), new KeyValuePair <string, object>("MiddleInit", modelStudent.MiddleInit), new KeyValuePair <string, object>("LastName", modelStudent.LastName), new KeyValuePair <string, object>("DateofBirth", modelStudent.DateofBirth), new KeyValuePair <string, object>("BatchCode", modelStudent.BatchCode), new KeyValuePair <string, object>("Address1", modelStudent.Address1), new KeyValuePair <string, object>("Address2", modelStudent.Address2), new KeyValuePair <string, object>("City", modelStudent.City), new KeyValuePair <string, object>("Zipcode", modelStudent.Zipcode), new KeyValuePair <string, object>("StateCode", modelStudent.StateCode), new KeyValuePair <string, object>("CreatedBy", Session["UserID"]), new KeyValuePair <string, object>("Mode", vMode), new KeyValuePair <string, object>("Password", modelStudent.Password), new KeyValuePair <string, object>("SelectedSubjects", String.Join(",", lstSelectedSubjects.ToArray())) }; clsDAC.Execute_Procedure("sp_StudentsCRUD", lstData); ViewBag.Error = clsDAC.Error_Message; if (ViewBag.Error.Trim() == "") { Response.Redirect("~/Students/List"); } modelStudent.Password = System.Text.ASCIIEncoding.ASCII.GetString(Convert.FromBase64String(modelStudent.Password)); lstModels.Add(modelStudent); List <StudentsSubjects> modelStudentsSubjects = getStudentSubjectsByID(0); lstModels.Add(modelStudentsSubjects); return(View(lstModels)); }
public ActionResult Create(FormCollection collection) { Subjects modelSubject = null; IEnumerable <SelectListItem> ddlSubjectType = null; IEnumerable <SelectListItem> ddlparentSubjects = null; MSSQL_DAC clsDAC = null; clsDAC = new MSSQL_DAC(); DataTable dt_1 = clsDAC.Read_DT_Query("SELECT ValueColumn,DisplayColumn FROM dbo.tblLookups WHERE LookupCode='SubjectType'"); if (dt_1 != null) { ddlSubjectType = dt_1.Rows.Cast <DataRow>().ToList().Select(x => new SelectListItem() { Value = Convert.ToString(x["ValueColumn"]), Text = Convert.ToString(x["DisplayColumn"]) }); } dt_1 = clsDAC.Read_DT_Query("SELECT SubjectID, SubjectName FROM dbo.tblSubjects WHERE SubjectType <> 8 AND ISNULL(IsActive,1) = 1"); if (dt_1 != null) { ddlparentSubjects = dt_1.Rows.Cast <DataRow>().ToList().Select(x => new SelectListItem() { Value = Convert.ToString(x["SubjectID"]), Text = Convert.ToString(x["SubjectName"]) }); ddlparentSubjects.ToList().Insert(0, new SelectListItem() { Value = "0", Text = "Select Subject" }); } try { modelSubject = new Subjects() { SubjectCode = collection["SubjectCode"], SubjectName = collection["SubjectName"], SubjectType = Convert.ToInt32(collection["modelSubject.SubjectType"]), SubjectYear = collection["SubjectYear"], ParentSubjectID = (string.IsNullOrEmpty(collection["modelSubject.ParentSubjectID"]) ? 0 : Convert.ToInt32(collection["modelSubject.ParentSubjectID"])) }; if (Request.Files.Count > 0) { HttpPostedFileBase postedFile = Request.Files[0]; System.IO.MemoryStream mem = new System.IO.MemoryStream(); postedFile.InputStream.CopyTo(mem); modelSubject.SubjectImage = mem.ToArray(); } clsDAC = new MSSQL_DAC(); List <KeyValuePair <string, object> > lstData = new List <KeyValuePair <string, object> >() { new KeyValuePair <string, object>("SubjectName", modelSubject.SubjectName), new KeyValuePair <string, object>("SubjectCode", modelSubject.SubjectCode), new KeyValuePair <string, object>("SubjectType", modelSubject.SubjectType), new KeyValuePair <string, object>("SubjectYear", modelSubject.SubjectYear), new KeyValuePair <string, object>("ParentSubjectID", modelSubject.ParentSubjectID), new KeyValuePair <string, object>("SubjectImage", modelSubject.SubjectImage), new KeyValuePair <string, object>("CreatedBy", Session["UserID"]) }; clsDAC.Execute_Procedure("sp_CreateSubjects", lstData); ViewBag.Error = clsDAC.Error_Message; if (clsDAC.Error_Message.Trim() == "") { Response.Redirect("~/Subjects/List"); } ViewBag.MainModel = modelSubject; ViewBag.ddSubjectTypelist = ddlSubjectType; ViewBag.ddlparentSubjectslist = ddlparentSubjects; return(View()); } catch (Exception ex) { ViewBag.Error = ex.Message; } ViewBag.MainModel = modelSubject; ViewBag.ddSubjectTypelist = ddlSubjectType; ViewBag.ddlparentSubjectslist = ddlparentSubjects; return(View()); }