Beispiel #1
0
 private bool InstallServiceCommand_CanExecute(object parameter)
 {
     return(IsConfiguredAsServer && !ServiceHelper.IsServiceInstalled());
 }
Beispiel #2
0
 public ActionResult Adding()
 {
     ViewBag.LanDics = ServiceHelper.Create <IChemCloud_DictionariesService>().GetListByType(10);
     return(View());
 }
Beispiel #3
0
        private async void DeleteConsultant_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (this.gvStudent.SelectedItem == null)
            {
                await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgInfo, "请选择需要删除的学员!", MessageDialogStyle.Affirmative, null);

                return;
            }

            MessageDialogResult delResult = await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgInfo, "确定删除该学员吗?", MessageDialogStyle.AffirmativeAndNegative, null);

            if (delResult == MessageDialogResult.Affirmative)
            {
                StudentDisplayModel selectStudent = this.gvStudent.SelectedItem as StudentDisplayModel;

                if (selectStudent != null)
                {
                    string strErrorMsg = string.Empty;
                    try
                    {
                        IAsyncProxy <IStudentService> studentAyncProxy = await Task.Run(() => ServiceHelper.GetStudentService());

                        if (selectStudent.Id != 0)
                        {
                            //删除已经存在于数据库的数据,对于没有存于数据库的,则事件处理完成时都会刷新列表,故不用处理
                            bool blIsSuccess = await studentAyncProxy.CallAsync(c => c.DeleteById(selectStudent.Id));

                            if (blIsSuccess == true)
                            {
                                await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgInfo, "删除学员成功!", MessageDialogStyle.Affirmative, null);
                            }
                        }

                        await bindStudentList();
                    }
                    catch (TimeoutException timeProblem)
                    {
                        strErrorMsg = timeProblem.Message + UIResources.TimeOut + timeProblem.Message;
                    }
                    catch (FaultException <LCFault> af)
                    {
                        strErrorMsg = af.Detail.Message;
                    }
                    catch (FaultException unknownFault)
                    {
                        strErrorMsg = UIResources.UnKnowFault + unknownFault.Message;
                    }
                    catch (CommunicationException commProblem)
                    {
                        strErrorMsg = UIResources.ConProblem + commProblem.Message + commProblem.StackTrace;
                    }
                    catch (Exception ex)
                    {
                        strErrorMsg = ex.Message;
                    }
                    if (strErrorMsg != string.Empty)
                    {
                        await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgError, "删除学员失败!原因:" + strErrorMsg, MessageDialogStyle.Affirmative, null);
                    }
                }
            }
        }
