public static TMSPrivacySettings Get(System.Int64 psPrivacyId) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; TMSPrivacySettings instance; instance = new TMSPrivacySettings(); db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSPrivacySettings_SELECT"; dbCommand = db.GetStoredProcCommand(sqlCommand, psPrivacyId); // Get results. ds = db.ExecuteDataSet(dbCommand); // Verification. if (ds == null || ds.Tables[0].Rows.Count == 0) //throw new ApplicationException("Could not get TMSPrivacySettings ID:" + psPrivacyId.ToString()+ " from Database."); // Return results. { return(null); } ds.Tables[0].TableName = TABLE_NAME; instance.MapFrom(ds.Tables[0].Rows[0]); return(instance); }
protected void BindPrivacyDetails() { try { DataTable dtPrivacy = TMSPrivacySettings.GetSearch(null, Convert.ToInt64(Session["UserId"]), null, null, null, null, null, null, null, null, null, null, null, 1).Tables[0]; if (dtPrivacy.Rows.Count > 0) { if (dtPrivacy.Rows[0]["PS_DisplayPhoto"].ToString() == "Yes") { rdbPhotoOne.Checked = true; rdbPhotoTwo.Checked = false; } else { rdbPhotoOne.Checked = false; rdbPhotoTwo.Checked = true; } if (dtPrivacy.Rows[0]["PS_DisplayEducation"].ToString() == "Yes") { rdbEducatioOne.Checked = true; rdbEducatioTwo.Checked = false; } else { rdbEducatioOne.Checked = false; rdbEducatioTwo.Checked = true; } if (dtPrivacy.Rows[0]["PS_DisplayConatctDetails"].ToString() == "Yes") { rdbContactOne.Checked = true; rdbContactTwo.Checked = false; } else { rdbContactOne.Checked = false; rdbContactTwo.Checked = true; } if (dtPrivacy.Rows[0]["PS_DisplayLocation"].ToString() == "Yes") { rdbLocationOne.Checked = true; rdbLocationTwo.Checked = false; } else { rdbLocationOne.Checked = false; rdbLocationTwo.Checked = true; } ViewState["PrivacySettingsId"] = Convert.ToInt64(dtPrivacy.Rows[0]["PS_PrivacyId"]); } else { ViewState["PrivacySettingsId"] = null; } } catch (Exception ex) { } }
public static TMSPrivacySettings[] Search(System.Int64?psPrivacyId, System.Int64?psFacultyLoginId, System.Int64?psFacultyTypeId, System.String psFacultyType, System.String psDisplayPhoto, System.String psDisplayEducation, System.String psDisplayConatctDetails, System.String psDisplayLocation, System.String psExtraOne, System.String psExtraTwo, System.String psExtraThree, System.String psExtraFour, System.DateTime?psDate, System.Int32?psStatus) { DataSet ds; Database db; string sqlCommand; DbCommand dbCommand; db = DatabaseFactory.CreateDatabase(); sqlCommand = "[dbo].gspTMSPrivacySettings_SEARCH"; dbCommand = db.GetStoredProcCommand(sqlCommand, psPrivacyId, psFacultyLoginId, psFacultyTypeId, psFacultyType, psDisplayPhoto, psDisplayEducation, psDisplayConatctDetails, psDisplayLocation, psExtraOne, psExtraTwo, psExtraThree, psExtraFour, psDate, psStatus); ds = db.ExecuteDataSet(dbCommand); ds.Tables[0].TableName = TABLE_NAME; return(TMSPrivacySettings.MapFrom(ds)); }
public static TMSPrivacySettings[] MapFrom(DataSet ds) { List <TMSPrivacySettings> objects; // Initialise Collection. objects = new List <TMSPrivacySettings>(); // Validation. if (ds == null) { throw new ApplicationException("Cannot map to dataset null."); } else if (ds.Tables[TABLE_NAME].Rows.Count == 0) { return(objects.ToArray()); } if (ds.Tables[TABLE_NAME] == null) { throw new ApplicationException("Cannot find table [dbo].[TMS_PrivacySettings] in DataSet."); } if (ds.Tables[TABLE_NAME].Rows.Count < 1) { throw new ApplicationException("Table [dbo].[TMS_PrivacySettings] is empty."); } // Map DataSet to Instance. foreach (DataRow dr in ds.Tables[TABLE_NAME].Rows) { TMSPrivacySettings instance = new TMSPrivacySettings(); instance.MapFrom(dr); objects.Add(instance); } // Return collection. return(objects.ToArray()); }
public static DataSet GetSearch(TMSPrivacySettings searchObject) { return(GetSearch(searchObject.PSPrivacyId, searchObject.PSFacultyLoginId, searchObject.PSFacultyTypeId, searchObject.PSFacultyType, searchObject.PSDisplayPhoto, searchObject.PSDisplayEducation, searchObject.PSDisplayConatctDetails, searchObject.PSDisplayLocation, searchObject.PSExtraOne, searchObject.PSExtraTwo, searchObject.PSExtraThree, searchObject.PSExtraFour, searchObject.PSDate, searchObject.PSStatus)); }
public static void Update(TMSPrivacySettings tMSPrivacySettings, DbTransaction transaction) { tMSPrivacySettings.Update(transaction); }
public static void Update(TMSPrivacySettings tMSPrivacySettings) { tMSPrivacySettings.Update(); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { string Image = null; string Contact = null; string Education = null; string Location = null; if (rdbLocationOne.Checked == true) { Location = "Yes"; } if (rdbLocationTwo.Checked == true) { Location = "No"; } if (rdbPhotoOne.Checked == true) { Image = "Yes"; } if (rdbPhotoTwo.Checked == true) { Image = "No"; } if (rdbEducatioOne.Checked == true) { Education = "Yes"; } if (rdbEducatioTwo.Checked == true) { Education = "No"; } if (rdbContactOne.Checked == true) { Contact = "Yes"; } if (rdbContactTwo.Checked == true) { Contact = "No"; } if (ViewState["PrivacySettingsId"] != null) { TMSPrivacySettings objPrivacy = TMSPrivacySettings.Get(Convert.ToInt64(ViewState["PrivacySettingsId"])); if (objPrivacy != null) { objPrivacy.PSDisplayLocation = Location; objPrivacy.PSDisplayPhoto = Image; objPrivacy.PSDisplayEducation = Education; objPrivacy.PSDisplayConatctDetails = Contact; objPrivacy.PSDate = DateTime.Now; objPrivacy.Update(); Response.Redirect("PrivacySettings.aspx?msg=Privacy Settings Updated Successfully...!!"); } } else { TMSPrivacySettings objPrivacy = new TMSPrivacySettings(); objPrivacy.PSFacultyLoginId = Convert.ToInt64(Session["UserId"]); objPrivacy.PSFacultyType = "Principal"; objPrivacy.PSFacultyTypeId = 1; objPrivacy.PSDisplayLocation = Location; objPrivacy.PSDisplayPhoto = Image; objPrivacy.PSDisplayEducation = Education; objPrivacy.PSDisplayConatctDetails = Contact; objPrivacy.PSDate = DateTime.Now; objPrivacy.PSStatus = 1; objPrivacy.Insert(); Response.Redirect("PrivacySettings.aspx?msg=Privacy Settings Added Successfully...!!"); } } catch (Exception ex) { } }
public static DataSet GetSearch(TMSPrivacySettings searchObject) { return GetSearch(searchObject.PSPrivacyId, searchObject.PSFacultyLoginId, searchObject.PSFacultyTypeId, searchObject.PSFacultyType, searchObject.PSDisplayPhoto, searchObject.PSDisplayEducation, searchObject.PSDisplayConatctDetails, searchObject.PSDisplayLocation, searchObject.PSExtraOne, searchObject.PSExtraTwo, searchObject.PSExtraThree, searchObject.PSExtraFour, searchObject.PSDate, searchObject.PSStatus); }