コード例 #1
0
        /// <summary>
        /// Update item to cart
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private UpdateDataModel UpdateInfo(UpdateDataModel inputObject)
        {
            // Local variable declaration
            UpdateDataModel getResult = null;
            CartCom         cartCom   = null;

            // Variable initialize
            getResult = new UpdateDataModel();
            cartCom   = new CartCom(inputObject.Cart);

            // Get data
            foreach (var obj in inputObject.ListItems)
            {
                if (DataCheckHelper.IsNull(obj.Quantity) ||
                    obj.Quantity < decimal.Zero)
                {
                    continue;
                }
                var item = new CartItem();
                item.ItemCd   = obj.ItemCd;
                item.Quantity = obj.Quantity.Value;
                cartCom.UpdateItem(item);
            }

            // Set value
            getResult.Cart = cartCom.Items;

            // Return value
            return(getResult);
        }
コード例 #2
0
ファイル: MCodeCom.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Convert output combo items list
        /// </summary>
        /// <param name="target">List string</param>
        /// <param name="selectedValue">Selected value</param>
        /// <returns>List ListItem</returns>
        public static ComboModel ToComboItems(IList <string> target, string selectedValue)
        {
            // Local variable declaration
            ComboModel        comboModel     = null;
            IList <ComboItem> listComboItems = null;

            // Variable initialize
            listComboItems = new List <ComboItem>();
            comboModel     = new ComboModel();

            // Get data
            var val = string.Empty;

            foreach (var obj in target)
            {
                var combo = new ComboItem();
                combo.Code = DataHelper.ToString(obj);
                combo.Name = DataHelper.ToString(obj);
                if (combo.Code == selectedValue ||
                    (DataCheckHelper.IsNull(selectedValue) && target.IndexOf(obj) == 0))
                {
                    val = combo.Code;
                }
                listComboItems.Add(combo);
            }

            // Set value
            comboModel.SeletedValue = val;
            comboModel.ListItems    = listComboItems;

            return(comboModel);
        }
コード例 #3
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>ResultModel</returns>
        private void Check(UpdateDataModel inputObject)
        {
            // Local variable declaration
            DataCom dataCom = null;
            CartCom cartCom = null;

            // Variable initialize
            dataCom = new DataCom();
            cartCom = new CartCom(inputObject.Cart);

            // Check valid
            foreach (var item in cartCom.Items)
            {
                if (!dataCom.IsExist <Item>(item.ItemCd, false))
                {
                    throw new DataNotExistException(string.Format("Sản phẩm ({0})", item.ItemCd));
                }
                if (DataCheckHelper.IsNull(item.Quantity))
                {
                    throw new ExecuteException("E_MSG_00001", "Số lượng");
                }
                if (item.Quantity <= decimal.Zero)
                {
                    throw new ExecuteException("E_MSG_00011", "Số lượng");
                }
            }
        }
コード例 #4
0
        // Handle request based on method
        private void ExecuteHandler(HttpContext context)
        {
            switch (context.Request.HttpMethod)
            {
            case "HEAD":
            case "GET":
                if (!DataCheckHelper.IsNull(input.FileName))
                {
                    DeliverFile(context);
                }
                else
                {
                    ListCurrentFiles(context);
                }
                break;

            case "POST":
            case "PUT":
                UploadFile(context);
                break;

            case "DELETE":
                DeleteFile();
                break;

            case "OPTIONS":
                ReturnOptions(context);
                break;

            default:
                context.Response.ClearHeaders();
                context.Response.StatusCode = 405;
                break;
            }
        }
コード例 #5
0
ファイル: InitLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private void Check(InitDataModel inputObject)
        {
            // Local variable declaration
            var adminUserEntryDao = new AdminUserEntryDao();

            // Check role
            if (!PageHelper.AuthRole(Logics.RL_USERS))
            {
                throw new ExecuteException("E_MSG_00013");
            }

            // Check valid
            if (!IsAdd)
            {
                if (DataCheckHelper.IsNull(inputObject.UserCd))
                {
                    throw new ExecuteException("E_MSG_DATA_00004", "Mã tài khoản");
                }

                if (!adminUserEntryDao.IsExist(inputObject.UserCd))
                {
                    throw new DataNotExistException("Tài khoản");
                }
            }
        }