Beispiel #4
0
        public void GetBudgetDimensionInfo()
        {
            DynamicObjectCollection objects = this.dyRptScheme["DimensionEntity"] as DynamicObjectCollection;

            this.dicDimensionInfo.Clear();
            this.dicDimensionField.Clear();
            int num = 1;

            foreach (DynamicObject obj2 in objects)
            {
                DynamicObject obj3 = obj2["DimensionID"] as DynamicObject;
                if (((obj3 != null) && (Convert.ToString(obj3["BaseDataType_Id"]) != "BM_BUDGETCALENDAR")) && (Convert.ToString(obj3["BaseDataType_Id"]) != "BM_DEPTORG"))
                {
                    string        str    = Convert.ToString(obj3["Category"]);
                    string        formId = Convert.ToString(obj3["BaseDataType_Id"]);
                    int           key    = Convert.ToInt32(obj3["Id"]);
                    DimensionInfo info   = new DimensionInfo {
                        Id              = key,
                        Name            = Convert.ToString(obj3["Name"]),
                        Category        = str,
                        DataControlType = 1
                    };
                    if (str == "10")
                    {
                        formId               = "BOS_ASSISTANTDATA_SELECT";
                        info.PKFieldName     = "FEntryID";
                        info.TableName       = "T_BAS_ASSISTANTDATAENTRY";
                        info.NumberFieldName = "FNUMBER";
                        info.NameFieldName   = "FDATAVALUE";
                        info.NameTableName   = "T_BAS_ASSISTANTDATAENTRY_L";
                    }
                    else
                    {
                        info.FormId = formId;
                        BusinessInfo demensionMetaData = this.GetDemensionMetaData(formId);
                        info.PKFieldName = demensionMetaData.GetForm().PkFieldName;
                        string nameFieldKey = demensionMetaData.GetForm().NameFieldKey;
                        if (!string.IsNullOrWhiteSpace(nameFieldKey))
                        {
                            info.NameFieldName = nameFieldKey;
                            if (demensionMetaData.GetField(nameFieldKey) is MultiLangTextField)
                            {
                                info.NameTableName = demensionMetaData.GetField(nameFieldKey).TableName + "_L";
                            }
                            else
                            {
                                info.NameTableName = demensionMetaData.GetField(nameFieldKey).TableName;
                            }
                        }
                        info.NumberFieldName = demensionMetaData.GetForm().NumberFieldKey;
                        info.TableName       = demensionMetaData.GetField(demensionMetaData.GetForm().NumberFieldKey).TableName;
                        int baseDataType = ServiceHelper.GetService <IOrganizationService>().GetBaseDataType(base.Context, formId);
                        if (baseDataType == 2)
                        {
                            string masterPKFieldName = demensionMetaData.GetForm().MasterPKFieldName;
                            if (!string.IsNullOrWhiteSpace(masterPKFieldName))
                            {
                                info.DataControlType   = baseDataType;
                                info.MasterIDFieldName = masterPKFieldName;
                            }
                        }
                    }
                    if (this.filterParameter.DicDimissionFilter.ContainsKey(key))
                    {
                        info.IsShowField = true;
                        string str5 = string.Format("FDIMENSIONID{0}", num);
                        string str6 = string.Format("FDIMENSIONNAME{0}", num);
                        info.ShowFieldId   = str5;
                        info.ShowFieldName = str6;
                        this.dicDimensionField.Add(str5, str6);
                        num++;
                    }
                    else
                    {
                        info.IsShowField = false;
                    }
                    this.dicDimensionInfo.Add(key, info);
                }
            }
        }
        public override void BeforeExecuteOperationTransaction(BeforeExecuteOperationTransaction e)
        {
            base.BeforeExecuteOperationTransaction(e);
            HashSet <string> poBillNos    = new HashSet <string>();
            Entity           entity       = this.BusinessInfo.GetEntity("FInStockEntry");
            Entity           linkEntry    = this.BusinessInfo.GetEntity("FInStockEntry_Link");
            Field            fldSrcFormId = this.BusinessInfo.GetField("FSRCBILLTYPEID");
            Field            fldSrcBillNo = this.BusinessInfo.GetField("FSrcBillNo");

            // 对单据体进行循环,取关联的源单编号
            foreach (var billObj in e.SelectedRows)
            {
                DynamicObjectCollection entryRows = entity.DynamicProperty.GetValue(billObj.DataEntity)
                                                    as DynamicObjectCollection;
                foreach (var entryRow in entryRows)
                {
                    string srcFormId    = fldSrcFormId.DynamicProperty.GetValue <string>(entryRow);
                    string srcSrcBillNo = fldSrcBillNo.DynamicProperty.GetValue <string>(entryRow);
                    if (string.IsNullOrWhiteSpace(srcFormId) || !srcFormId.EqualsIgnoreCase(POFormId))
                    {// 源单不是采购订单,略过
                        continue;
                    }
                    // 源单编号已经登记,不再重复记录,略过
                    if (poBillNos.Contains(srcSrcBillNo))
                    {
                        continue;
                    }
                    // Link已经记录了源单信息,略过
                    DynamicObjectCollection linkRows = linkEntry.DynamicProperty.GetValue(entryRow)
                                                       as DynamicObjectCollection;
                    if (linkRows.Count > 0)
                    {
                        continue;
                    }
                    poBillNos.Add(srcSrcBillNo);
                }
            }
            if (poBillNos.Count == 0)
            {
                return;
            }
            DynamicObject[] poObjs = this.LoadPurchaseOrder(poBillNos);
            if (poObjs == null || poObjs.Length == 0)
            {
                return;
            }
            Dictionary <string, Dictionary <string, DynamicObject> > dctAllBills = this.BuildDictionary(poObjs);
            string srcTableNumber = this.GetPOEntryTableNumber();
            List <DynamicObject> allNewLinkRows = new List <DynamicObject>();

            // 循环单据体,为单据体,建立起源单关联信息:
            foreach (var billObj in e.SelectedRows)
            {
                DynamicObjectCollection entryRows = entity.DynamicProperty.GetValue(billObj.DataEntity)
                                                    as DynamicObjectCollection;
                foreach (var entryRow in entryRows)
                {
                    string srcFormId    = fldSrcFormId.DynamicProperty.GetValue <string>(entryRow);
                    string srcSrcBillNo = fldSrcBillNo.DynamicProperty.GetValue <string>(entryRow);
                    if (string.IsNullOrWhiteSpace(srcFormId) || !srcFormId.EqualsIgnoreCase(POFormId))
                    {// 源单不是采购订单,略过
                        continue;
                    }
                    Dictionary <string, DynamicObject> dctOneBill = null;
                    if (dctAllBills.TryGetValue(srcSrcBillNo, out dctOneBill) == false)
                    {
                        continue;
                    }
                    DynamicObject materialObj = entryRow["MaterialId"] as DynamicObject;
                    if (materialObj == null)
                    {
                        continue;
                    }
                    string        materialNumber = Convert.ToString(materialObj["number"]);
                    DynamicObject srcRow         = null;
                    if (dctOneBill.TryGetValue(materialNumber, out srcRow) == false)
                    {
                        continue;
                    }
                    // Link已经记录了源单信息,略过
                    DynamicObjectCollection linkRows = linkEntry.DynamicProperty.GetValue(entryRow) as DynamicObjectCollection;
                    if (linkRows.Count > 0)
                    {
                        continue;
                    }
                    DynamicObject linkRow = new DynamicObject(linkEntry.DynamicObjectType);
                    linkRow["STableName"] = srcTableNumber;
                    this.FillLinkRow(srcRow, entryRow, linkRow);
                    linkRows.Add(linkRow);
                    allNewLinkRows.Add(linkRow);
                }
            }
            // 为新建的源单关联信息,设置内码
            IDBService dbService = ServiceHelper.GetService <IDBService>();

            dbService.AutoSetPrimaryKey(this.Context, allNewLinkRows.ToArray(), linkEntry.DynamicObjectType);
        }
Beispiel #6
0
 public async Task <List <MedicalRecordsView> > GetAllViews()
 {
     return(await ServiceHelper <MedicalRecordsView> .ExecuteSelectCommand(new SelectAllCommand <MedicalRecordsView>()));
 }
Beispiel #7
0
 public async Task <int> GetTotalNumberOfItems()
 {
     return(Convert.ToInt32(await ServiceHelper <MedicalRecord> .ExecuteScalarCommand(new CountCommand <MedicalRecord>())));
 }
 public async Task <DbStatus> AddOrUpdate(Place place)
 {
     return(await ServiceHelper <Place> .ExecuteCRUDCommand(new InsertOrUpdateCommand <Place>(), place));
 }
