protected void btnSave_Click(object sender, EventArgs e) { UserTypes objUserTypes = new UserTypes(); objUserTypes.UserTypeDesc = txtUserTypeDesc.Text; objUserTypes.UserTypeCode = txtUserTypeCode.Text; if (!string.IsNullOrEmpty(hfUserTypeID.Value.ToString())) { objUserTypes.UpdatedBy = UserAuthentication.GetUserId(this.Page); objUserTypes.UpdatedDate = DateTime.Now; objUserTypes.UserTypeID = Convert.ToInt32(hfUserTypeID.Value); objUserTypes.UserTypeDesc = txtUserTypeDesc.Text; objUserTypes.UserTypeCode = txtUserTypeCode.Text; UserTypeBO.UpdateUserTypes(objUserTypes); } else { objUserTypes.CreatedBy = UserAuthentication.GetUserId(this.Page); objUserTypes.CreatedDate = DateTime.Now; UserTypeBO.InsertUserTypes(objUserTypes); } txtUserTypeDesc.Text = string.Empty; txtUserTypeCode.Text = string.Empty; hfUserTypeID.Value = string.Empty; loadUserType(); }
// GET api/usertype public List<UserTypes> Get() { List<UserTypes> listUserTypes = new List<UserTypes>(); DataView dvUserType = UserTypeBO.GetAllForSync(); foreach (DataRowView drvUserType in dvUserType) { UserTypes userType = new UserTypes(); listUserTypes.Add(UserTypeBO.GetUserTypes(Convert.ToInt32(drvUserType["UserTypeID"]))); } return listUserTypes; }
// POST api/usertype public UserTypes Post(UserTypes userType) { if (userType.GUID > 0) { userType.UserTypeID = userType.GUID; int rowResult = UserTypeBO.UpdateUserTypes(userType); //Return Back to The Client return userType; } else { int rowResult = UserTypeBO.InsertUserTypes(userType); //Return Back to The Client return userType; } }
public int InsertUserTypes(UserTypes objUserTypes) { objUserTypes.UserTypeID = 1; BeginTransaction(); try { objUserTypes.UserTypeID = Insert(objUserTypes); CommitTransaction(); } catch (Exception ex) { RollBackTransaction(); objUserTypes.UserTypeID = -1; } return objUserTypes.UserTypeID; }
public int UpdateUserTypes(UserTypes objUserTypes) { int rowsaffected = -1; BeginTransaction(); try { String[] UpdateProperties = new String[] { "UserTypeDesc", "UserTypeCode", "SyncStatus","UpdatedBy", "UpdatedDate" }; rowsaffected = Update(objUserTypes, UpdateProperties); CommitTransaction(); } catch (Exception e) { RollBackTransaction(); rowsaffected = -1; } return rowsaffected; }
public static int UpdateUserTypes(UserTypes objUserTypes) { return new UserTypeDAO().UpdateUserTypes(objUserTypes); }
public static UserTypes GetUserTypes(int UserTypeID) { UserTypes objUserTypes = new UserTypes(); return (UserTypes)(new UserTypeDAO().FillDTO(objUserTypes, "UserTypeID=" + UserTypeID)); }
public static int InsertUserTypes(UserTypes objUserTypes) { return new UserTypeDAO().InsertUserTypes(objUserTypes); }