예제 #1
0
        public JsonResult Send(string json)
        {
            var result = new ReturnMessage(false)
            {
                Message = "提交失败!"
            };

            try
            {
                var entity = JsonConvert.DeserializeObject <AdviseEntity>(json);
                if (entity == null)
                {
                    return(Json(result));
                }

                entity.AdviseId    = Util.NewUpperGuid();
                entity.ConnectName = LoginUser.NickName;
                entity.CreateId    = LoginUser.UserId;
                entity.CreateTime  = DateTime.Now;
                if (AdviseBLL.Instance.Add(entity))
                {
                    if (entity.AttachmentPicList != null)
                    {
                        int index = 0;
                        AttachmentPicBLL.Instance.DeleteByObjectId(entity.AdviseId);
                        foreach (var picitem in entity.AttachmentPicList)
                        {
                            if (picitem != null)
                            {
                                AttachmentPicEntity pic = new AttachmentPicEntity();
                                pic.PicId    = Util.NewUpperGuid();
                                pic.PicName  = picitem.PicName;
                                pic.SortNum  = index;
                                pic.ObjectId = entity.AdviseId;
                                pic.Type     = (int)RCHL.Model.Enums.AttachmentPicType.投诉建议;
                                AttachmentPicBLL.Instance.Add(pic);
                            }
                            index++;
                        }
                    }
                }

                result.IsSuccess = true;
                result.Message   = "提交成功";
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "ComplaintController>>Send";
                new ExceptionHelper().LogException(ex);
            }
            return(Json(result));
        }