コード例 #6
0
ファイル: InitLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private void Check(InitDataModel inputObject)
        {
            // Local variable declaration
            AdminBrandEntryDao adminBrandEntryDao = null;

            // Variable initialize
            adminBrandEntryDao = new AdminBrandEntryDao();

            // Check role
            if (!PageHelper.AuthRole(Logics.RL_BRANDS))
            {
                throw new ExecuteException("E_MSG_00013");
            }

            // Check valid
            if (!IsAdd)
            {
                if (DataCheckHelper.IsNull(inputObject.BrandCd))
                {
                    throw new ExecuteException("E_MSG_DATA_00004", "Mã thương hiệu");
                }

                if (!adminBrandEntryDao.IsExistBrand(inputObject.BrandCd))
                {
                    throw new DataNotExistException("Thương hiệu");
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private void Check(InitDataModel inputObject)
        {
            // Local variable declaration
            AdminItemEntryDao adminItemEntryDao = null;

            // Variable initialize
            adminItemEntryDao = new AdminItemEntryDao();

            // Check role
            if (!PageHelper.AuthRole(Logics.RL_ITEMS))
            {
                throw new ExecuteException("E_MSG_00013");
            }

            // Check valid
            if (!IsAdd)
            {
                if (DataCheckHelper.IsNull(inputObject.ItemCd))
                {
                    throw new ExecuteException("E_MSG_DATA_00004", "Mã sản phẩm");
                }

                if (!adminItemEntryDao.IsExistItem(inputObject.ItemCd))
                {
                    throw new DataNotExistException("Sản phẩm");
                }
            }
        }
コード例 #8
0
ファイル: UserCom.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Check valid password
        /// </summary>
        /// <param name="userCd">UserCd</param>
        /// <param name="password">Password</param>
        /// <returns>True/False</returns>
        public bool IsValidPassword(Guid userCd, string password)
        {
            // Local variable declaration
            var  result  = true;
            User account = null;

            // Check param
            if (DataCheckHelper.IsNull(userCd) ||
                DataCheckHelper.IsNull(password))
            {
                throw new ParamInvalidException();
            }

            // Get information
            var passHash = DataHelper.GetMd5Hash(password);

            account = GetSingle(userCd, false);

            if (account == null || passHash.Equals(account.Password) == false)
            {
                result = false;
            }

            // Return value
            return(result);
        }
コード例 #9
0
ファイル: UserCom.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Update password
        /// </summary>
        /// <param name="userCd">userCd</param>
        /// <param name="userName">UserNname</param>
        /// <param name="password">Data</param>
        public void UpdatePassword(Guid userCd, string password, string updateUser, bool ignoreDeleteFlag)
        {
            // Local variable declaration
            User param = null;

            // Variable initialize
            param = new User();

            // Check param
            if (DataCheckHelper.IsNull(userCd) ||
                DataCheckHelper.IsNull(password) ||
                DataCheckHelper.IsNull(updateUser))
            {
                throw new ParamInvalidException();
            }

            // Get system date
            var currentDate = DateTime.Now;

            // Set value
            param.UserCd     = userCd;
            param.Password   = DataHelper.GetMd5Hash(password);
            param.UpdateUser = updateUser;
            param.UpdateDate = currentDate;

            // Update value
            _comDao.UpdatePassword(param, ignoreDeleteFlag);
        }
コード例 #10
0
ファイル: UserCom.cs プロジェクト: hieur8/web-mbec
        public IList <string> GetUserRoles(Guid userCd, bool ignoreDeleteFlag)
        {
            // Check param
            if (DataCheckHelper.IsNull(userCd))
            {
                throw new ParamInvalidException();
            }

            // Get user
            var user = GetSingle(userCd, ignoreDeleteFlag);

            // Get user group
            var groups = user.UserGroups;

            // Get role
            var result = new List <string>();

            foreach (var g in groups)
            {
                var roles = _comDao.GetUserRoles(g.GroupCd, ignoreDeleteFlag);
                foreach (var r in roles)
                {
                    if (!result.Contains(r.RoleCd))
                    {
                        result.Add(r.RoleCd);
                    }
                }
            }

            // Return value
            return(result);
        }
コード例 #11
0
ファイル: SaveLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Check processing.
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        private void Check(SaveDataModel inputObject)
        {
            // Local variable declaration
            UserCom userCom = null;

            // Variable initialize
            userCom = new UserCom();

            // Check valid
            if (!PageHelper.HasAuthenticated)
            {
                throw new ExecuteException("E_MSG_00001", "Truy cập");
            }

            if (inputObject.HasChangePassword)
            {
                if (DataCheckHelper.IsNull(inputObject.Password))
                {
                    throw new ExecuteException("E_MSG_00004", "Mật khẩu");
                }
                if (DataCheckHelper.IsNull(inputObject.NewPassword))
                {
                    throw new ExecuteException("E_MSG_00004", "Mật khẩu mới");
                }
                if (!userCom.IsValidPassword(PageHelper.UserCd, inputObject.Password))
                {
                    throw new ExecuteException("E_MSG_00001", "Mật khẩu");
                }
                if (inputObject.NewPassword != inputObject.NewPasswordConf)
                {
                    throw new ExecuteException("E_MSG_00001", "Mật khẩu và mật khẩu xác nhận");
                }
            }
        }
コード例 #12
0
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>ResultModel</returns>
        private void Check(UpdateDataModel inputObject)
        {
            // Local variable declaration
            StorageFileCom storageFileCom = null;

            // Variable initialize
            storageFileCom = new StorageFileCom();

            // Check valid
            int i = 0;

            foreach (var obj in inputObject.ListFiles)
            {
                if (DataCheckHelper.IsNull(obj.FileId))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Mã tập tin ({0})", i + 1));
                }
                if (DataCheckHelper.IsNull(obj.FileNo))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Số tập tin ({0})", i + 1));
                }
                if (DataCheckHelper.IsNull(obj.SortKey))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Thứ tự ({0})", i + 1));
                }
                if (!storageFileCom.IsExist(obj.FileId, obj.FileNo, true))
                {
                    throw new DataNotExistException(string.Format("Tập tin ({0})", i + 1));
                }
                i++;
            }
        }
