public static bool Update(Admin admin) { const string insert = "update [tbAdmin] set Fname=@Fname, Mname=@Mname, Lname=@Lname,Birthdate=@Bdate,Position=@Position,EmailAddress=@Email,Gender=@Gender,ContactNo=@ContactNo,EmergencyNo=@EmergencyNo,MaritalStatus=@MaritalStatus,ResidentialAddress=@ResidentialAddress where Id=@id "; SqlCommand ret = new SqlCommand(insert); ret.Parameters.Add(new SqlParameter("Fname", admin.Fname)); ret.Parameters.Add(new SqlParameter("Mname", admin.Mname)); ret.Parameters.Add(new SqlParameter("Lname", admin.Lname)); ret.Parameters.Add(new SqlParameter("Bdate", admin.Bdate)); ret.Parameters.Add(new SqlParameter("Position", admin.Position)); ret.Parameters.Add(new SqlParameter("Email", admin.EmailAddress)); ret.Parameters.Add(new SqlParameter("id", admin.Id)); ret.Parameters.Add(new SqlParameter("ResidentialAddress", admin.ResidentialAddress)); ret.Parameters.Add(new SqlParameter("Gender", admin.Gender)); ret.Parameters.Add(new SqlParameter("ContactNo", admin.ContactNo)); ret.Parameters.Add(new SqlParameter("EmergencyNo", admin.EmergencyNo)); ret.Parameters.Add(new SqlParameter("MaritalStatus", admin.MaritalStatus)); return(SqlManager.ExecuteNonQuery(ret)); }
public static Login Get(string uid, string uhash) { Login ret = default(Login); try { const string GET_RECORD = @"SELECT Id,Username,Hash,CreatedBy,ModifiedBy,CreatedDate,ModifiedDate,Level,Lockout,LastLogin FROM [tbLogin] WHERE Username = @Username and Hash=@Hash and Lockout=0"; SqlCommand com = new SqlCommand(GET_RECORD); com.Parameters.Add(new SqlParameter("@Username", uid)); com.Parameters.Add(new SqlParameter("@Hash", uhash)); ret = SqlManager.Select <Login>(com).First(); return(ret); } catch (InvalidOperationException) { return(ret); } }
public static bool Insert(Admin admin) { const string insert = "insert [tbAdmin] (AdminId,Fname,Mname,Lname,Position,ResidentialAddress,Gender,Birthdate,MaritalStatus,EmailAddress,ContactNo,EmergencyNo,Deleted,Url,LoginId) values (@AdminId,@Fname,@Mname,@Lname,@Position,@ResidentialAddress,@Gender,@Bdate,@MaritalStatus,@Email,@ContactNo,@EmergencyNo,@Deleted,@Url,@LoginId) "; SqlCommand ret = new SqlCommand(insert); ret.Parameters.Add(new SqlParameter("Fname", admin.Fname)); ret.Parameters.Add(new SqlParameter("Mname", admin.Mname)); ret.Parameters.Add(new SqlParameter("Lname", admin.Lname)); ret.Parameters.Add(new SqlParameter("Bdate", admin.Bdate)); ret.Parameters.Add(new SqlParameter("Position", admin.Position)); ret.Parameters.Add(new SqlParameter("Email", admin.EmailAddress)); ret.Parameters.Add(new SqlParameter("Deleted", admin.Deleted)); ret.Parameters.Add(new SqlParameter("Url", admin.Url)); ret.Parameters.Add(new SqlParameter("LoginId", admin.LoginId)); ret.Parameters.Add(new SqlParameter("ResidentialAddress", admin.ResidentialAddress)); ret.Parameters.Add(new SqlParameter("Gender", admin.Gender)); ret.Parameters.Add(new SqlParameter("ContactNo", admin.ContactNo)); ret.Parameters.Add(new SqlParameter("MaritalStatus", admin.MaritalStatus)); ret.Parameters.Add(new SqlParameter("AdminId", admin.AdminId)); ret.Parameters.Add(new SqlParameter("EmergencyNo", admin.EmergencyNo)); return(SqlManager.ExecuteNonQuery(ret)); }
public static bool Update(Member member) { const string insert = "update [tbMember] set Fname=@Fname, Mname=@Mname, Lname=@Lname,Birthdate=@Bdate,Position=@Position,EmailAddress=@Email,Gender=@Gender,ContactNo=@ContactNo,EmergencyContactNo=@EmergencyNo,MaritalStatus=@MaritalStatus,ResidentialAddress=@ResidentialAddress, SalaryAmt=@SalaryAmt where Id=@id "; SqlCommand ret = new SqlCommand(insert); ret.Parameters.Add(new SqlParameter("Fname", member.Fname)); ret.Parameters.Add(new SqlParameter("Mname", member.Mname)); ret.Parameters.Add(new SqlParameter("Lname", member.Lname)); ret.Parameters.Add(new SqlParameter("Bdate", member.Birthdate)); ret.Parameters.Add(new SqlParameter("Position", member.Position)); ret.Parameters.Add(new SqlParameter("Email", member.EmailAddress)); //ret.Parameters.Add(new SqlParameter("Deleted", member.Deleted)); //ret.Parameters.Add(new SqlParameter("Url", member.Url)); //ret.Parameters.Add(new SqlParameter("LoginId", member.LoginId)); ret.Parameters.Add(new SqlParameter("ResidentialAddress", member.ResidentialAddress)); ret.Parameters.Add(new SqlParameter("Gender", member.Gender)); ret.Parameters.Add(new SqlParameter("ContactNo", member.ContactNo)); ret.Parameters.Add(new SqlParameter("MaritalStatus", member.MaritalStatus)); // ret.Parameters.Add(new SqlParameter("EmployeeId", member.EmployeeId)); ret.Parameters.Add(new SqlParameter("EmergencyNo", member.EmergencyContactNo)); ret.Parameters.Add(new SqlParameter("SalaryAmt", member.SalaryAmt)); ret.Parameters.Add(new SqlParameter("id", member.Id)); return(SqlManager.ExecuteNonQuery(ret)); }
public static bool Insert(Member member) { const string insert = "insert [tbMember] (EmployeeId,Salutation,SalaryAmt,Fname,Mname,Lname,Position,ResidentialAddress,Gender,Birthdate,MaritalStatus,EmailAddress,ContactNo,EmergencyContactNo,Deleted,Url,LoginId) values (@EmployeeId,@Salutation,@SalaryAmt,@Fname,@Mname,@Lname,@Position,@ResidentialAddress,@Gender,@Bdate,@MaritalStatus,@Email,@ContactNo,@EmergencyContactNo,@Deleted,@Url,@LoginId) "; SqlCommand ret = new SqlCommand(insert); ret.Parameters.Add(new SqlParameter("Fname", member.Fname)); ret.Parameters.Add(new SqlParameter("Mname", member.Mname)); ret.Parameters.Add(new SqlParameter("Lname", member.Lname)); ret.Parameters.Add(new SqlParameter("Bdate", member.Birthdate)); ret.Parameters.Add(new SqlParameter("Position", member.Position)); ret.Parameters.Add(new SqlParameter("Email", member.EmailAddress)); ret.Parameters.Add(new SqlParameter("Deleted", member.Deleted)); ret.Parameters.Add(new SqlParameter("Url", member.Url)); ret.Parameters.Add(new SqlParameter("LoginId", member.LoginId)); ret.Parameters.Add(new SqlParameter("ResidentialAddress", member.ResidentialAddress)); ret.Parameters.Add(new SqlParameter("Gender", member.Gender)); ret.Parameters.Add(new SqlParameter("ContactNo", member.ContactNo)); ret.Parameters.Add(new SqlParameter("MaritalStatus", member.MaritalStatus)); ret.Parameters.Add(new SqlParameter("EmployeeId", member.EmployeeId)); ret.Parameters.Add(new SqlParameter("EmergencyContactNo", member.EmergencyContactNo)); ret.Parameters.Add(new SqlParameter("SalaryAmt", member.SalaryAmt)); ret.Parameters.Add(new SqlParameter("Salutation", member.Salutation)); return(SqlManager.ExecuteNonQuery(ret)); }