예제 #2
0
        public ActionResult SaveForm(string keyValue, string json)
        {
            try
            {
                //反序列化
                var entity = Serializer.DeserializeJson <SchoolEntity>(json, true);
                if (entity != null)
                {
                    if (keyValue == "")
                    {
                        //int count = SchoolBLL.Instance.GetList(new SchoolEntity() { MasterAccount = entity.MasterAccount }).Count();
                        //if (count > 0)
                        //{
                        //    return Error("该管理账户已存在");
                        //}

                        entity.SchoolId   = Util.Util.NewUpperGuid();
                        entity.CreateTime = DateTime.Now;
                        entity.CreateId   = LoginUser.UserId;
                        entity.Content    = entity.Content == null ? "" : entity.Content.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");
                        entity.IsTraining = 1;
                        if (SchoolBLL.Instance.Add(entity))
                        {
                            if (entity.SubjectList != null)
                            {
                                SubjectBLL.Instance.DeleteByschoolId(entity.SchoolId);
                                foreach (var subjectItem in entity.SubjectList)
                                {
                                    SubjectEntity subject = new SubjectEntity();
                                    subject.SubjectId   = Util.Util.NewUpperGuid();
                                    subject.ItemId      = subjectItem.ItemId;
                                    subject.SubjectName = subjectItem.SubjectName;
                                    subject.Price       = subjectItem.Price;
                                    subject.SchoolId    = entity.SchoolId;
                                    subject.SchoolName  = entity.Name;
                                    subject.Remark      = subjectItem.Remark;
                                    subject.CreateId    = DateTime.Now.ToString();
                                    SubjectBLL.Instance.Add(subject);
                                }
                            }
                            if (entity.AttachmentPicList != null)
                            {
                                int index = 0;
                                AttachmentPicBLL.Instance.DeleteByObjectId(entity.SchoolId);
                                foreach (var picitem in entity.AttachmentPicList)
                                {
                                    if (picitem != null)
                                    {
                                        AttachmentPicEntity pic = new AttachmentPicEntity();
                                        pic.PicId    = Util.Util.NewUpperGuid();
                                        pic.PicName  = picitem.PicName;
                                        pic.SortNum  = index;
                                        pic.ObjectId = entity.SchoolId;
                                        pic.Type     = (int)RCHL.Model.Enums.AttachmentPicType.考场;
                                        AttachmentPicBLL.Instance.Add(pic);
                                    }
                                    index++;
                                }
                            }
                            if (entity.TagList != null)
                            {
                                TagBLL.Instance.DeleteByObjectId(entity.SchoolId);
                                foreach (var tagitem in entity.TagList)
                                {
                                    if (tagitem != null)
                                    {
                                        TagEntity tag = new TagEntity();
                                        tag.TagId      = Util.Util.NewUpperGuid();
                                        tag.ObjectId   = entity.SchoolId;
                                        tag.ObjectName = entity.Name;
                                        tag.Value      = tagitem.Value;
                                        tag.CreateId   = LoginUser.UserId;
                                        tag.CreateTime = DateTime.Now;
                                        TagBLL.Instance.Add(tag);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        //修改
                        entity.SchoolId = keyValue;
                        entity.Content  = entity.Content == null ? "" : entity.Content.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");
                        if (SchoolBLL.Instance.Update(entity))
                        {
                            if (entity.SubjectList != null)
                            {
                                //SubjectBLL.Instance.DeleteByschoolId(entity.SchoolId);
                                foreach (var subjectItem in entity.SubjectList)
                                {
                                    var subject = SubjectBLL.Instance.GetEntity(subjectItem.SubjectId);
                                    if (subject != null)
                                    {
                                        subject.ItemId      = subjectItem.ItemId;
                                        subject.SubjectName = subjectItem.SubjectName;
                                        subject.Price       = subjectItem.Price;
                                        subject.SchoolId    = entity.SchoolId;
                                        subject.SchoolName  = entity.Name;
                                        subject.Remark      = subjectItem.Remark;
                                        SubjectBLL.Instance.Update(subject);
                                    }
                                    else
                                    {
                                        subject             = new SubjectEntity();
                                        subject.SubjectId   = Util.Util.NewUpperGuid();
                                        subject.ItemId      = subjectItem.ItemId;
                                        subject.SubjectName = subjectItem.SubjectName;
                                        subject.Price       = subjectItem.Price;
                                        subject.SchoolId    = entity.SchoolId;
                                        subject.SchoolName  = entity.Name;
                                        subject.Remark      = subjectItem.Remark;
                                        subject.CreateId    = DateTime.Now.ToString();
                                        SubjectBLL.Instance.Add(subject);
                                    }
                                }
                            }
                            if (entity.AttachmentPicList != null)
                            {
                                int index = 0;
                                AttachmentPicBLL.Instance.DeleteByObjectId(entity.SchoolId);
                                foreach (var picitem in entity.AttachmentPicList)
                                {
                                    if (picitem != null)
                                    {
                                        AttachmentPicEntity pic = new AttachmentPicEntity();
                                        pic.PicId    = Util.Util.NewUpperGuid();
                                        pic.PicName  = picitem.PicName;
                                        pic.SortNum  = index;
                                        pic.ObjectId = entity.SchoolId;
                                        pic.Type     = (int)RCHL.Model.Enums.AttachmentPicType.考场;
                                        AttachmentPicBLL.Instance.Add(pic);
                                    }
                                    index++;
                                }
                            }
                            if (entity.TagList != null)
                            {
                                TagBLL.Instance.DeleteByObjectId(entity.SchoolId);
                                foreach (var tagitem in entity.TagList)
                                {
                                    if (tagitem != null)
                                    {
                                        TagEntity tag = new TagEntity();
                                        tag.TagId      = Util.Util.NewUpperGuid();
                                        tag.ObjectId   = entity.SchoolId;
                                        tag.ObjectName = entity.Name;
                                        tag.Value      = tagitem.Value;
                                        tag.CreateId   = LoginUser.UserId;
                                        tag.CreateTime = DateTime.Now;
                                        TagBLL.Instance.Add(tag);
                                    }
                                }
                            }
                        }
                    }
                }
                return(Success("保存成功"));
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "AccountController>>Register";
                new ExceptionHelper().LogException(ex);
                return(Error("保存失败"));
            }
        }
예제 #3
0
 public ActionResult SaveForm(string keyValue, string json)
 {
     try
     {
         //反序列化
         var entity = Serializer.DeserializeJson <ShopCarEntity>(json, true);
         if (entity != null)
         {
             if (keyValue == "")
             {
                 entity.ShopCarId  = Util.Util.NewUpperGuid();
                 entity.CreateTime = DateTime.Now;
                 entity.CreateId   = LoginUser.UserId;
                 entity.Content    = entity.Content == null ? "" : entity.Content.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");
                 if (ShopCarBLL.Instance.Add(entity))
                 {
                     if (entity.AttachmentPicList != null)
                     {
                         int index = 0;
                         AttachmentPicBLL.Instance.DeleteByObjectId(entity.ShopCarId);
                         foreach (var picitem in entity.AttachmentPicList)
                         {
                             if (picitem != null)
                             {
                                 AttachmentPicEntity pic = new AttachmentPicEntity();
                                 pic.PicId    = Util.Util.NewUpperGuid();
                                 pic.PicName  = picitem.PicName;
                                 pic.SortNum  = index;
                                 pic.ObjectId = entity.ShopCarId;
                                 pic.Type     = (int)RCHL.Model.Enums.AttachmentPicType.商城汽车;
                                 AttachmentPicBLL.Instance.Add(pic);
                             }
                             index++;
                         }
                     }
                 }
             }
             else
             {
                 //修改
                 entity.ShopCarId = keyValue;
                 entity.Content   = entity.Content == null ? "" : entity.Content.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");
                 if (ShopCarBLL.Instance.Update(entity))
                 {
                     if (entity.AttachmentPicList != null)
                     {
                         int index = 0;
                         AttachmentPicBLL.Instance.DeleteByObjectId(entity.ShopCarId);
                         foreach (var picitem in entity.AttachmentPicList)
                         {
                             if (picitem != null)
                             {
                                 AttachmentPicEntity pic = new AttachmentPicEntity();
                                 pic.PicId    = Util.Util.NewUpperGuid();
                                 pic.PicName  = picitem.PicName;
                                 pic.SortNum  = index;
                                 pic.ObjectId = entity.ShopCarId;
                                 pic.Type     = (int)RCHL.Model.Enums.AttachmentPicType.商城汽车;
                                 AttachmentPicBLL.Instance.Add(pic);
                             }
                             index++;
                         }
                     }
                 }
             }
         }
         return(Success("保存成功"));
     }
     catch (Exception ex)
     {
         ex.Data["Method"] = "ShopCarController>>SaveForm";
         new ExceptionHelper().LogException(ex);
         return(Error("保存失败"));
     }
 }
예제 #4
0
        public ActionResult SaveForm(string keyValue, AuditOrganizationEntity entity)
        {
            try
            {
                var result = new ReturnMessage(false)
                {
                    Message = "编辑失败!"
                };
                if (string.IsNullOrWhiteSpace(entity.Name))
                {
                    result.Message = "名称不能为空";
                    return(Json(result));
                }
                if (keyValue == "")
                {
                    entity.OrganizationId = Util.Util.NewUpperGuid();
                    entity.CreateTime     = DateTime.Now;
                    entity.CreateId       = LoginUser.UserId;
                    entity.Content        = entity.Content == null ? "" : entity.Content.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");
                    entity.PriceContent   = entity.PriceContent == null ? "" : entity.PriceContent.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");
                    AuditOrganizationBLL.Instance.Add(entity);
                    if (entity.ImageListStr != null)
                    {
                        //删除
                        AttachmentPicBLL.Instance.DeleteByObjectId(entity.OrganizationId);
                        //插入
                        var imags = JsonConvert.DeserializeObject <List <string> >(entity.ImageListStr);
                        int index = 0;
                        foreach (string item in imags)
                        {
                            if (item != "")
                            {
                                AttachmentPicEntity pic = new AttachmentPicEntity();
                                pic.PicId    = Util.Util.NewUpperGuid();
                                pic.PicName  = item;
                                pic.SortNum  = index;
                                pic.ObjectId = entity.OrganizationId;
                                pic.Type     = (int)RCHL.Model.Enums.AttachmentPicType.年检机构;
                                AttachmentPicBLL.Instance.Add(pic);
                            }
                            index++;
                        }
                    }
                }
                else
                {
                    entity.OrganizationId = keyValue;
                    entity.Content        = entity.Content == null ? "" : entity.Content.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");
                    entity.PriceContent   = entity.PriceContent == null ? "" : entity.PriceContent.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");
                    AuditOrganizationBLL.Instance.Update(entity);
                    if (entity.ImageListStr != null)
                    {
                        //删除
                        AttachmentPicBLL.Instance.DeleteByObjectId(entity.OrganizationId);
                        //插入
                        var imags = JsonConvert.DeserializeObject <List <string> >(entity.ImageListStr);
                        int index = 0;
                        foreach (string item in imags)
                        {
                            if (item != "")
                            {
                                AttachmentPicEntity pic = new AttachmentPicEntity();
                                pic.PicId    = Util.Util.NewUpperGuid();
                                pic.PicName  = item;
                                pic.SortNum  = index;
                                pic.ObjectId = entity.OrganizationId;
                                pic.Type     = (int)RCHL.Model.Enums.AttachmentPicType.年检机构;
                                AttachmentPicBLL.Instance.Add(pic);
                            }
                            index++;
                        }
                    }
                }

                return(Success("保存成功"));
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "AuditOrganizationController>>Register";
                new ExceptionHelper().LogException(ex);
                return(Error("保存失败"));
            }
        }
예제 #5
0
        public ActionResult SaveForm(string keyValue, string json)
        {
            try
            {
                //反序列化
                var entity = Serializer.DeserializeJson <ProductEntity>(json, true);
                if (entity != null)
                {
                    if (keyValue == "")
                    {
                        entity.ProductId          = Util.Util.NewUpperGuid();
                        entity.CreateTime         = DateTime.Now;
                        entity.ProductStatus      = (int)Trade.Model.Enums.ProductStatus.架;
                        entity.AuditStatus        = (int)Trade.Model.Enums.AuditStatus.已审核;
                        entity.ProductDescription = entity.ProductDescription == null ? "" : entity.ProductDescription.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");

                        if (ProductBLL.Instance.Add(entity))
                        {
                            if (entity.AttachmentPicList != null)
                            {
                                int index = 0;
                                AttachmentPicBLL.Instance.DeleteByObjectId(entity.ProductId);
                                foreach (var picitem in entity.AttachmentPicList)
                                {
                                    if (picitem != null)
                                    {
                                        AttachmentPicEntity pic = new AttachmentPicEntity();
                                        pic.PicId    = Util.Util.NewUpperGuid();
                                        pic.PicName  = picitem.PicName;
                                        pic.SortNum  = index;
                                        pic.ObjectId = entity.ProductId;
                                        pic.Type     = (int)Trade.Model.Enums.AttachmentPicType.产品;
                                        AttachmentPicBLL.Instance.Add(pic);
                                    }
                                    index++;
                                }
                            }
                            if (entity.RuleList != null)
                            {
                                ProductRuleBLL.Instance.DeleteByObjectId(entity.ProductId);
                                foreach (var ruleitem in entity.RuleList)
                                {
                                    if (ruleitem != null)
                                    {
                                        ProductRuleEntity rule = new ProductRuleEntity();
                                        rule.RuleId    = Util.Util.NewUpperGuid();
                                        rule.ProductId = entity.ProductId;
                                        rule.RuleName  = ruleitem.RuleName;
                                        rule.Price     = ruleitem.Price;
                                        ProductRuleBLL.Instance.Add(rule);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        //修改
                        entity.ProductId          = keyValue;
                        entity.ProductDescription = entity.ProductDescription == null ? "" : entity.ProductDescription.Replace("&amp;", "&").Replace("&gt;", ">").Replace("&lt;", "<");
                        if (ProductBLL.Instance.Update(entity))
                        {
                            if (entity.AttachmentPicList != null)
                            {
                                int index = 0;
                                AttachmentPicBLL.Instance.DeleteByObjectId(entity.ProductId);
                                foreach (var picitem in entity.AttachmentPicList)
                                {
                                    if (picitem != null)
                                    {
                                        AttachmentPicEntity pic = new AttachmentPicEntity();
                                        pic.PicId    = Util.Util.NewUpperGuid();
                                        pic.PicName  = picitem.PicName;
                                        pic.SortNum  = index;
                                        pic.ObjectId = entity.ProductId;
                                        pic.Type     = (int)Trade.Model.Enums.AttachmentPicType.产品;
                                        AttachmentPicBLL.Instance.Add(pic);
                                    }
                                    index++;
                                }
                            }
                            if (entity.RuleList != null)
                            {
                                ProductRuleBLL.Instance.DeleteByObjectId(entity.ProductId);
                                foreach (var ruleitem in entity.RuleList)
                                {
                                    if (ruleitem != null)
                                    {
                                        ProductRuleEntity rule = new ProductRuleEntity();
                                        rule.RuleId    = Util.Util.NewUpperGuid();
                                        rule.ProductId = entity.ProductId;
                                        rule.RuleName  = ruleitem.RuleName;
                                        rule.Price     = ruleitem.Price;
                                        ProductRuleBLL.Instance.Add(rule);
                                    }
                                }
                            }
                        }
                    }
                }
                return(Success("保存成功"));
            }
            catch (Exception ex)
            {
                ex.Data["Method"] = "ProductController>>Save";
                new ExceptionHelper().LogException(ex);
                return(Error("保存失败"));
            }
        }