public string InsertUserDetails(EntLogin objentlogin) { string strMessage = "Data Saved"; DlLogin objdllogin = new DlLogin(); try { return objdllogin.InsertUserInformation(objentlogin);//pass entity object } catch (Exception ex) { // MessageBox.Show(ex.Message.ToString()); } finally { objdllogin = null; } return strMessage; }
public string InsertUserInformation(EntLogin objentlogin) { string msg = "Saved"; SqlConnection con = new SqlConnection(ConnectionString); con.Open(); SqlCommand cmd = new SqlCommand("GetLoginDetails", con); cmd.CommandType = CommandType.StoredProcedure; try { cmd.Parameters.AddWithValue("@LoginuserId",objentlogin.LoginuserId); cmd.Parameters.AddWithValue("@LoginTypeId",objentlogin.LoginTypeId); cmd.Parameters.AddWithValue("@LoginUserName", objentlogin.LoginUserName); cmd.Parameters.AddWithValue("@Password", objentlogin.Password); cmd.ExecuteNonQuery(); string strMessage = "User registred"; con.Close(); return strMessage; } catch (Exception ex) { // MessageBox.Show(ex.Message.ToString()); } finally { cmd.Dispose(); con.Close(); con.Dispose(); } return msg; }