public static BasicEntity MenuGet(Model.User data, Output.Menu obj) { var retVal = new BasicEntity(); retVal.AddParameter("@user_id", data.UserID); data.SqlDetail = retVal.SQLCommandBuilder("spDashboardMenuGet"); using (SqlDataReader reader = retVal.ExecReader()) { while (reader.Read()) { obj.ResultCode = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); obj.ErrorMessage = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); retVal.ResultCode = obj.ResultCode; } if (retVal.ResultCode == 1) { reader.NextResult(); while (reader.Read()) { var itemSection = new Output.SectionData(); var itemMenu = new Output.MenuData(); itemMenu.MenuID = (reader.IsDBNull(0)) ? string.Empty : reader.GetString(0); itemMenu.MenuName = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); itemMenu.MenuOrder = (reader.IsDBNull(2)) ? 0 : reader.GetInt32(2); itemMenu.WebName = (reader.IsDBNull(3)) ? string.Empty : reader.GetString(3); itemMenu.WebURL = (reader.IsDBNull(4)) ? string.Empty : reader.GetString(4); itemSection.SectionID = (reader.IsDBNull(5)) ? string.Empty : reader.GetString(5); itemSection.SectionName = (reader.IsDBNull(6)) ? string.Empty : reader.GetString(6); itemSection.SectionIcon = (reader.IsDBNull(7)) ? string.Empty : reader.GetString(7); var objFind = obj.Content.Data.Find(d => d.SectionID == itemSection.SectionID); if (objFind is null) { itemSection.Data.Add(itemMenu); obj.Content.Data.Add(itemSection); } else { objFind.Data.Add(itemMenu); } } } reader.Close(); } retVal.Close(); return(retVal); }
public static BasicEntity ReportLoanBookList(Model.ReportLoanBookList data, Output.ReportLoanBookList obj) { var retVal = new BasicEntity(); retVal.AddParameter("@level", data.Level); retVal.AddParameter("@userlogin", data.UserLogin); retVal.AddParameter("@page", data.Page); retVal.AddParameter("@page_size", data.PageSize); data.SqlDetail = retVal.SQLCommandBuilder("spReportLoanBookList"); using (SqlDataReader reader = retVal.ExecReader()) { while (reader.Read()) { obj.ResultCode = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); obj.ErrorMessage = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); retVal.ResultCode = obj.ResultCode; } if (retVal.ResultCode == 1) { reader.NextResult(); while (reader.Read()) { obj.Content.TotalRows = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); } reader.NextResult(); while (reader.Read()) { var item = new Output.ReportLoanBookListData(); item.UserName = (reader.IsDBNull(0)) ? string.Empty : reader.GetString(0); item.Title = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); item.Price = (reader.IsDBNull(2)) ? string.Empty : reader.GetString(2); item.LoanDay = (reader.IsDBNull(3)) ? DateTime.MinValue : reader.GetDateTime(3); item.ReturnDay = (reader.IsDBNull(4)) ? DateTime.MinValue : reader.GetDateTime(4); obj.Content.Data.Add(item); } } reader.Close(); } retVal.Close(); return(retVal); }
public static BasicEntity UserList(Model.UserList data, Output.User obj) { var retVal = new BasicEntity(); retVal.AddParameter("@user_login", data.Username); retVal.AddParameter("@user_group_name", data.UserGroupName); retVal.AddParameter("@user_id", data.UserID); retVal.AddParameter("@page", data.Page); retVal.AddParameter("@page_size", data.PageSize); data.SqlDetail = retVal.SQLCommandBuilder("spUserList"); using (SqlDataReader reader = retVal.ExecReader()) { while (reader.Read()) { obj.ResultCode = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); obj.ErrorMessage = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); retVal.ResultCode = obj.ResultCode; } if (retVal.ResultCode == 1) { reader.NextResult(); while (reader.Read()) { obj.Content.TotalRows = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); } reader.NextResult(); while (reader.Read()) { var item = new Output.UserData(); item.UserID = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); item.UserGroupName = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); item.UserLogin = (reader.IsDBNull(2)) ? string.Empty : reader.GetString(2); item.UserActive = (reader.IsDBNull(3)) ? string.Empty : reader.GetString(3); item.UserSuspend = (reader.IsDBNull(4)) ? string.Empty : reader.GetString(4); obj.Content.Data.Add(item); } } reader.Close(); } retVal.Close(); return(retVal); }
public static BasicEntity GetEmployeesList(Model.GetEmployeesList data, Output.GetEmployeesList obj) { var retVal = new BasicEntity(); retVal.AddParameter("@id", data.ID); retVal.AddParameter("@NIK", data.NIK); data.SqlDetail = retVal.SQLCommandBuilder("spEmployeeList"); using (SqlDataReader reader = retVal.ExecReader()) { while (reader.Read()) { obj.ResultCode = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); obj.ErrorMessage = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); retVal.ResultCode = obj.ResultCode; } if (retVal.ResultCode == 1) { reader.NextResult(); while (reader.Read()) { var item = new Output.GetEmployeesListData(); item.NIK = (reader.IsDBNull(0)) ? string.Empty : reader.GetString(0); item.FirstName = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); item.LastName = (reader.IsDBNull(2)) ? string.Empty : reader.GetString(2); item.Gender = (reader.IsDBNull(3)) ? string.Empty : reader.GetString(3); item.Address = (reader.IsDBNull(4)) ? string.Empty : reader.GetString(4); item.PlaceOfBirth = (reader.IsDBNull(5)) ? string.Empty : reader.GetString(5); item.DateOfBirth = (reader.IsDBNull(6)) ? DateTime.MinValue : reader.GetDateTime(6); item.Email = (reader.IsDBNull(7)) ? string.Empty : reader.GetString(7); item.Phone = (reader.IsDBNull(8)) ? string.Empty : reader.GetString(8); item.JobTitleID = (reader.IsDBNull(9)) ? 0 : reader.GetInt32(9); item.HireDate = (reader.IsDBNull(10)) ? DateTime.MinValue : reader.GetDateTime(10); obj.Content.Data.Add(item); } } reader.Close(); } retVal.Close(); return(retVal); }
public static BasicEntity MasterLoanBookList(Model.TransactionsLoanBookList data, Output.MasterLoanBookList obj) { var retVal = new BasicEntity(); retVal.AddParameter("@page", data.Page); retVal.AddParameter("@page_size", data.PageSize); retVal.AddParameter("@level", data.Level); data.SqlDetail = retVal.SQLCommandBuilder("spMasterDataBookList"); using (SqlDataReader reader = retVal.ExecReader()) { while (reader.Read()) { obj.ResultCode = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); obj.ErrorMessage = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); retVal.ResultCode = obj.ResultCode; } if (retVal.ResultCode == 1) { reader.NextResult(); while (reader.Read()) { obj.Content.TotalRows = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); } reader.NextResult(); while (reader.Read()) { var item = new Output.MasterLoanBookListData(); item.Title = (reader.IsDBNull(0)) ? string.Empty : reader.GetString(0); item.Price = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); item.Borrowed = (reader.IsDBNull(2)) ? string.Empty : reader.GetString(2); obj.Content.Data.Add(item); } } reader.Close(); } retVal.Close(); return(retVal); }
public static BasicEntity ValidateSession(Model.Session data, Output.Session obj) { var retVal = new BasicEntity(); retVal.AddParameter("@user_login", data.UserLogin); retVal.AddParameter("@session_token", data.SessionToken); retVal.AddParameter("@origin", "W"); data.SqlDetail = retVal.SQLCommandBuilder("spUserValidateSession"); using (SqlDataReader reader = retVal.ExecReader()) { while (reader.Read()) { obj.ResultCode = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); obj.ErrorMessage = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); retVal.ResultCode = obj.ResultCode; } if (retVal.ResultCode == 1) { reader.NextResult(); while (reader.Read()) { var item = new Output.SessionData(); item.UserID = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); item.SessionToken = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); item.UserGroup = (reader.IsDBNull(2)) ? string.Empty : reader.GetString(2); item.isFirstLogin = (reader.IsDBNull(3)) ? string.Empty : reader.GetString(3); item.CompanyID = (reader.IsDBNull(4)) ? string.Empty : reader.GetString(4); item.OperatorID = (reader.IsDBNull(5)) ? string.Empty : reader.GetString(5); item.UserGuid = (reader.IsDBNull(6)) ? string.Empty : reader.GetString(6); item.AuthKey = (reader.IsDBNull(8)) ? string.Empty : reader.GetString(8); item.UserLogin = (reader.IsDBNull(9)) ? string.Empty : reader.GetString(9); obj.Content.Data.Add(item); } } reader.Close(); } retVal.Close(); return(retVal); }
public static BasicEntity GetUserList(Model.GetUserList data, Output.GetUserList obj) { var retVal = new BasicEntity(); retVal.AddParameter("@page", data.Page); retVal.AddParameter("@page_size", data.PageSize); data.SqlDetail = retVal.SQLCommandBuilder("spGetUserList"); using (SqlDataReader reader = retVal.ExecReader()) { while (reader.Read()) { obj.ResultCode = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); obj.ErrorMessage = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); retVal.ResultCode = obj.ResultCode; } if (retVal.ResultCode == 1) { reader.NextResult(); while (reader.Read()) { obj.Content.TotalRows = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); } reader.NextResult(); while (reader.Read()) { var item = new Output.GetUserListData(); item.Name = (reader.IsDBNull(0)) ? string.Empty : reader.GetString(0); item.Age = (reader.IsDBNull(1)) ? 0 : reader.GetInt32(1); item.City = (reader.IsDBNull(2)) ? string.Empty : reader.GetString(2); obj.Content.Data.Add(item); } } reader.Close(); } retVal.Close(); return(retVal); }
public static BasicEntity Login(Model.Login data, Output.Login obj) { var retVal = new BasicEntity(); retVal.AddParameter("@Password", data.Password); retVal.AddParameter("@UserLogin", data.UserLogin); data.SqlDetail = retVal.SQLCommandBuilder("spUserLogin"); using (SqlDataReader reader = retVal.ExecReader()) { while (reader.Read()) { obj.ResultCode = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); obj.ErrorMessage = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); retVal.ResultCode = obj.ResultCode; } if (retVal.ResultCode == 1) { reader.NextResult(); while (reader.Read()) { var item = new Output.LoginData(); item.UserID = (reader.IsDBNull(0)) ? string.Empty : reader.GetString(0); item.SessionToken = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); item.Level = (reader.IsDBNull(2)) ? string.Empty : reader.GetString(2); obj.Content.Data.Add(item); } } reader.Close(); } retVal.Close(); return(retVal); }
public static BasicEntity Logout(Model.Session data, Output.OutputBase obj) { var retVal = new BasicEntity(); retVal.AddParameter("@session_token", data.SessionToken); data.SqlDetail = retVal.SQLCommandBuilder("spUserLogout"); using (SqlDataReader reader = retVal.ExecReader()) { while (reader.Read()) { obj.ResultCode = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); obj.ErrorMessage = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); retVal.ResultCode = obj.ResultCode; } reader.Close(); } retVal.Close(); return(retVal); }
public static BasicEntity ComboDataBook(Model.List data, Output.ComboDataBook obj) { var retVal = new BasicEntity(); data.SqlDetail = retVal.SQLCommandBuilder("spComboDataBook"); using (SqlDataReader reader = retVal.ExecReader()) { while (reader.Read()) { obj.ResultCode = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); obj.ErrorMessage = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); retVal.ResultCode = obj.ResultCode; } if (retVal.ResultCode == 1) { reader.NextResult(); while (reader.Read()) { var item = new Output.ComboDataBookData(); item.ID = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); item.Title = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); item.Price = (reader.IsDBNull(2)) ? string.Empty : reader.GetString(2); item.Borrowed = (reader.IsDBNull(3)) ? string.Empty : reader.GetString(3); obj.Content.Data.Add(item); } } reader.Close(); } retVal.Close(); return(retVal); }
public static BasicEntity ComboJobTitle(Model.ComboJobTitle data, Output.Combo obj) { var retVal = new BasicEntity(); retVal.AddParameter("@id", data.ID); data.SqlDetail = retVal.SQLCommandBuilder("spComboJobTitle"); using (SqlDataReader reader = retVal.ExecReader()) { while (reader.Read()) { obj.ResultCode = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); obj.ErrorMessage = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); retVal.ResultCode = obj.ResultCode; } if (retVal.ResultCode == 1) { reader.NextResult(); while (reader.Read()) { var item = new Output.ComboData(); item.ID = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); item.Name = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); obj.Content.Data.Add(item); } } reader.Close(); } retVal.Close(); return(retVal); }
public static BasicEntity UpdateChangePassword(Model.Password data, Output.OutputBase obj) { var retVal = new BasicEntity(); retVal.AddParameter("@UserID", data.UserID); retVal.AddParameter("@OldPassword", data.OldPassword); retVal.AddParameter("@NewPassword", data.NewPassword); data.SqlDetail = retVal.SQLCommandBuilder("spUserChangePassword"); using (SqlDataReader reader = retVal.ExecReader()) { while (reader.Read()) { obj.ResultCode = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); obj.ErrorMessage = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); retVal.ResultCode = obj.ResultCode; } reader.Close(); } retVal.Close(); return(retVal); }
public static BasicEntity MenuList(Model.MenuList data, Output.MenuList obj) { var retVal = new BasicEntity(); retVal.AddParameter("@page", data.Page); retVal.AddParameter("@page_size", data.PageSize); retVal.AddParameter("@first_name", data.FirstName); retVal.AddParameter("@last_name", data.LastName); retVal.AddParameter("@email", data.Email); retVal.AddParameter("@department_id", data.DepartmentID); retVal.AddParameter("@jobtitle_id", data.JobTitleID); data.SqlDetail = retVal.SQLCommandBuilder("spMenuList"); using (SqlDataReader reader = retVal.ExecReader()) { while (reader.Read()) { obj.ResultCode = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); obj.ErrorMessage = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); retVal.ResultCode = obj.ResultCode; } if (retVal.ResultCode == 1) { reader.NextResult(); while (reader.Read()) { obj.Content.TotalRows = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0); } reader.NextResult(); while (reader.Read()) { var item = new Output.MenuListData(); item.ID = (reader.IsDBNull(0)) ? 0 : reader.GetInt64(0); item.FirstName = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1); item.LastName = (reader.IsDBNull(2)) ? string.Empty : reader.GetString(2); item.Email = (reader.IsDBNull(3)) ? string.Empty : reader.GetString(3); item.DepartmentName = (reader.IsDBNull(4)) ? string.Empty : reader.GetString(4); item.JobTitleName = (reader.IsDBNull(5)) ? string.Empty : reader.GetString(5); item.HireDate = (reader.IsDBNull(6)) ? DateTime.MinValue : reader.GetDateTime(6); item.Gender = (reader.IsDBNull(7)) ? string.Empty : reader.GetString(7); item.PlaceOfBirth = (reader.IsDBNull(8)) ? string.Empty : reader.GetString(8); item.DateOfBirth = (reader.IsDBNull(9)) ? DateTime.MinValue : reader.GetDateTime(9); item.Address = (reader.IsDBNull(10)) ? string.Empty : reader.GetString(10); item.Phone = (reader.IsDBNull(11)) ? string.Empty : reader.GetString(11); item.NIK = (reader.IsDBNull(12)) ? string.Empty : reader.GetString(12); item.DepartmentID = (reader.IsDBNull(13)) ? 0 : reader.GetInt32(13); item.JobTitleID = (reader.IsDBNull(14)) ? 0 : reader.GetInt32(14); obj.Content.Data.Add(item); } } reader.Close(); } retVal.Close(); return(retVal); }