public List <System.Web.Mvc.SelectListItem> GetProjectName() { try { obj_con.clearParameter(); DataTable dt = ConvertDatareadertoDataTable(obj_con.ExecuteReader("Sp_mstProject_GetProjectName", CommandType.StoredProcedure)); obj_con.CommitTransaction(); obj_con.closeConnection(); List <System.Web.Mvc.SelectListItem> lst = new List <System.Web.Mvc.SelectListItem>(); System.Web.Mvc.SelectListItem sli1 = new System.Web.Mvc.SelectListItem(); sli1.Text = "Select All"; sli1.Value = "-1"; lst.Add(sli1); for (int i = 0; i < dt.Rows.Count; i++) { System.Web.Mvc.SelectListItem sli = new System.Web.Mvc.SelectListItem(); sli.Text = Convert.ToString(dt.Rows[i][1]); sli.Value = Convert.ToString(dt.Rows[i][0]); lst.Add(sli); } return(lst); } catch (Exception ex) { throw new Exception("Sp_mstProject_GetProjectName"); } finally { obj_con.closeConnection(); } }
//insert data into database public Int32 insert(usersClass obj) { try { obj_con.clearParameter(); createParameter(obj, DBTrans.Insert); obj_con.BeginTransaction(); obj_con.ExecuteNoneQuery("sp_users_insert", CommandType.StoredProcedure); obj_con.CommitTransaction(); return(obj.Userid = Convert.ToInt32(obj_con.getValue("@Userid"))); } catch (Exception ex) { obj_con.RollbackTransaction(); throw new Exception("sp_users_insert"); } }
//insert data into database public Int32?insert(ContactUsDataClass obj) { try { obj_con.clearParameter(); createParameter(obj, DBTrans.Insert); obj_con.BeginTransaction(); obj_con.ExecuteNoneQuery("sp_ContactUsData_insert", CommandType.StoredProcedure); obj_con.CommitTransaction(); return(obj.Contactusdataid = Convert.ToInt32(obj_con.getValue("@Contactusdataid"))); } catch (Exception ex) { obj_con.RollbackTransaction(); throw new Exception("sp_ContactUsData_insert:" + ex.Message); } }
//insert data into database public Int32?insert(GeneralSettingsClass obj) { try { obj_con.clearParameter(); createParameter(obj, DBTrans.Insert); obj_con.BeginTransaction(); obj_con.ExecuteNoneQuery("sp_GeneralSettings_insert", CommandType.StoredProcedure); obj_con.CommitTransaction(); return(obj.Generalsettings = Convert.ToInt32(obj_con.getValue("@Generalsettings"))); } catch (Exception ex) { obj_con.RollbackTransaction(); throw new Exception("sp_GeneralSettings_insert:" + ex.Message); } }