Beispiel #9
0
        public JsonResult Detail(long id)
        {
            ProductConsultationInfo consultation = ServiceHelper.Create <IConsultationService>().GetConsultation(id);

            return(Json(new { ConsulationContent = consultation.ConsultationContent, ReplyContent = consultation.ReplyContent }));
        }
 public async Task <IList <Place> > GetAll()
 {
     return(await ServiceHelper <Place> .ExecuteSelectCommand(new SelectAllCommand <Place>()));
 }
 public async Task <IList <Place> > GetRange(int begin, int count)
 {
     return(await ServiceHelper <Place> .ExecuteSelectCommand(new SelectWithRangeCommand <Place>(begin, count, "Name")));
 }
        public async Task <Place> GetByPrimaryKey(Place place)
        {
            var list = await ServiceHelper <Place> .ExecuteSelectCommand(new SelectWithPrimaryKeyCommand <Place>(), place);

            return(list.Count != 0 ? list[0] : null);
        }
 public async Task <DbStatus> Delete(Place place)
 {
     return(await ServiceHelper <Place> .ExecuteCRUDCommand(new DeleteCommand <Place>(), place));
 }
Beispiel #14
0
 private bool StopServiceCommand_CanExecute(object parameter)
 {
     return(IsConfiguredAsServer && ServiceHelper.IsServiceInstalled() && ServiceHelper.IsServiceRunning());
 }
Beispiel #15
0
 public async Task <DbStatus> AddOrUpdate(MedicalRecord medicalRecord)
 {
     return(await ServiceHelper <MedicalRecord> .ExecuteCRUDCommand(new InsertOrUpdateCommand <MedicalRecord>(), medicalRecord));
 }
Beispiel #16
0
 private void UnSubscribe(string openId)
 {
     Task.Factory.StartNew(() => ServiceHelper.Create <IWXApiService>().UnSubscribe(openId));
 }
Beispiel #17
0
        public async Task <MedicalRecord> GetByUniqueIdentifiers(string[] propertyNames, MedicalRecord entity, bool?deleted = null)
        {
            var list = await ServiceHelper <MedicalRecord> .ExecuteSelectCommand(new SelectWithAttributeValuesCommand <MedicalRecord>(propertyNames, deleted), entity);

            return(list.Count != 0 ? list[0] : null);
        }
Beispiel #18
0
        public ActionResult Index()
        {
            Log.Info("进入微信API");
            SiteSettingsInfo siteSettings = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings();
            string           weixinToken  = "";
            string           item         = "";
            string           str          = "";
            string           item1        = "";
            string           str1         = "";

            weixinToken = siteSettings.WeixinToken;
            item        = base.Request["signature"];
            str         = base.Request["nonce"];
            item1       = base.Request["timestamp"];
            str1        = base.Request["echostr"];

            ActionResult user = base.Content("");

            Log.Info("signature" + item);

            Log.Info("nonce" + str);

            Log.Info("timestamp" + item1);

            Log.Info("echostr" + str1);


            if (base.Request.HttpMethod != "GET")
            {
                Log.Info("不是GET");
                if (!Senparc.Weixin.MP.CheckSignature.Check(item, item1, str, weixinToken))
                {
                    Log.Info("验证不通过");
                }
                XDocument xDocument = XDocument.Load(base.Request.InputStream);
                Senparc.Weixin.MP.Entities.IRequestMessageBase requestEntity = Senparc.Weixin.MP.RequestMessageFactory.GetRequestEntity(xDocument, null);
                SceneHelper    sceneHelper   = new SceneHelper();
                IWXCardService wXCardService = ServiceHelper.Create <IWXCardService>();
                if (requestEntity.MsgType == RequestMsgType.Event)
                {
                    RequestMessageEventBase requestMessageEventBase = requestEntity as RequestMessageEventBase;
                    Event @event = requestMessageEventBase.Event;
                    switch (@event)
                    {
                    case Event.subscribe:
                    {
                        RequestMessageEvent_Subscribe requestMessageEventSubscribe = requestMessageEventBase as RequestMessageEvent_Subscribe;
                        bool flag = false;
                        if (requestMessageEventSubscribe.EventKey != string.Empty)
                        {
                            string     str2  = requestMessageEventSubscribe.EventKey.Replace("qrscene_", string.Empty);
                            SceneModel model = sceneHelper.GetModel(str2);
                            if (model != null)
                            {
                                if (model.SceneType == QR_SCENE_Type.WithDraw)
                                {
                                    flag = true;
                                    str1 = ProcessWithDrawScene(requestMessageEventSubscribe, str2, model);
                                    user = base.Content(str1);
                                }
                                else if (model.SceneType == QR_SCENE_Type.Bonus)
                                {
                                    flag = true;
                                    user = SendActivityToUser(sceneHelper.GetModel(str2).Object, requestEntity);
                                }
                            }
                        }
                        if (!flag)
                        {
                            user = SendAttentionToUser(requestEntity);
                        }
                        Subscribe(requestEntity.FromUserName);
                        break;
                    }

                    case Event.unsubscribe:
                    {
                        UnSubscribe(requestMessageEventBase.FromUserName);
                        break;
                    }

                    case Event.CLICK:
                    {
                        break;
                    }

                    case Event.scan:
                    {
                        RequestMessageEvent_Scan requestMessageEventScan = requestMessageEventBase as RequestMessageEvent_Scan;
                        if (string.IsNullOrWhiteSpace(requestMessageEventScan.EventKey))
                        {
                            break;
                        }
                        SceneModel sceneModel = sceneHelper.GetModel(requestMessageEventScan.EventKey);
                        if (sceneModel == null || sceneModel.SceneType != QR_SCENE_Type.WithDraw)
                        {
                            break;
                        }
                        str1 = ProcessWithDrawScene(requestMessageEventScan, requestMessageEventScan.EventKey, sceneModel);
                        user = base.Content(str1);
                        break;
                    }

                    default:
                    {
                        switch (@event)
                        {
                        case Event.card_pass_check:
                        {
                            RequestMessageEvent_Card_Pass_Check requestMessageEventCardPassCheck = requestMessageEventBase as RequestMessageEvent_Card_Pass_Check;
                            if (string.IsNullOrWhiteSpace(requestMessageEventCardPassCheck.CardId))
                            {
                                return(user);
                            }
                            wXCardService.Event_Audit(requestMessageEventCardPassCheck.CardId, WXCardLogInfo.AuditStatusEnum.Audited);
                            break;
                        }

                        case Event.card_not_pass_check:
                        {
                            RequestMessageEvent_Card_Pass_Check requestMessageEventCardPassCheck1 = requestMessageEventBase as RequestMessageEvent_Card_Pass_Check;
                            if (string.IsNullOrWhiteSpace(requestMessageEventCardPassCheck1.CardId))
                            {
                                return(user);
                            }
                            wXCardService.Event_Audit(requestMessageEventCardPassCheck1.CardId, WXCardLogInfo.AuditStatusEnum.AuditNot);
                            break;
                        }

                        case Event.user_get_card:
                        {
                            RequestMessageEvent_User_Get_Card requestMessageEventUserGetCard = requestMessageEventBase as RequestMessageEvent_User_Get_Card;
                            if (string.IsNullOrWhiteSpace(requestMessageEventUserGetCard.CardId) || string.IsNullOrWhiteSpace(requestMessageEventUserGetCard.UserCardCode))
                            {
                                return(user);
                            }
                            wXCardService.Event_Send(requestMessageEventUserGetCard.CardId, requestMessageEventUserGetCard.UserCardCode, requestMessageEventUserGetCard.FromUserName, requestMessageEventUserGetCard.OuterId);
                            break;
                        }

                        case Event.user_del_card:
                        {
                            RequestMessageEvent_User_Del_Card requestMessageEventUserDelCard = requestMessageEventBase as RequestMessageEvent_User_Del_Card;
                            if (string.IsNullOrWhiteSpace(requestMessageEventUserDelCard.CardId) || string.IsNullOrWhiteSpace(requestMessageEventUserDelCard.UserCardCode))
                            {
                                return(user);
                            }
                            wXCardService.Event_Unavailable(requestMessageEventUserDelCard.CardId, requestMessageEventUserDelCard.UserCardCode);
                            break;
                        }
                        }
                        break;
                    }
                    }
                }
            }
            else if (Senparc.Weixin.MP.CheckSignature.Check(item, item1, str, weixinToken))
            {
                Log.Info("验证通过");
                user = base.Content(str1);
                //Log.Error(user);
            }
            return(user);
        }
