protected void AddTManual_Click(object sender, EventArgs e) { Security objSecurity = new Security(); #region Address 1 string vTPID = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropTPs.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString(); string vAddress_1 = objSecurity.KillChars(txtAddress_1.Text); // string vAddress_2 = objSecurity.KillChars(txtAddress_2.Text); string vCity = objSecurity.KillChars(txtCity.Text); // string vCounty = objSecurity.KillChars(txtCounty.Text); string vState = objSecurity.KillChars(txtState.Text); string vZipCode = objSecurity.KillChars(txtZipCode.Text); #endregion #region Now saving Location clsTP_Location objTPLoc = new clsTP_Location(); objTPLoc.TPId = Convert.ToInt32(vTPID); objTPLoc.TP_Address_Line_1 = vAddress_1; //objTPLoc.TP_Address_Line_2 = vAddress_2; objTPLoc.TP_City = vCity; objTPLoc.TP_State = vState; //objTPLoc.TP_County = vCounty; objTPLoc.TP_ZipCode = vZipCode; //objTPLoc.Location_Email = ""; if (!TP_LocationDAL.InsertTP_Location(objTPLoc)) { } #endregion ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "CallNotify('Location Added successfully!', '', 'success', 'TP_AddLocations.aspx?desh=active');", true); }
public static Boolean InsertUpdateTP_Location(clsTP_Location objTP_Location) { bool isAdded = false; string SpName = "usp_InsertUpdateTP_Location"; try { using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { db.Execute(SpName, objTP_Location, commandType: CommandType.StoredProcedure); } isAdded = true; } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } return(isAdded); }
public static clsTP_Location SelectTP_LocationById(int?TPLocationId) { clsTP_Location objTP_Location = new clsTP_Location(); bool isnull = true; string SpName = "usp_SelectTP_Location"; var objPar = new DynamicParameters(); if (String.IsNullOrEmpty(TPLocationId.ToString())) { throw new ArgumentException("Function parameters cannot be blank!"); } else { try { objPar.Add("@TPLocationId", TPLocationId, dbType: DbType.Int32); using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { objTP_Location = db.Query <clsTP_Location>(SpName, objPar, commandType: CommandType.StoredProcedure).SingleOrDefault(); isnull = false; } } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } } if (isnull) { return(null); } else { return(objTP_Location); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strInstID = string.Empty; string strTPID = string.Empty; string strLocation = string.Empty; try { #region Showing all the Courses added to the list. List <clsCourseSchedule> lstCS = new List <clsCourseSchedule>(); lstCS = CourseScheduleDAL.SelectDynamicCourseSchedule("(CAST(StartDate AS Date) >= CAST('" + Convert.ToDateTime(DateTime.Now).ToShortDateString() + "' AS Date))", "TrainingCourseScheduleId"); if (lstCS != null) { if (lstCS.Count > 0) { for (int i = 0; i < lstCS.Count; i++) { clsTP_Location objLoc = new clsTP_Location(); objLoc = TP_LocationDAL.SelectTP_LocationById(lstCS[i].TPLocationId); if (objLoc != null) { strLocation = ""; } showTable(pnlVideos, GlobalMethods.ValueIsNull(lstCS[i].ClassTitle), GlobalMethods.ValueIsNull(lstCS[i].StartDate) + " - " + GlobalMethods.ValueIsNull(lstCS[i].EndDate), GlobalMethods.ValueIsNull(lstCS[i].InstructionLanguage), GlobalMethods.ValueIsNull(lstCS[i].RegistrationLimit), GlobalMethods.ValueIsNull(lstCS[i].ExpectedEnrollment), GlobalMethods.ValueIsNull(strLocation), GlobalMethods.ValueIsNull(lstCS[i].CreateDate), Convert.ToInt32(GlobalMethods.ValueIsNull(lstCS[i].TrainingCourseScheduleId))); } } } #endregion } catch (Exception) { ErrorHandler.ErrorPage(); } } }