コード例 #13
0
        /// <summary>
        /// 从DataTable中获取实体列表
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        private List <DAL.Department> GetModelFromDataTable(DataTable dt, out string msg)
        {
            List <DAL.Department> list = new List <DAL.Department>();

            msg = "";

            //接口协议文档中定义的字段
            Dictionary <string, string> dataFieldNameDic = new Dictionary <string, string>();

            dataFieldNameDic.Add("DepartmentCode", "部门编码");
            dataFieldNameDic.Add("DepartmentName", "部门名称");
            dataFieldNameDic.Add("CompanyName", "公司名称");

            if (dt.Rows.Count == 0)
            {
                msg = "用友系统返回数据集中无数据!";
                return(new List <Department>());
            }

            StringBuilder errorColName = new StringBuilder();

            //检查数据集中是否存在指定字段
            foreach (KeyValuePair <string, string> kvp in dataFieldNameDic)
            {
                if (dt.Columns.Contains(kvp.Key) == false)
                {
                    errorColName.Append(Environment.NewLine);
                    errorColName.Append(kvp.Value);
                    errorColName.Append("-");
                    errorColName.Append(kvp.Key);
                }
            }
            if (errorColName.Length > 0)
            {
                errorColName.Insert(0, "用友系统返回的数据集中未包含如下字段,不能进行有效解析!");
                msg = errorColName.ToString();
                return(new List <Department>());;
            }

            //遍历数据集创建实体
            foreach (DataRow dr in dt.Rows)
            {
                Department newModel = new Department();

                newModel.DepartmentCode = DataCheckHelper.GetCellString(dr["DepartmentCode"]);
                newModel.DepartmentName = DataCheckHelper.GetCellString(dr["DepartmentName"]);
                newModel.Description    = DataCheckHelper.GetCellString(dr["CompanyName"]);
                newModel.Parent         = "root";//上级部门固定设置为root


                List <Department> existWareHouse = (from r in list where r.DepartmentName == newModel.DepartmentName select r).ToList <Department>();
                if (existWareHouse == null || existWareHouse.Count == 0)//过滤重复数据
                {
                    list.Add(newModel);
                }
            }

            return(list);
        }
