Esempio n. 1
0
File: User.cs Progetto: GSVien/Code
        public static DoResult <UserInfo> Bus_DangNhapBangEmail(string _email, string passwork)
        {
            //MaHoaMD5 mahoa = new MaHoaMD5();

            return(BUSCore.Do <UserInfo>(
                       userId: -1,
                       action: (c) =>
            {
                //lấy user có email là _email
                var userTemp = UserInfoDAO.GetUserByEmail(c.Db, _email).Result;
                if (userTemp == null)     //không ttồn tại user có email
                {
                    c.SetError("Không tìm thấy thông tin User", 1);
                    return null;
                }
                else     // có user=> kiểm tra passwork
                {
                    if (/*userTemp.Passwork != mahoa.md5(passwork)*/ 1 != 1)
                    {
                        c.SetError("Passwork nhập vào không đúng.Nhập lại", 1);
                        return null;
                    }
                    else    //kiểm tra hợp lệ
                    {
                        return userTemp;
                    }
                }
            }));
        }
Esempio n. 2
0
File: User.cs Progetto: GSVien/Code
        public static DoResult <UserInfo> Bus_DangKyUserMoi(string email, string username, string passwork, string photo, string sodienthoai)
        {
            //MaHoaMD5 mahoa = new MaHoaMD5();
            return(BUSCore.Do <UserInfo>(
                       userId: -1,
                       action: (c) =>
            {
                //get user có email xxxxx => xxxxx có ng dung chua ? loi
                var ysafas = UserInfoDAO.GetUserByEmail(c.Db, email).Result;
                if (ysafas != null)
                {
                    c.SetError("Email đã đc sử dụng", 1);
                    return null;
                }
                UserInfo data = new UserInfo();
                data.Email = email;
                data.UserName = username;
                //data.Passwork = mahoa.md5(passwork);
                data.AvatarPhoto = photo;
                data.GroupId = 1;
                data.Phone = sodienthoai;
                // Cập nhật hệ thống
                var r = UserInfoDAO.Insert(c.Db, data);

                return r.Result;
            }));
        }
Esempio n. 3
0
        public static PageResult <ProductCategoryModel> GetListProductCategory(long?actionUserId, int?pageIndex = 0, int?pageSize = 10,
                                                                               long[] id = null, string str_Value = null, int?num_Status = null)
        {
            return(BUSCore.DoPage <ProductCategoryModel>(
                       userId: actionUserId,
                       action: (c) =>
            {
                var pArg = new PageArg <ProductCategoryModel.Select, ProductCategoryModel.Sort>
                {
                    PageIndex = Convert.ToInt32(pageIndex),
                    PageSize = Convert.ToInt32(pageSize),
                    Select = new[]
                    {
                        new SelectItem <ProductCategoryModel.Select> {
                            Table = ProductCategoryModel.Select.ProductCategory, Column = new [] { "Id", "Name", "Photo" }
                        },
                    },
                    DebugQuery = true
                };

                //var r = ProductCategoryDAO.Get(c.Db, pArg,
                //    id: id,
                //    str_Value: str_Value == null ? null : new StringParam(str_Value),
                //    num_Status: num_Status == null ? null : new NumericParam(num_Status));
                var r = new PageResult <ProductCategoryModel>();
                c.SetError(r);
                if (r.Total == 0)
                {
                    r.Items = new List <ProductCategoryModel>();
                }
                return r;
            }));
        }
