예제 #1
0
        public static BasicEntity UserAdd(Model.User data, Output.OutputBase obj)
        {
            var retVal = new BasicEntity();

            retVal.AddParameter("@level_id", data.LevelAdd);
            retVal.AddParameter("@CompanyID", data.CompanyAdd);
            retVal.AddParameter("@OperatorID", data.OperatorAdd);
            retVal.AddParameter("@UserLogin", data.UserLoginAdd);
            retVal.AddParameter("@Password", data.PasswordAdd);
            retVal.AddParameter("@UserName", data.UserNameAdd);
            retVal.AddParameter("@Email", data.EmailAdd);
            retVal.AddParameter("@authorization_id", data.AuthorizationID);
            retVal.AddParameter("@user_id", data.UserID);
            data.SqlDetail = retVal.SQLCommandBuilder("spUserAdd");

            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 TransactionLoanBookReturn(Model.TransactionsLoanBookList data, Output.OutputBase obj)
        {
            var retVal = new BasicEntity();

            retVal.AddParameter("@username", data.UserLogin);
            retVal.AddParameter("@bookID", data.BookID);

            data.SqlDetail = retVal.SQLCommandBuilder("spReturnBook");

            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);
        }
예제 #3
0
        public static BasicEntity CreateAccountLoginUser(Model.UserLoginAdd data, Output.OutputBase obj)
        {
            var retVal = new BasicEntity();

            retVal.AddParameter("@userlogin", data.UserLogin);
            retVal.AddParameter("@password", data.Password);
            retVal.AddParameter("@level", data.Level);
            retVal.AddParameter("@mobileNumber", data.MobileNumber);

            data.SqlDetail = retVal.SQLCommandBuilder("spCreateAccountLoginUser");

            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);
        }
예제 #4
0
        public static BasicEntity EmployeeDelete(Model.Employees data, Output.OutputBase obj)
        {
            var retVal = new BasicEntity();

            retVal.AddParameter("@id", data.ID);
            retVal.AddParameter("@nik", data.NIK);

            data.SqlDetail = retVal.SQLCommandBuilder("spDeleteEmployee");

            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);
        }
예제 #5
0
        public static BasicEntity Registration(Model.UserLoginAdd data, Output.OutputBase obj)
        {
            var retVal = new BasicEntity();

            retVal.AddParameter("@mobileNumber", data.MobileNumber);
            retVal.AddParameter("@firstName", data.FirstName);
            retVal.AddParameter("@lastName", data.LastName);
            retVal.AddParameter("@dateOfBirth", data.DateOfBirth);
            retVal.AddParameter("@gender", data.Gender);
            retVal.AddParameter("@email", data.Email);

            data.SqlDetail = retVal.SQLCommandBuilder("spRegistration");

            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);
        }
예제 #6
0
        public static BasicEntity EmployeeEdit(Model.Employees data, Output.OutputBase obj)
        {
            var retVal = new BasicEntity();

            retVal.AddParameter("@ID", data.ID);
            retVal.AddParameter("@NIK", data.NIK);
            retVal.AddParameter("@FirstName", data.FirstName);
            retVal.AddParameter("@LastName", data.LastName);
            retVal.AddParameter("@Address", data.Address);
            retVal.AddParameter("@Gender", data.Gender);
            retVal.AddParameter("@PlaceOfBirth", data.PlaceOfBirth);
            retVal.AddParameter("@DateOfBirth", data.DateOfBirth);
            retVal.AddParameter("@Email", data.Email);
            retVal.AddParameter("@Phone", data.Phone);
            retVal.AddParameter("@JobTitleID", data.JobTitleID);
            retVal.AddParameter("@HireDate", data.HireDate);

            data.SqlDetail = retVal.SQLCommandBuilder("spEditEmployee");

            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 MasterLoanBookAdd(Model.MasterLoanBookAdd data, Output.OutputBase obj)
        {
            var retVal = new BasicEntity();

            retVal.AddParameter("@title", data.Title);
            retVal.AddParameter("@price", data.Price);

            data.SqlDetail = retVal.SQLCommandBuilder("spMasterDataBookAdd");

            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);
        }
예제 #8
0
        public static BasicEntity UserDelete(Model.User data, Output.OutputBase obj)
        {
            var retVal = new BasicEntity();


            retVal.AddParameter("@authorization_id", data.AuthorizationID);
            retVal.AddParameter("@user_id", data.UserID);
            data.SqlDetail = retVal.SQLCommandBuilder("spUserDelete");

            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 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);
        }
예제 #11
0
        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);
        }
예제 #12
0
        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);
        }
예제 #14
0
        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);
        }
예제 #15
0
        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);
        }
예제 #16
0
        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);
        }
예제 #17
0
        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);
        }
예제 #18
0
        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);
        }
예제 #19
0
        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);
        }
예제 #20
0
        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);
        }
예제 #21
0
        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);
        }