public SecurityClass Checkuserlogin(string UserName, string Password) { try { obj_con.clearParameter(); obj_con.addParameter("@UserName", UserName); obj_con.addParameter("@Password", Password); DataTable dt = ConvertDataReaderToDataTable(obj_con.ExecuteReader("RE_Users_Login", CommandType.StoredProcedure)); return(ConvertToOjbect(dt)); } catch (Exception ex) { obj_con.RollbackTransaction(); throw new Exception("RE_Users_Login : " + ex.Message); } }
//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(LocationClass obj) { try { obj.Locationid = 0; obj_con.clearParameter(); createParameter(obj, DBTrans.Insert); obj_con.BeginTransaction(); obj_con.ExecuteNoneQuery("sp_Location_insert", CommandType.StoredProcedure); obj_con.CommitTransaction(); return(obj.Locationid = Convert.ToInt32(obj_con.getValue("@Locationid"))); } catch (Exception ex) { obj_con.RollbackTransaction(); throw new Exception("sp_Location_insert:" + ex.Message); } }
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(); } }