Beispiel #19
0
 public async Task <List <MedicalRecordsView> > GetRangeViews(int begin, int count)
 {
     return(await ServiceHelper <MedicalRecordsView> .ExecuteSelectCommand(new SelectWithRangeCommand <MedicalRecordsView>(begin, count, "Name")));
 }
Beispiel #20
0
 public DatabaseSectionBuilder(IServiceProvider serviceProvider, DatabaseSectionNode databaseSectionNode)
 {
     this.databaseSectionNode = databaseSectionNode;
     this.hierarchy           = ServiceHelper.GetCurrentHierarchy(serviceProvider);
 }
Beispiel #21
0
        public JsonResult Detail(long id)
        {
            ProductCommentInfo comment = ServiceHelper.Create <ICommentService>().GetComment(id);

            return(Json(new { ConsulationContent = comment.ReviewContent, ReplyContent = comment.ReplyContent }));
        }
 private async void btnReportar_Click(object sender, EventArgs e)
 {
     ServiceHelper serviceHelper = new ServiceHelper();
     await serviceHelper.InsertarEntidad("*****@*****.**", "Acompanhando a Maratona da cidade de São José dos Campos/SP");
     button.Text = "Teste enviado";
 }
        public ActionResult Index(int pageSize = 10, int pageNo = 1)
        {
            PageModel <FavoriteShopInfo> userConcernShops  = ServiceHelper.Create <IShopService>().GetUserConcernShops(base.CurrentUser.Id, pageNo, pageSize);
            List <ShopConcernModel>      shopConcernModels = new List <ShopConcernModel>();

            foreach (FavoriteShopInfo list in userConcernShops.Models.ToList())
            {
                if (list.Himall_Shops == null)
                {
                    continue;
                }
                ShopConcernModel shopConcernModel = new ShopConcernModel();
                shopConcernModel.FavoriteShopInfo.Id           = list.Id;
                shopConcernModel.FavoriteShopInfo.Logo         = list.Himall_Shops.Logo;
                shopConcernModel.FavoriteShopInfo.ConcernTime  = list.Date;
                shopConcernModel.FavoriteShopInfo.ShopId       = list.ShopId;
                shopConcernModel.FavoriteShopInfo.ShopName     = list.Himall_Shops.ShopName;
                shopConcernModel.FavoriteShopInfo.ConcernCount = list.Himall_Shops.Himall_FavoriteShops.Count();
                IQueryable <ProductInfo> hotSaleProduct = ServiceHelper.Create <IProductService>().GetHotSaleProduct(list.ShopId, 10);
                if (hotSaleProduct != null)
                {
                    foreach (ProductInfo productInfo in hotSaleProduct)
                    {
                        List <HotProductInfo> hotSaleProducts = shopConcernModel.HotSaleProducts;
                        HotProductInfo        hotProductInfo  = new HotProductInfo()
                        {
                            ImgPath   = productInfo.ImagePath,
                            Name      = productInfo.ProductName,
                            Price     = productInfo.MinSalePrice,
                            Id        = productInfo.Id,
                            SaleCount = (int)productInfo.SaleCounts
                        };
                        hotSaleProducts.Add(hotProductInfo);
                    }
                }
                IQueryable <ProductInfo> newSaleProduct = ServiceHelper.Create <IProductService>().GetNewSaleProduct(list.ShopId, 10);
                if (newSaleProduct != null)
                {
                    foreach (ProductInfo productInfo1 in newSaleProduct)
                    {
                        List <HotProductInfo> newSaleProducts = shopConcernModel.NewSaleProducts;
                        HotProductInfo        hotProductInfo1 = new HotProductInfo()
                        {
                            ImgPath   = productInfo1.ImagePath,
                            Name      = productInfo1.ProductName,
                            Price     = productInfo1.MinSalePrice,
                            Id        = productInfo1.Id,
                            SaleCount = productInfo1.ConcernedCount
                        };
                        newSaleProducts.Add(hotProductInfo1);
                    }
                }
                shopConcernModels.Add(shopConcernModel);
            }
            PagingInfo pagingInfo = new PagingInfo()
            {
                CurrentPage  = pageNo,
                ItemsPerPage = pageSize,
                TotalItems   = userConcernShops.Total
            };

            ViewBag.pageInfo = pagingInfo;
            return(View(shopConcernModels));
        }
