Пример #1
0
 public void Test()
 {
     Category.VerifySet(t => t.HasActive               = true, Times.Once());
     CommonCategory.VerifySet(t => t.HasActive         = true, Times.Once());
     Category.VerifySet(t => t.HasUnacknowledged       = false, Times.Once());
     CommonCategory.VerifySet(t => t.HasUnacknowledged = false, Times.Once());
 }
        public int ImportExcel(string userName, string filePath, out bool result, out string message)
        {
            result  = false;
            message = string.Empty;
            int count = 0;

            using (var package = new ExcelPackage(new FileInfo(filePath)))
            {
                ExcelWorksheet workSheet  = package.Workbook.Worksheets[1];
                int            startIndex = workSheet.Dimension.Start.Row;
                int            endIndex   = workSheet.Dimension.End.Row;

                while (string.IsNullOrEmpty(workSheet.Cells[endIndex, 1].Value.ToString()))
                {
                    endIndex = endIndex - 1;
                }

                CommonCategory row;
                for (int i = startIndex + 1; i <= endIndex; i++)
                {
                    row           = new CommonCategory();
                    row.GroupCode = workSheet.Cells[i, 1].Value != null ? workSheet.Cells[i, 1].Value.ToString() : "";
                    row.Code      = workSheet.Cells[i, 2].Value != null ? workSheet.Cells[i, 2].Value.ToString() : "";
                    row.Name      = workSheet.Cells[i, 3].Value != null ? workSheet.Cells[i, 3].Value.ToString() : "";
                    int.TryParse(workSheet.Cells[i, 4].Value != null ? workSheet.Cells[i, 4].Value.ToString() : "0", out var orderNo);
                    row.OrderNo     = orderNo;
                    row.Description = workSheet.Cells[i, 5].Value != null ? workSheet.Cells[i, 5].Value.ToString() : "";
                    int.TryParse(workSheet.Cells[i, 6].Value != null ? workSheet.Cells[i, 6].Value.ToString() : "0", out var active);
                    row.Active      = active == 1 ? true : false;
                    row.UserCreated = row.UserModified = userName;

                    if (_commonCategoryRepository.CheckExist(row, out int foundId, out result, out message, x => x.GroupCode == row.GroupCode && x.Code == row.Code && x.Active == true))
                    {
                        _commonCategoryRepository.UpdateChangedProperties(foundId, row, out result, out message);
                    }
Пример #3
0
        public IActionResult SaveEntity(CommonCategory entity)
        {
            bool   result    = true;
            string message   = string.Empty;
            var    userEmail = User.GetSpecificClaim("Email");

            if (ModelState.IsValid)
            {
                entity.UserModified = userEmail;

                if (entity.Id == 0)
                {
                    entity.UserCreated = userEmail;
                    _commonCategoryService.Add(entity, out result, out message);
                }
                else
                {
                    _commonCategoryService.UpdateChangedProperties(entity, out result, out message);
                }

                return(new OkObjectResult(new GenericResult(result, message)));
            }
            else
            {
                List <string> listErrors  = ModelState.Values.SelectMany(v => v.Errors).Select(x => x.ErrorMessage).ToList();
                string        errorString = String.Join("\n", listErrors.ToArray());
                return(new OkObjectResult(new GenericResult(false, errorString)));
            }
        }
Пример #4
0
 public List<byte> GetTypesForCategory(CommonCategory common_category)
 {
     if (drvt != null)
     {
         foreach (MethodInfo m in drvmi)
         {
             if (m.Name.CompareTo("GetTypesForCategory") == 0)
             {
                 object[] FuncParam = { common_category };
                 return (List<byte>)m.Invoke(refo, FuncParam);
             }
         }
     }
     return null;
 }
Пример #5
0
        public async Task CreateOrEditAsync(CommonCategory cat)
        {
            DataTable dt = _sqlExecuter.ExecuteDataSet($@"select c.BusinessId  from dbo.TUsers s 
left join TChainStore c on s.ChainStoreId = c.Id where s.id={_AbpSession.UserId}").Tables[0];

            cat.TenantId   = _AbpSession.TenantId ?? 0;
            cat.BusinessId = (long)dt.Rows[0][0];
            if (cat.Id <= 0)
            {
                await _Repository.InsertAsync(cat);
            }
            else
            {
                await _Repository.UpdateAsync(cat);
            }
        }
Пример #6
0
        public List <byte> GetTypesForCategory(CommonCategory common_category)
        {
            List <byte> listTypes = new List <byte>();

            switch (common_category)
            {
            case CommonCategory.Current:
            case CommonCategory.Monthly:
                for (byte type = (byte)TypesValues.Tarif1AP; type <= (byte)TypesValues.Tarif4AP; type++)
                {
                    listTypes.Add(type);
                }
                break;
            }

            return(listTypes);
        }
Пример #7
0
        public List<byte> GetTypesForCategory(CommonCategory common_category)
        {
            List<byte> listTypes = new List<byte>();

            switch (common_category)
            {
                case CommonCategory.Current:
                case CommonCategory.Monthly:
                case CommonCategory.Daily:
                    for (byte type = 1; type <= m_max_canals; type++)
                    {
                        listTypes.Add(type);
                    }
                    break;
                case CommonCategory.Inday:
                    break;
            }

            return listTypes;
        }
Пример #8
0
        public List <byte> GetTypesForCategory(CommonCategory common_category)
        {
            List <byte> listTypes = new List <byte>();

            switch (common_category)
            {
            case CommonCategory.Current:
            case CommonCategory.Monthly:
            case CommonCategory.Daily:
                for (byte type = 0; type <= m_max_types; type++)
                {
                    listTypes.Add(type);
                }
                break;

            case CommonCategory.Inday:
                break;
            }

            return(listTypes);
        }
        public void Add(CommonCategory commonCategory, out bool result, out string message)
        {
            var existed = _commonCategoryRepository.CheckExist(commonCategory, out int foundId, out result, out message,
                                                               x => x.GroupCode == commonCategory.GroupCode && x.Code == commonCategory.Code && x.Active == true);

            if (!existed)
            {
                _commonCategoryRepository.Add(commonCategory, out result, out message);
                if (result)
                {
                    SaveChanges();
                }
                else
                {
                    Dispose();
                }
            }
            else
            {
                result  = false;
                message = CommonConstants.Message.Existed;
            }
        }
Пример #10
0
 public List <byte> GetTypesForCategory(CommonCategory common_category)
 {
     return(new List <byte>());
 }
Пример #11
0
 protected override void EstablishContext()
 {
     base.EstablishContext();
     Parameter = new RemapTagsParameter();
     CommonCategory.Setup(d => d.IsRead()).Returns(true).Verifiable();
 }
Пример #12
0
 public List<byte> GetTypesForCategory(CommonCategory common_category)
 {
     throw new NotImplementedException();
 }
Пример #13
0
 public List<byte> GetTypesForCategory(CommonCategory common_category)
 {
     return null;
 }
Пример #14
0
        public List<byte> GetTypesForCategory(CommonCategory common_category)
        {
            List<byte> listTypes = new List<byte>();

            switch (common_category)
            {
                case CommonCategory.Current:
                case CommonCategory.Monthly:
                    for (byte type = (byte)TypesValues.Tarif1AP; type <= (byte)TypesValues.Tarif4AP; type++)
                    {
                        listTypes.Add(type);
                    }
                    break;
            }

            return listTypes;
        }
Пример #15
0
        public List<byte> GetTypesForCategory(CommonCategory common_category)
        {
            List<byte> listTypes = new List<byte>();

            switch (common_category)
            {
                case CommonCategory.Current:
                    for (byte type = (byte)TypesValues.Tarif1AP; type <= (byte)TypesValues.Tarif4RM; type++)
                    {
                        listTypes.Add(type);
                    }
                    for (byte type = (byte)TypesValues.Frequency; type <= (byte)TypesValues.QC; type++)
                    {
                        listTypes.Add(type);
                    }
                    break;
                case CommonCategory.Monthly:
                    for (byte type = (byte)TypesValues.Tarif1AP; type <= (byte)TypesValues.Tarif4RM; type++)
                    {
                        listTypes.Add(type);
                    }
                    break;
                case CommonCategory.Inday:
                    for (byte type = (byte)TypesValues.PowerSliceAP; type <= (byte)TypesValues.PowerSliceRM; type++)
                    {
                        listTypes.Add(type);
                    }
                    break;
            }

            return listTypes;
        }