예제 #1
0
        public void Test()
        {
            string             shopId             = "1";
            ShopInfoExtensions shopInfoExtensions = new ShopInfoExtensions {
                ShopId = shopId, LimitFileNum = 100, LimitGroupNum = 100
            };

            shopInfoExtensions.GroupDataVersion = Guid.NewGuid().ToString("N");
            shopInfoExtensions.FileDataVersion  = Guid.NewGuid().ToString("N");
            IShopInfoExtensionsBusiness shopInfoExtensionsBusiness = BusinessFactory.GetBusiness <IShopInfoExtensionsBusiness>();

            shopInfoExtensionsBusiness.Delete(shopId);
            shopInfoExtensionsBusiness.Add(shopInfoExtensions);

            IFileGroupBusiness fileGroupBusiness = BusinessFactory.GetBusiness <IFileGroupBusiness>();
            var f = fileGroupBusiness.Get(shopId, "123");

            Assert.Null(f);
            FileGroup fg = new FileGroup();

            fg.Name   = "test";
            fg.ShopId = shopId;
            var res = fileGroupBusiness.Add(fg).Result;

            Assert.False(res.Code == 0);
            fg.Name = "test2";
            fg      = fileGroupBusiness.Update(fg);
            Assert.False(fg.Name != "test2");
            var res2 = fileGroupBusiness.GetByShopId(shopId).Result;

            Assert.False(res2.Count == 0);
            fileGroupBusiness.Delete(shopId, fg.Id);
            var res3 = fileGroupBusiness.GetByShopId(shopId).Result;

            Assert.True(res3.Count == 0);
        }
예제 #2
0
        public StiReport GetReport(decimal reportFileId, PersonAdvanceSearchProxy proxy, IList <ReportUIParameter> parmeters)
        {
            try
            {
                if (parmeters.Where(x => Utility.IsEmpty(x.ActionId)).Count() > 0)
                {
                    exception.Add(new ValidationException(ExceptionResourceKeys.ReportParameterActionIdIsEmpty, "شناسه عملیات مشخص نشده است", ExceptionSrc));
                    throw exception;
                }
                ISearchPerson   searchTool = new BPerson();
                IList <decimal> personIdList;
                IList <Person>  persons;
                if (Utility.IsEmpty(parmeters))
                {
                    //مثلا برای گزارش شیفتها چه نیازی به لیست پرسنل است
                    persons = new List <Person>();// searchTool.QuickSearch("", PersonCategory.Public);
                }
                else
                {
                    if (proxy.PersonIdList == null || proxy.PersonIdList.Count == 0)
                    {
                        persons = searchTool.GetPersonInAdvanceSearch(proxy);
                    }
                    else
                    {
                        persons = searchTool.GetPersonByPersonIdList(proxy.PersonIdList);
                    }
                }
                //کلیه پرسنل مدیر , جانشین و اپراتور
                if (persons.Count == 0 && !Utility.IsEmpty(parmeters))
                {
                    persons = searchTool.QuickSearchByPage(0, 1000, "");
                }

                if (persons.Count == 0 && !Utility.IsEmpty(parmeters))
                {
                    exception.Add(new ValidationException(ExceptionResourceKeys.ReportParameterPersonIsEmpty, "مجموعه انتخابی شامل هیچ پرسنلی نمیباشد", ExceptionSrc));
                    throw exception;
                }
                var ids = from o in persons
                          select o.ID;
                personIdList = ids.ToList <decimal>();

                IDictionary <string, object> ParamValues = new Dictionary <string, object>();
                foreach (ReportUIParameter param in parmeters)
                {
                    if (Utility.IsEmpty(param.Value))
                    {
                        exception.Add(new ValidationException(ExceptionResourceKeys.ReportParametersIsEmpty, "مقدار پارامترها مشخص نشده است", ExceptionSrc));
                        throw exception;
                    }

                    string value = param.Value;
                    IDictionary <string, object> result;
                    if (BusinessFactory.Exists(param.ActionId))
                    {
                        result = BusinessFactory.GetBusiness <IBControlParameter>(param.ActionId).ParsParameter(value, param.ActionId);
                    }
                    else
                    {
                        result = BaseControlParameter.ParsParameter(value);
                    }
                    if (result != null)
                    {
                        foreach (var item in result)
                        {
                            ParamValues.Add(item);
                        }
                    }
                }

                ReportFile   file         = this.GetReportFile(reportFileId);
                ReportHelper reportHelper = ReportHelper.Instance("شرکت طرح و پردازش غدیر", BUser.CurrentUser.ID, BUser.CurrentUser.Person.Name, personIdList);
                StiReport    report       = reportHelper.GetReport(@file.File);
                reportHelper.InitAssemblyReport(report);
                reportHelper.InitReportParameter(report, ParamValues);
                reportHelper.InitReportConnection(report, ReportParamRep.GetConnectionString());


                return(report);
            }
            catch (Exception ex)
            {
                BaseBusiness <Report> .LogException(ex, "BReportParameter", "GetReport");

                throw ex;
            }
        }
예제 #3
0
 public void UseRepartParameterFactory_Test()
 {
     IBControlParameter bus = BusinessFactory.GetBusiness <IBControlParameter>("PersonDateRange");
 }