Beispiel #24
0
 public async Task <DbStatus> Delete(MedicalRecord medicalRecord)
 {
     return(await ServiceHelper <MedicalRecord> .ExecuteCRUDCommand(new DeleteCommand <MedicalRecord>(), medicalRecord));
 }
Beispiel #25
0
        public ActionResult ProductDetail(string id = "")
        {
            CheckPromoter();

            var    shopService = ServiceHelper.Create <IVShopService>();
            string price       = "";

            ProductDetailModel detailModel           = new ProductDetailModel();
            DistributionProductDetailShowModel model = new DistributionProductDetailShowModel()
            {
                Product = new Model.ProductInfo(),
                Shop    = new ShopInfoModel(),
                Color   = new CollectionSKU(),
                Size    = new CollectionSKU(),
                Version = new CollectionSKU()
            };

            ProductInfo          product   = null;
            ProductBrokerageInfo probroker = null;
            ShopInfo             shop      = null;
            long gid = 0;

            #region 商品Id不合法
            if (long.TryParse(id, out gid))
            {
            }
            if (gid == 0)
            {
                //跳转到出错页面
                return(RedirectToAction("Error404", "Error", new { area = "Web" }));
            }
            #endregion



            #region 初始化商品和店铺
            probroker = _iDistributionService.GetDistributionProductInfo(gid);
            product   = _iProductService.GetProduct(gid);

            if (probroker == null)
            {
                return(RedirectToAction("Error404", "Error", new { area = "Web" }));
            }

            if (product == null)
            {
                //跳转到404页面
                return(RedirectToAction("Error404", "Error", new { area = "Web" }));
            }
            model.ProductDescription = product.ProductDescriptionInfo.ShowMobileDescription;

            model.DistributionAgentNum       = probroker.AgentNum.Value;
            model.DistributionSaleNum        = probroker.SaleNum.Value;
            model.DistributionCommission     = 0;
            model.ShopDistributionProductNum = _iDistributionService.GetShopDistributionProductCount(product.ShopId);
            decimal rate = probroker.rate;
            if (rate > 0)
            {
                model.DistributionCommission = (product.MinSalePrice * rate / 100);
                int _tmp = (int)(model.DistributionCommission * 100);
                //保留两位小数,但不四舍五入
                model.DistributionCommission = (decimal)(((decimal)_tmp) / (decimal)100);
            }

            //是否已代理
            List <long> proids = new List <long>();
            proids.Add(gid);
            List <long> canAgentIds = _iDistributionService.GetCanAgentProductId(proids, curUserId).ToList();
            model.DistributionIsAgent = true;
            if (canAgentIds.Count > 0)
            {
                model.DistributionIsAgent = false;
            }

            shop = ServiceHelper.Create <IShopService>().GetShop(product.ShopId);
            var mark = ShopServiceMark.GetShopComprehensiveMark(shop.Id);
            model.Shop.PackMark          = mark.PackMark;
            model.Shop.ServiceMark       = mark.ServiceMark;
            model.Shop.ComprehensiveMark = mark.ComprehensiveMark;
            var comm = ServiceHelper.Create <ICommentService>().GetCommentsByProductId(gid);
            model.Shop.Name        = shop.ShopName;
            model.Shop.ProductMark = (comm == null || comm.Count() == 0) ? 0 : comm.Average(p => (decimal)p.ReviewMark);
            model.Shop.Id          = product.ShopId;
            model.Shop.FreeFreight = shop.FreeFreight;
            detailModel.ProductNum = ServiceHelper.Create <IProductService>().GetShopOnsaleProducts(product.ShopId);
            bool isFavorite;
            if (CurrentUser == null)
            {
                isFavorite = false;
            }
            else
            {
                isFavorite = ServiceHelper.Create <IProductService>().IsFavorite(product.Id, CurrentUser.Id);
            }
            detailModel.IsFavorite = isFavorite;
            #endregion

            #region 商品规格

            ProductTypeInfo typeInfo     = _iTypeService.GetType(product.TypeId);
            string          colorAlias   = (typeInfo == null || string.IsNullOrEmpty(typeInfo.ColorAlias)) ? SpecificationType.Color.ToDescription() : typeInfo.ColorAlias;
            string          sizeAlias    = (typeInfo == null || string.IsNullOrEmpty(typeInfo.SizeAlias)) ? SpecificationType.Size.ToDescription() : typeInfo.SizeAlias;
            string          versionAlias = (typeInfo == null || string.IsNullOrEmpty(typeInfo.VersionAlias)) ? SpecificationType.Version.ToDescription() : typeInfo.VersionAlias;
            model.ColorAlias   = colorAlias;
            model.SizeAlias    = sizeAlias;
            model.VersionAlias = versionAlias;

            if (product.SKUInfo != null && product.SKUInfo.Count() > 0)
            {
                long colorId = 0, sizeId = 0, versionId = 0;
                foreach (var sku in product.SKUInfo)
                {
                    var specs = sku.Id.Split('_');
                    if (specs.Count() > 0)
                    {
                        if (long.TryParse(specs[1], out colorId))
                        {
                        }
                        if (colorId != 0)
                        {
                            if (!model.Color.Any(v => v.Value.Equals(sku.Color)))
                            {
                                var c = product.SKUInfo.Where(s => s.Color.Equals(sku.Color)).Sum(s => s.Stock);
                                model.Color.Add(new ProductSKU
                                {
                                    //Name = "选择颜色",
                                    Name         = "选择" + colorAlias,
                                    EnabledClass = c != 0 ? "enabled" : "disabled",
                                    //SelectedClass = !model.Color.Any(c1 => c1.SelectedClass.Equals("selected")) && c != 0 ? "selected" : "",
                                    SelectedClass = "",
                                    SkuId         = colorId,
                                    Value         = sku.Color,
                                    Img           = sku.ShowPic
                                });
                            }
                        }
                    }
                    if (specs.Count() > 1)
                    {
                        if (long.TryParse(specs[2], out sizeId))
                        {
                        }
                        if (sizeId != 0)
                        {
                            if (!model.Size.Any(v => v.Value.Equals(sku.Size)))
                            {
                                var ss = product.SKUInfo.Where(s => s.Size.Equals(sku.Size)).Sum(s1 => s1.Stock);
                                model.Size.Add(new ProductSKU
                                {
                                    //Name = "选择尺码",
                                    Name         = "选择" + sizeAlias,
                                    EnabledClass = ss != 0 ? "enabled" : "disabled",
                                    //SelectedClass = !model.Size.Any(s1 => s1.SelectedClass.Equals("selected")) && ss != 0 ? "selected" : "",
                                    SelectedClass = "",
                                    SkuId         = sizeId,
                                    Value         = sku.Size
                                });
                            }
                        }
                    }

                    if (specs.Count() > 2)
                    {
                        if (long.TryParse(specs[3], out versionId))
                        {
                        }
                        if (versionId != 0)
                        {
                            if (!model.Version.Any(v => v.Value.Equals(sku.Version)))
                            {
                                var v = product.SKUInfo.Where(s => s.Version.Equals(sku.Version)).Sum(s => s.Stock);
                                model.Version.Add(new ProductSKU
                                {
                                    //Name = "选择版本",
                                    Name         = "选择" + versionAlias,
                                    EnabledClass = v != 0 ? "enabled" : "disabled",
                                    //SelectedClass = !model.Version.Any(v1 => v1.SelectedClass.Equals("selected")) && v != 0 ? "selected" : "",
                                    SelectedClass = "",
                                    SkuId         = versionId,
                                    Value         = sku.Version
                                });
                            }
                        }
                    }
                }
                decimal min = 0, max = 0;
                min = product.SKUInfo.Where(s => s.Stock >= 0).Min(s => s.SalePrice);
                max = product.SKUInfo.Where(s => s.Stock >= 0).Max(s => s.SalePrice);
                if (min == 0 && max == 0)
                {
                    price = product.MinSalePrice.ToString("f2");
                }
                else if (max > min)
                {
                    price = string.Format("{0}-{1}", min.ToString("f2"), max.ToString("f2"));
                }
                else
                {
                    price = string.Format("{0}", min.ToString("f2"));
                }
            }
            ViewBag.Price = string.IsNullOrWhiteSpace(price) ? product.MinSalePrice.ToString("f2") : price;
            #endregion

            #region 获取店铺的评价统计
            var shopStatisticOrderComments = ServiceHelper.Create <IShopService>().GetShopStatisticOrderComments(product.ShopId);

            var productAndDescription = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentsInfo.EnumCommentKey.ProductAndDescription).FirstOrDefault();
            var sellerServiceAttitude = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentsInfo.EnumCommentKey.SellerServiceAttitude).FirstOrDefault();
            var sellerDeliverySpeed   = shopStatisticOrderComments.Where(c => c.CommentKey ==
                                                                         StatisticOrderCommentsInfo.EnumCommentKey.SellerDeliverySpeed).FirstOrDefault();

            var productAndDescriptionPeer = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentsInfo.EnumCommentKey.ProductAndDescriptionPeer).FirstOrDefault();
            var sellerServiceAttitudePeer = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentsInfo.EnumCommentKey.SellerServiceAttitudePeer).FirstOrDefault();
            var sellerDeliverySpeedPeer   = shopStatisticOrderComments.Where(c => c.CommentKey ==
                                                                             StatisticOrderCommentsInfo.EnumCommentKey.SellerDeliverySpeedPeer).FirstOrDefault();

            var productAndDescriptionMax = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentsInfo.EnumCommentKey.ProductAndDescriptionMax).FirstOrDefault();
            var productAndDescriptionMin = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentsInfo.EnumCommentKey.ProductAndDescriptionMin).FirstOrDefault();

            var sellerServiceAttitudeMax = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentsInfo.EnumCommentKey.SellerServiceAttitudeMax).FirstOrDefault();
            var sellerServiceAttitudeMin = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentsInfo.EnumCommentKey.SellerServiceAttitudeMin).FirstOrDefault();

            var sellerDeliverySpeedMax = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentsInfo.EnumCommentKey.SellerDeliverySpeedMax).FirstOrDefault();
            var sellerDeliverySpeedMin = shopStatisticOrderComments.Where(c => c.CommentKey == StatisticOrderCommentsInfo.EnumCommentKey.SellerDeliverySpeedMin).FirstOrDefault();

            decimal defaultValue = 5;
            //宝贝与描述
            if (productAndDescription != null && productAndDescriptionPeer != null)
            {
                detailModel.ProductAndDescription     = productAndDescription.CommentValue;
                detailModel.ProductAndDescriptionPeer = productAndDescriptionPeer.CommentValue;
                detailModel.ProductAndDescriptionMin  = productAndDescriptionMin.CommentValue;
                detailModel.ProductAndDescriptionMax  = productAndDescriptionMax.CommentValue;
            }
            else
            {
                detailModel.ProductAndDescription     = defaultValue;
                detailModel.ProductAndDescriptionPeer = defaultValue;
                detailModel.ProductAndDescriptionMin  = defaultValue;
                detailModel.ProductAndDescriptionMax  = defaultValue;
            }
            //卖家服务态度
            if (sellerServiceAttitude != null && sellerServiceAttitudePeer != null)
            {
                detailModel.SellerServiceAttitude     = sellerServiceAttitude.CommentValue;
                detailModel.SellerServiceAttitudePeer = sellerServiceAttitudePeer.CommentValue;
                detailModel.SellerServiceAttitudeMax  = sellerServiceAttitudeMax.CommentValue;
                detailModel.SellerServiceAttitudeMin  = sellerServiceAttitudeMin.CommentValue;
            }
            else
            {
                detailModel.SellerServiceAttitude     = defaultValue;
                detailModel.SellerServiceAttitudePeer = defaultValue;
                detailModel.SellerServiceAttitudeMax  = defaultValue;
                detailModel.SellerServiceAttitudeMin  = defaultValue;
            }
            //卖家发货速度
            if (sellerDeliverySpeedPeer != null && sellerDeliverySpeed != null)
            {
                detailModel.SellerDeliverySpeed     = sellerDeliverySpeed.CommentValue;
                detailModel.SellerDeliverySpeedPeer = sellerDeliverySpeedPeer.CommentValue;
                detailModel.SellerDeliverySpeedMax  = sellerDeliverySpeedMax != null ? sellerDeliverySpeedMax.CommentValue : 0;
                detailModel.sellerDeliverySpeedMin  = sellerDeliverySpeedMin != null ? sellerDeliverySpeedMin.CommentValue : 0;
            }
            else
            {
                detailModel.SellerDeliverySpeed     = defaultValue;
                detailModel.SellerDeliverySpeedPeer = defaultValue;
                detailModel.SellerDeliverySpeedMax  = defaultValue;
                detailModel.sellerDeliverySpeedMin  = defaultValue;
            }
            #endregion


            model.Product = product;

            //var comments = ServiceHelper.Create<ICommentService>().GetComments(new CommentQuery
            //{
            //    ProductID = product.Id,
            //    PageNo = 1,
            //    PageSize = 10000
            //});
            //detailModel.CommentCount = comments.Total;

            var com      = product.Himall_ProductComments.Where(item => !item.IsHidden.HasValue || item.IsHidden.Value == false);
            var comCount = com.Count();
            detailModel.CommentCount = comCount;

            var consultations = ServiceHelper.Create <IConsultationService>().GetConsultations(gid);

            //double total = product.Himall_ProductComments.Count();
            //double niceTotal = product.Himall_ProductComments.Count(item => item.ReviewMark >= 4);
            double total     = (double)comCount;
            double niceTotal = com.Count(item => item.ReviewMark >= 4);
            detailModel.NicePercent   = (int)((niceTotal / total) * 100);
            detailModel.Consultations = consultations.Count();
            long vShopId;
            if (shopService.GetVShopByShopId(shop.Id) == null)
            {
                vShopId = -1;
            }
            else
            {
                vShopId = shopService.GetVShopByShopId(shop.Id).Id;
            }
            detailModel.VShopId = vShopId;
            model.Shop.VShopId  = vShopId;
            var bonus = ServiceHelper.Create <IShopBonusService>().GetByShopId(shop.Id);
            if (bonus != null)
            {
                detailModel.BonusCount             = bonus.Count;
                detailModel.BonusGrantPrice        = bonus.GrantPrice;
                detailModel.BonusRandomAmountStart = bonus.RandomAmountStart;
                detailModel.BonusRandomAmountEnd   = bonus.RandomAmountEnd;
            }
            detailModel.CashDepositsObligation = ServiceHelper.Create <ICashDepositsService>().GetCashDepositsObligation(product.Id);
            var cashDepositModel = ServiceHelper.Create <ICashDepositsService>().GetCashDepositsObligation(product.Id);
            model.CashDepositsServer = cashDepositModel;
            model.VShopLog           = shopService.GetVShopLog(model.Shop.VShopId);
            model.FavoriteShopCount  = _iShopService.GetShopFavoritesCount(product.ShopId);

            ViewBag.DetailModel = detailModel;


            //分销信息

            return(View(model));
        }