コード例 #14
0
        /// <summary>
        /// 从DataTable中获取实体列表
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        private List <DAL.WareHouse> GetModelFromDataTable(DataTable dt, out string msg)
        {
            List <DAL.WareHouse> list = new List <DAL.WareHouse>();

            msg = "";

            //接口协议文档中定义的字段
            Dictionary <string, string> dataFieldNameDic = new Dictionary <string, string>();

            dataFieldNameDic.Add("WHCode", "仓库编码");
            dataFieldNameDic.Add("WHName", "仓库名称");

            if (dt.Rows.Count == 0)
            {
                msg = "用友系统返回数据集中无数据!";
                return(new List <WareHouse>());
            }

            StringBuilder errorColName = new StringBuilder();

            //检查数据集中是否存在指定字段
            foreach (KeyValuePair <string, string> kvp in dataFieldNameDic)
            {
                if (dt.Columns.Contains(kvp.Key) == false)
                {
                    errorColName.Append(Environment.NewLine);
                    errorColName.Append(kvp.Value);
                    errorColName.Append("-");
                    errorColName.Append(kvp.Key);
                }
            }
            if (errorColName.Length > 0)
            {
                errorColName.Insert(0, "用友系统返回的数据集中未包含如下字段,不能进行有效解析!");
                msg = errorColName.ToString();
                return(new List <WareHouse>());;
            }

            //遍历数据集创建实体
            foreach (DataRow dr in dt.Rows)
            {
                WareHouse newModel = new WareHouse();

                newModel.WHCode = DataCheckHelper.GetCellString(dr["WHCode"]);
                newModel.WHName = DataCheckHelper.GetCellString(dr["WHName"]);

                newModel.WHType  = 1;
                newModel.Enabled = true;

                List <WareHouse> existWareHouse = (from r in list where r.WHCode == newModel.WHCode select r).ToList <WareHouse>();
                if (existWareHouse == null || existWareHouse.Count == 0)//过滤重复数据
                {
                    list.Add(newModel);
                }
            }

            return(list);
        }
コード例 #15
0
ファイル: BasePage.cs プロジェクト: hieur8/web-mbec
        protected void RedirectWithReturnUrl(string url)
        {
            if (!DataCheckHelper.IsNull(Request["returnUrl"]))
            {
                url = Request["returnUrl"];
            }

            Redirect(url);
        }
コード例 #16
0
ファイル: ItemCom.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        ///
        /// </summary>
        /// <param name="itemCd"></param>
        /// <returns></returns>
        public bool HasOffer(string itemCd)
        {
            // Check param
            if (DataCheckHelper.IsNull(itemCd))
            {
                throw new ParamInvalidException();
            }

            // Return value
            return(_comDao.HasOffer(itemCd));
        }
コード例 #17
0
ファイル: ItemCom.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Update viewer
        /// </summary>
        /// <param name="itemCd">ItemCd</param>
        public void UpdateViewer(string itemCd)
        {
            // Check param
            if (DataCheckHelper.IsNull(itemCd))
            {
                throw new ParamInvalidException();
            }

            // Update
            _comDao.UpdateViewer(itemCd);
        }