Esempio n. 4
0
        public static PageResult <ProductModel> Store_GetInfoProduct(long?actionUserId, long id)
        {
            return(BUSCore.DoPage <ProductModel>(
                       userId: actionUserId,
                       action: (c) =>
            {
                #region [Lấy dữ liệu]

                var pAgr = new PageArg <ProductModel.Select, ProductModel.Sort>
                {
                    PageIndex = 0,
                    PageSize = 1,
                    Select = new SelectItem <ProductModel.Select>[]
                    {
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.Product,
                            Column =
                                new[] { "Id", "Name", "Description", "Photo", "CreateDate", "Title",
                                        "Price", "Link" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.District,
                            Column = new[] { "Id", "Name" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.Province,
                            Column = new[] { "Id", "Name" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.UserInfo,
                            Column = new[] { "Id", "UserName", "AvatarPhoto", "Phone", "CreateDate" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.ProductCategory,
                            Column = new[] { "Id", "Name" }
                        }
                    },
                    DebugQuery = true
                };
                var num_Status = 1;
                long[] num_id = new long[] { id };

                var pResult = ProductDAO.Get(c.Db, pAgr,
                                             id: num_id,
                                             num_Status: num_Status == null ? null : new NumericParam(num_Status)
                                             );
                #endregion

                c.SetError(pResult);
                return pResult;
            }));
        }
Esempio n. 5
0
 public static DoResult <List <Product> > GetAllProduct(long?actionUserId)
 {
     return(BUSCore.Do <List <Product> >(
                userId: actionUserId,
                action: (c) =>
     {
         // Cập nhật hệ thống
         var r = ProductDAO.GetList(c.Db);
         return r;
     }));
 }
Esempio n. 6
0
 public static DoResult <Province> GetProvinceByLink(long?actionUserId, string link)
 {
     return(BUSCore.Do <Province>(
                userId: actionUserId,
                action: (c) =>
     {
         // Cập nhật hệ thống
         var r = ProvinceDAO.GetByLink(c.Db, link);
         return r;
     }));
 }
Esempio n. 7
0
 public static DoResult <List <SubProductCategory> > GetSubProductCategory(long?actionUserId, long categoryId)
 {
     return(BUSCore.Do <List <SubProductCategory> >(
                userId: actionUserId,
                action: (c) =>
     {
         // Cập nhật hệ thống
         var r = SubProductCategoryDAO.GetListByCategoryId(c.Db, categoryId);
         return r;
     }));
 }
Esempio n. 8
0
 public static DoResult <List <District> > GetDistrict(long?actionUserId, long proviceId)
 {
     return(BUSCore.Do <List <District> >(
                userId: actionUserId,
                action: (c) =>
     {
         // Cập nhật hệ thống
         var r = DistrictDAO.GetListByProviceId(c.Db, proviceId);
         return r;
     }));
 }
Esempio n. 9
0
File: User.cs Progetto: GSVien/Code
        public static DoResult <UserInfo> Bus_GetUserInfo(long id)
        {
            return(BUSCore.Do <UserInfo>(
                       userId: -1,
                       action: (c) =>
            {
                //lấy user có email là _email
                var userTemp = UserInfoDAO.GetById(c.Db, id);
                if (userTemp == null)     //không ttồn tại user có email
                {
                    c.SetError("Không tìm thấy thông tin User", 1);
                    return null;
                }

                return userTemp;
            }));
        }
Esempio n. 10
0
File: User.cs Progetto: GSVien/Code
        public static DoResult <UserInfo> Bus_ThayDoiThongTinUser(string username, string passwork, string photo, string sodienthoai)
        {
            //MaHoaMD5 mahoa = new MaHoaMD5();
            return(BUSCore.Do <UserInfo>(
                       userId: -1,
                       action: (c) =>
            {
                UserInfo data = new UserInfo();
                data.UserName = username;
                //data.Passwork = mahoa.md5(passwork);
                data.AvatarPhoto = photo;
                data.GroupId = 1;
                data.Phone = sodienthoai;
                // Cập nhật hệ thống
                var r = UserInfoDAO.Update(c.Db, data);

                return r.Result;
            }));
        }
Esempio n. 11
0
        public static PageResult <ProductModel> Store_GetListProduct(long?actionUserId, int pageIndex, int pageSize,
                                                                     string str_Name  = null, int?num_CategoryId = null, int?num_SubCategoryId = null,
                                                                     int?num_Price    = null, int?num_Status     = null, DateTime?StartDate    = null,
                                                                     DateTime?EndDate = null, int?num_PostUserId = null, int?num_DictrictId    = null, int?num_ProviceId = null)
        {
            return(BUSCore.DoPage <ProductModel>(
                       userId: actionUserId,
                       action: (c) =>
            {
                #region [Lấy dữ liệu]

                var pAgr = new PageArg <ProductModel.Select, ProductModel.Sort>
                {
                    PageIndex = pageIndex,
                    PageSize = pageSize,
                    Select = new SelectItem <ProductModel.Select>[]
                    {
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.Product,
                            Column =
                                new[] { "Id", "Name", "Description", "Photo", "CreateDate", "Title",
                                        "Price", "Link" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.District,
                            Column = new[] { "Id", "Name" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.Province,
                            Column = new[] { "Id", "Name" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.UserInfo,
                            Column = new[] { "Id", "UserName", "AvatarPhoto" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.ProductCategory,
                            Column = new[] { "Id", "Name" }
                        }
                    },
                    DebugQuery = true
                };
                num_Status = 1;
                var pResult = ProductDAO.Get(c.Db, pAgr,
                                             str_Name: str_Name == null ? null : new StringParam(str_Name),
                                             num_CategoryId: num_CategoryId == null ? null : new NumericParam(num_CategoryId),
                                             num_SubCategoryId: num_SubCategoryId == null ? null : new NumericParam(num_SubCategoryId),
                                             num_Price: num_Price == null ? null : new NumericParam(num_Price),
                                             num_Status: num_Status == null ? null : new NumericParam(num_Status),
                                             date_CreateDate: StartDate == null ? null : new DateTimeParam(StartDate, EndDate),
                                             num_PostUserId: num_PostUserId == null ? null : new NumericParam(num_PostUserId),
                                             num_DictrictId: num_DictrictId == null ? null : new NumericParam(num_DictrictId),
                                             num_ProviceId: num_ProviceId == null ? null : new NumericParam(num_ProviceId)
                                             );
                #endregion

                c.SetError(pResult);
                return pResult;
            }));
        }