Beispiel #26
0
 public async Task <IList <MedicalRecord> > GetAll()
 {
     return(await ServiceHelper <MedicalRecord> .ExecuteSelectCommand(new SelectAllCommand <MedicalRecord>()));
 }
Beispiel #27
0
 public JsonResult SetOtherUnActiveStatus(long Id, int titleId, int languageType)
 {
     ServiceHelper.Create <IMessageSettingService>().SetOtherUnActiveStatus(Id, titleId, languageType);
     return(Json(new { success = true }));
 }
Beispiel #28
0
        public async Task <MedicalRecord> GetByPrimaryKey(MedicalRecord medicalRecord)
        {
            var list = await ServiceHelper <MedicalRecord> .ExecuteSelectCommand(new SelectWithPrimaryKeyCommand <MedicalRecord>(), medicalRecord);

            return(list.Count != 0 ? list[0] : null);
        }
        public object Handle(APIContext context)
        {
            var data = JsonHelper.DeserializeJsonToObject <case_reportFinishReq>(context.Data);

            if (data.CaseReport == null)
            {
                throw new Exception("没有主体数据");
            }
            data.CaseReport.TaskId      = data.SourceTaskId;
            data.CaseReport.EventInfoId = data.EventInfoId;
            QueryDb.BeginTransaction();
            try
            {
                #region 发起钉钉的审批 并将其返回的ID写入Task内
                if (data.oapiProcessinstanceCreateRequest != null)
                {
                    //填值
                    var UsrService      = SysContext.GetService <IUserServices>();
                    var loginClientInfo = SysContext.GetService <WanJiang.Framework.Infrastructure.Logging.ClientInfo>();

                    //ServiceConfig userServiceConfig = ServiceHelper.GetServiceConfig("user");
                    //var OTDB = SysContext.GetOtherDB(userServiceConfig.model.dbName);
                    //var deptId = OTDB.FirstOrDefault<long>(@"SELECT org.id FROM organization org
                    //                        inner join organizationuser ou on ou.OrganizationId = org.Id
                    //                        inner join user usr on usr.Id = ou.UserId
                    //                        where usr.AccountId = @0", loginClientInfo.AccountId);
                    ////
                    //if (deptId == null)
                    //    throw new Exception("无组织部门");

                    var usrDetail = UsrService.GetUserDetails(loginClientInfo.UserId);
                    var ddService = SysContext.GetService <IDingDingServices>();
                    if (usrDetail.Result.Organizations == null || usrDetail.Result.Organizations.Count <= 0)
                    {
                        throw new Exception("无组织部门");
                    }
                    var deptId = usrDetail.Result.Organizations[0].Id;

                    data.oapiProcessinstanceCreateRequest.DeptId           = deptId;
                    data.oapiProcessinstanceCreateRequest.OriginatorUserId = loginClientInfo.AccountId;

                    var result = ddService.ProcessInstaceCreateAsync(data.oapiProcessinstanceCreateRequest);
                    var test   = result.Result;
                    if (result.Result.Errcode != 0)
                    {
                        throw new Exception("发起审核流失败" + result.Result.ErrMsg);
                    }
                    data.CaseReport.ProcessInstanceId = result.Result.ProcessInstanceId;
                    data.CaseReport.FormState         = "待审核";
                    //更新该Report上的信息
                    //var targetId = result.Result.ProcessInstanceId;
                    //if (data.CaseReport.TaskId == null || data.CaseReport.TaskId == "")
                    //    throw new Exception("Task为空");
                    //var taskObj = QueryDb.FirstOrDefault<work_task>("where TaskID =@0", data.CaseReport.TaskId);
                    //if (taskObj == null)
                    //    throw new Exception("该Task不存在");
                    ////更新值
                    //taskObj.processInstanceId = result.Result.ProcessInstanceId;
                    //data.CaseReport.FormState = "待审批";
                    ////data.CaseReport.
                    //QueryDb.Update(taskObj);
                    //ServiceHelper.GetService("work_task").Update(taskObj);
                }
                #endregion
                CreateInfo(data.CaseReport);
                if (!string.IsNullOrEmpty(data.CaseReport.CaseId))
                {
                    var caseinfo = QueryDb.FirstOrDefault <case_Info>("select * from case_Info where Id=@0", data.CaseReport.CaseId);
                    if (caseinfo == null)
                    {
                        throw new Exception("没有案件信息");
                    }
                    caseinfo.CaseStatus = "完成处罚";
                    QueryDb.Update(caseinfo);
                }
                else
                {
                    throw new Exception("没有案件信息");
                }
                _sHBaseService.CreatTasksAndCreatWorkrecor(data.NextTasks, data.SourceTaskId);
                _sHBaseService.UpdateWorkTaskState(data.SourceTaskId, WorkTaskStatus.Close);//关闭任务

                //打印预生成
                var PDFSerivce = ServiceHelper.GetService("form_printPDFService") as form_printPDFService;
                PDFSerivce.AsposeToPdf(new APIContext()
                {
                    Data = @"{""formId"":""" + data.CaseReport.ID + @""",""formType"":""case_report""}"
                });
            }
            catch (Exception e)
            {
                QueryDb.AbortTransaction();
                throw e;
            }
            QueryDb.CompleteTransaction();
            return(true);
        }
 public JsonResult Delete(long id)
 {
     ServiceHelper.Create <IArticleCategoryService>().DeleteArticleCategory(new long[] { id });
     return(Json(new { success = true }));
 }