コード例 #18
0
ファイル: UserCom.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Authenticate user
        /// </summary>
        /// <param name="userCd">UserCd</param>
        /// <returns>True/False</returns>
        public bool Authenticate(Guid userCd)
        {
            // Check param
            if (DataCheckHelper.IsNull(userCd))
            {
                return(false);
            }

            // Return value
            return(GetSingle(userCd, false) != null);
        }
コード例 #19
0
        /// <summary>
        /// Get parameter value (Number)
        /// </summary>
        /// <param name="paramCd">ParamCd</param>
        /// <param name="ignoreDeleteFlag">IgnoreDeleteFlag</param>
        /// <returns>Parameter value</returns>
        public decimal?GetNumber(string paramCd, bool ignoreDeleteFlag)
        {
            // Check param
            if (DataCheckHelper.IsNull(paramCd))
            {
                throw new ParamInvalidException();
            }

            //Return value
            return(_comDao.GetNumber(paramCd, ignoreDeleteFlag));
        }
コード例 #20
0
ファイル: UpdateLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>ResultModel</returns>
        private void Check(UpdateDataModel inputObject)
        {
            // Local variable declaration
            AdminCategoryListDao adminCategoryListDao = null;
            MCodeCom             mCodeCom             = null;

            // Variable initialize
            adminCategoryListDao = new AdminCategoryListDao();
            mCodeCom             = new MCodeCom();

            // Check role
            if (!PageHelper.AuthRole(Logics.RL_CATEGORIES))
            {
                throw new ExecuteException("E_MSG_00013");
            }

            // Check valid
            int i = 0;

            foreach (var obj in inputObject.ListCategories)
            {
                var dFlag = DataHelper.ToString(obj.DeleteFlag);

                if (DataCheckHelper.IsNull(obj.CategoryName))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Tên loại ({0})", i + 1));
                }
                if (DataCheckHelper.IsNull(obj.CategoryDiv))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Chủng loại ({0})", i + 1));
                }
                if (!mCodeCom.IsExist(Logics.GROUP_CATEGORY_DIV, obj.CategoryDiv, false))
                {
                    throw new DataNotExistException(string.Format("Chủng loại ({0})", i + 1));
                }
                if (DataCheckHelper.IsNull(obj.SortKey))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Thứ tự ({0})", i + 1));
                }
                if (DataCheckHelper.IsNull(obj.DeleteFlag))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Dữ liệu ({0})", i + 1));
                }
                if (!mCodeCom.IsExist(Logics.GROUP_DELETE_FLAG, dFlag, false))
                {
                    throw new DataNotExistException(string.Format("Dữ liệu ({0})", i + 1));
                }
                if (!adminCategoryListDao.IsExistCategory(obj.CategoryCd))
                {
                    throw new DataNotExistException(string.Format("Loại sản phẩm ({0})", i + 1));
                }
                i++;
            }
        }
コード例 #21
0
        /// <summary>
        /// Check exist
        /// </summary>
        /// <param name="paramCd">ParamCd</param>
        /// <param name="ignoreDeleteFlag">IgnoreDeleteFlag</param>
        /// <returns>True/False</returns>
        public bool IsExist(string paramCd, bool ignoreDeleteFlag)
        {
            // Check param
            if (DataCheckHelper.IsNull(paramCd))
            {
                throw new ParamInvalidException();
            }

            //Return value
            return(_comDao.IsExist(paramCd, ignoreDeleteFlag));
        }
コード例 #22
0
        /// <summary>
        /// Update data
        /// </summary>
        /// <param name="param">Entity</param>
        /// <param name="ignoreDeleteFlag">IgnoreDeleteFlag</param>
        public void Update(MParameter entity, bool ignoreDeleteFlag)
        {
            // Check param
            if (DataCheckHelper.IsNull(entity.ParamCd))
            {
                throw new ParamInvalidException();
            }

            //Update value
            _comDao.Update(entity, ignoreDeleteFlag);
        }
コード例 #23
0
ファイル: UploadLogic.cs プロジェクト: hieur8/web-mbec
 /// <summary>
 /// Check processing
 /// </summary>
 /// <param name="inputObject">DataModel</param>
 /// <returns>ResultModel</returns>
 private void Check(UploadDataModel inputObject)
 {
     // Check valid
     if (DataCheckHelper.IsNull(inputObject.InputStream))
     {
         throw new ExecuteException("E_MSG_00004", "Tập tin");
     }
     if (!StorageFileCom.MapImageSize.ContainsKey(inputObject.FileGroup))
     {
         throw new ExecuteException("E_MSG_00001", "Nhóm tập tin");
     }
 }
コード例 #24
0
ファイル: ItemCom.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Convert item to item model
        /// </summary>
        /// <param name="item">Item</param>
        /// <returns>Item model</returns>
        public ItemModel ToItemModel(Item item)
        {
            // Local variable declaration
            ItemModel      itemModel      = null;
            StorageFileCom storageFileCom = null;

            // Variable initialize
            itemModel      = new ItemModel();
            storageFileCom = new StorageFileCom();

            // Copy infomation
            DataHelper.CopyObject(item, itemModel);

            // Get value
            var storageFile  = storageFileCom.GetSingle(item.FileId, true);
            var itemImage    = storageFile != null ? storageFile.FileName : "default.jpg";
            var storageFiles = storageFileCom.GetListActive(item.FileId, true);

            if (DataCheckHelper.IsNull(storageFiles))
            {
                storageFiles.Add(new StorageFile()
                {
                    FileName = "default.jpg"
                });
            }

            // Set value
            itemModel.ItemImage      = itemImage;
            itemModel.ItemImages     = storageFiles;
            itemModel.ListOfferItems = new List <OfferItem>();

            // Check offer
            if (_comDao.HasOffer(itemModel.ItemCd))
            {
                var offer = _comDao.GetOffer(itemModel.ItemCd);

                itemModel.OfferDiv = offer.OfferDiv;
                itemModel.ItemDiv  = Logics.TEXT_BLANK;

                if (itemModel.OfferDiv == Logics.CD_OFFER_DIV_DISCOUNT)
                {
                    itemModel.SalesPriceOld = itemModel.SalesPrice;
                    itemModel.SalesPrice    = GetOfferPrice(itemModel.SalesPrice, offer.Percent);
                }
                else
                {
                    itemModel.ListOfferItems = offer.OfferItems;
                }
            }

            // Return value
            return(itemModel);
        }
コード例 #25
0
ファイル: MCodeCom.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Get single master code
        /// </summary>
        /// <param name="codeGroupCd">CodeGroupCd</param>
        /// <param name="codeCd">CodeCd</param>
        /// <returns>Master code</returns>
        public MCode GetSingle(string codeGroupCd, string codeCd)
        {
            // Check param
            if (DataCheckHelper.IsNull(codeGroupCd) ||
                DataCheckHelper.IsNull(codeCd))
            {
                throw new ParamInvalidException();
            }

            //Return value
            return(_comDao.GetSingle(codeGroupCd, codeCd));
        }
コード例 #26
0
        /// <summary>
        /// Update data
        /// </summary>
        /// <param name="param">Entity</param>
        /// <param name="ignoreDeleteFlag">IgnoreDeleteFlag</param>
        public void UpdateSortKey(StorageFile entity, bool ignoreDeleteFlag)
        {
            // Check param
            if (DataCheckHelper.IsNull(entity.FileId) ||
                DataCheckHelper.IsNull(entity.FileNo))
            {
                throw new ParamInvalidException();
            }

            //Update value
            _comDao.UpdateSortKey(entity, ignoreDeleteFlag);
        }
コード例 #27
0
ファイル: UserCom.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Authenticate user
        /// </summary>
        /// <param name="userName">UserName</param>
        /// <param name="password">Password</param>
        /// <returns>True/False</returns>
        public bool Authenticate(string userName, string password)
        {
            // Check param
            if (DataCheckHelper.IsNull(userName) ||
                DataCheckHelper.IsNull(password))
            {
                return(false);
            }

            // Return value
            return(GetSingle(userName, password) != null);
        }
コード例 #28
0
ファイル: UpdateLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Check processing
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>ResultModel</returns>
        private void Check(UpdateDataModel inputObject)
        {
            // Local variable declaration
            AdminOfferItemListDao adminOfferItemListDao = null;
            MCodeCom mCodeCom = null;

            // Variable initialize
            adminOfferItemListDao = new AdminOfferItemListDao();
            mCodeCom = new MCodeCom();

            // Check role
            if (!PageHelper.AuthRole(Logics.RL_OFFERS))
            {
                throw new ExecuteException("E_MSG_00013");
            }

            // Check valid
            int i = 0;

            foreach (var obj in inputObject.ListOfferItems)
            {
                if (DataCheckHelper.IsNull(obj.OfferItemCd))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Mã sản phẩm ({0})", i + 1));
                }
                if (DataCheckHelper.IsNull(obj.OfferItemQtty))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Số lượng ({0})", i + 1));
                }
                if (obj.OfferItemQtty <= 0)
                {
                    throw new ExecuteException("E_MSG_00011", "Số lượng");
                }
                var dFlag = DataHelper.ToString(obj.DeleteFlag);
                if (DataCheckHelper.IsNull(obj.DeleteFlag))
                {
                    throw new ExecuteException("E_MSG_00004", string.Format("Dữ liệu ({0})", i + 1));
                }
                if (!mCodeCom.IsExist(Logics.GROUP_DELETE_FLAG, dFlag, false))
                {
                    throw new DataNotExistException(string.Format("Dữ liệu ({0})", i + 1));
                }
                if (!adminOfferItemListDao.IsExistItem(obj.OfferItemCd))
                {
                    throw new DataNotExistException(string.Format("Mã sản phẩm ({0})", i + 1));
                }
                if (!adminOfferItemListDao.IsExistOfferItem(obj.OfferCd, obj.DetailNo))
                {
                    throw new DataNotExistException(string.Format("Sản phẩm tặng ({0})", i + 1));
                }
                i++;
            }
        }
コード例 #29
0
ファイル: AdminGiftListDao.cs プロジェクト: hieur8/web-mbec
        public IList <GiftCard> GetListGifts(FilterDataModel inputObject)
        {
            // Get value
            var listResult = from tbl in EntityManager.GiftCards
                             where (tbl.GiftCd.Contains(inputObject.GiftCd) || DataCheckHelper.IsNull(inputObject.GiftCd)) &&
                             (tbl.GiftStatus == inputObject.GiftStatus || DataCheckHelper.IsNull(inputObject.GiftStatus)) &&
                             (tbl.DeleteFlag == inputObject.DeleteFlag || DataCheckHelper.IsNull(inputObject.DeleteFlag))
                             orderby tbl.UpdateDate ascending
                             select tbl;

            // Return value
            return(listResult.ToList());
        }
コード例 #30
0
ファイル: AdminOfferListDao.cs プロジェクト: hieur8/web-mbec
        public IList <Offer> GetListOffers(FilterDataModel inputObject)
        {
            // Get value
            var listResult = from tbl in EntityManager.Offers
                             where (tbl.ItemCd.Contains(inputObject.ItemCd) || DataCheckHelper.IsNull(inputObject.ItemCd)) &&
                             (tbl.OfferDiv == inputObject.OfferDiv || DataCheckHelper.IsNull(inputObject.OfferDiv)) &&
                             (tbl.DeleteFlag == inputObject.DeleteFlag || DataCheckHelper.IsNull(inputObject.DeleteFlag))
                             orderby tbl.UpdateDate ascending
                             select tbl;

            // Return value
            return(listResult.ToList());
        }