Example #1
0
        public ActionResult Edit(string contactId)
        {
            IList <Global.Common.Models.ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll();

            //事项分类
            Global.Common.Models.ParamModel caseType = paramList.SingleOrDefault(m => m.ParamCode.Equals(Constants.SysParamType.ContactCaseType));
            ViewBag.CaseType = new SelectList(caseType.itemsList, "ParamItemValue", "ParamItemName");

            //公司名称
            Global.Common.Models.ParamModel company = paramList.SingleOrDefault(t => t.ParamCode == Constants.SysParamType.CompanyInfo);
            if (null == company)
            {
                company = new Global.Common.Models.ParamModel();
            }
            Global.Common.Models.ParamItemModel companyInfo = company.itemsList.SingleOrDefault(s => s.ParamItemName.Equals("公司名称"));

            ContactModel model = null;

            if (contactId == "0")
            {
                model             = new ContactModel();
                model.CompanyName = companyInfo == null ? "" : companyInfo.ParamItemValue;
            }
            else
            {
                model = ServiceProvider.ContactService.GetById(UtilsHelper.Decrypt2Int(contactId));
                IList <BusinessAttachmentModel> businessAttachList = ServiceProvider.BusinessAttachmentService.GetByBusinessTypeAndId(Constants.AttachmentBusinessType.联络单.GetHashCode(), model.ContactId);
                if (businessAttachList.Count > 0 && businessAttachList.First() != null)
                {
                    ViewBag.FileId   = UtilsHelper.Encrypt(businessAttachList.First().FileId.ToString());
                    ViewBag.FileName = businessAttachList.First().FileName;
                }
            }
            return(View(model));
        }
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="knowledgeIds"></param>
        /// <returns></returns>
        public ActionResult BatchDeleteByIds(string knowledgeIds)
        {
            IList <int> idLsit = knowledgeIds.Split(',').Select(k => UtilsHelper.Decrypt2Int(k)).ToList();

            ServiceProvider.KnowledgesService.DeleteByIdList(idLsit);
            return(Content("OK"));
        }
Example #3
0
        public string SaveBussinessLogFile(FormCollection form, string FKValue, int?FKType, string LogConent)
        {
            int FKvalueInt = 0;

            if (!string.IsNullOrEmpty(FKValue))
            {
                FKvalueInt = UtilsHelper.Decrypt2Int(FKValue);
            }
            //记录日志
            Sys_BusinessLogModel businessLog = new Sys_BusinessLogModel()
            {
                FKValue    = FKvalueInt,                                                          //外键标识
                FKType     = FKType.Value,                                                        //外键类别
                CreateUser = LoginHelper.LoginUser.UserName,                                      //创建人
                Creator    = LoginHelper.LoginUser.UserId,                                        //创建人标识
                LogConent  = LogConent == null ? "" : UtilsHelper.SpecialCharValidate(LogConent), //日志描述
                FileId     = -1,                                                                  //文件标识
                FileName   = "",                                                                  //文件名称
                CreateDate = DateTime.Now                                                         //创建时间
            };

            SaveLogandAttach(businessLog);

            return("OK");
        }
Example #4
0
        public ActionResult Solve(string contactId)
        {
            ContactModel model = new ContactModel();

            model.ContactId = UtilsHelper.Decrypt2Int(contactId);
            model.State     = Constants.ContactState.已解决.GetHashCode();
            ServiceProvider.ContactService.UpdateState(model);

            return(Content("OK"));
        }
Example #5
0
        /// <summary>
        /// 获取一条数据
        /// </summary>
        /// <param name="craftId"></param>
        /// <returns></returns>
        public ActionResult GetCraftById(string craftId)
        {
            CraftModel model = ServiceProvider.CraftService.GetById(UtilsHelper.Decrypt2Int(craftId));

            if (model == null)
            {
                model = new CraftModel();
            }
            return(Json(new { model = model }, JsonRequestBehavior.AllowGet));
        }
Example #6
0
        public ActionResult Send(string contactId)
        {
            ContactModel model = ServiceProvider.ContactService.GetById(UtilsHelper.Decrypt2Int(contactId));

            //同步到业务系统
            IList <BusinessAttachmentModel> businessAttachList = ServiceProvider.BusinessAttachmentService.GetByBusinessTypeAndId(Constants.AttachmentBusinessType.联络单.GetHashCode(), model.ContactId);

            byte[]          fileData = new byte[0];
            string          fileName = "";
            AttachmentModel attach   = null;

            if (businessAttachList.Count > 0 && businessAttachList.First() != null)
            {
                attach = Global.Business.ServiceProvider.AttachmentService.GetById(businessAttachList.First().FileId);
                if (attach != null)
                {
                    Stream fileStream = UtilsHelper.FileDownload(attach.FileAccessPrefix, attach.FileVirtualPath, (UtilConstants.ServerType)attach.FileServerType);
                    fileData = new byte[fileStream.Length];
                    fileStream.Read(fileData, 0, (int)fileStream.Length);
                    fileName = attach.FileName + Path.GetExtension(attach.FileVirtualPath);
                }
            }
            model.State = Constants.ContactState.已提交.GetHashCode();

            IList <ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll();
            ParamModel         pCaseType = paramList.SingleOrDefault(p => p.ParamCode.Equals(Common.Constants.SysParamType.ContactCaseType));

            if (pCaseType == null)
            {
                pCaseType = new ParamModel();
            }
            ParamItemModel itemCaseType = null;

            itemCaseType      = pCaseType.itemsList.SingleOrDefault(c => c.ParamItemValue.Equals(model.CaseType.ToString()));
            model.CaseTypeStr = itemCaseType == null ? "" : itemCaseType.ParamItemName;

            string jsonData = WSProvider.EbusinessProvider.SynInsertContact(ToolsLib.Utility.CommonUtils.JsonSerialize(model), fileData, fileName, Global.Business.ServiceProvider.ParamService.GetaccessToken(Instrument.Common.Constants.SysParamType.CompanyInfo));
            Dictionary <string, object> dic = ToolsLib.Utility.CommonUtils.JsonDeserialize(jsonData, typeof(Dictionary <string, object>)) as Dictionary <string, object>;

            if (dic["Msg"].ToString() == "OK")
            {
                ServiceProvider.ContactService.UpdateState(model);
            }
            return(Content(dic["Msg"].ToString()));
        }
Example #7
0
        public ActionResult LoadArea4dhtmlxTree(string userId)
        {
            int tempUserId = UtilsHelper.Decrypt2Int(userId);
            IList <ParamItemModel> ownList = ServiceProvider.SalesService.GetSaleOwnAreaByUserId(tempUserId);// Utils.LoginUser.saleAreaList;

            if (LoginHelper.IsSuperAdmin)
            {
                ownList = Global.Business.ServiceProvider.ParamService.GetByCode(GlobalConstants.SysParamType.SaleAreaCode).itemsList;
            }

            ContentResult cr = new ContentResult();

            cr.ContentType     = "text/xml";
            cr.ContentEncoding = Encoding.UTF8;
            cr.Content         = ServiceProvider.SalesService.GetOwnSaleAreadhtmlxTree(ownList);

            return(cr);
        }
Example #8
0
        public ActionResult Detail(string contactId)
        {
            IList <Global.Common.Models.ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll();
            ContactModel model = ServiceProvider.ContactService.GetById(UtilsHelper.Decrypt2Int(contactId));

            //事项分类
            Global.Common.Models.ParamModel caseType = paramList.SingleOrDefault(m => m.ParamCode.Equals(Constants.SysParamType.ContactCaseType));
            ParamItemModel item = caseType.itemsList.SingleOrDefault(p => p.ParamItemValue.Equals(model.CaseType.ToString()));

            ViewBag.CaseType = item.ParamItemName;
            IList <BusinessAttachmentModel> businessAttachList = ServiceProvider.BusinessAttachmentService.GetByBusinessTypeAndId(Constants.AttachmentBusinessType.联络单.GetHashCode(), model.ContactId);

            if (businessAttachList.Count > 0 && businessAttachList.First() != null)
            {
                ViewBag.FileId   = UtilsHelper.Encrypt(businessAttachList.First().FileId.ToString());
                ViewBag.FileName = businessAttachList.First().FileName;
            }
            return(View(model));
        }
Example #9
0
        public ActionResult UploadBusinessAttachment(int businessType, string businessKeyId, string businessNumber, FormCollection collection)
        {
            BusinessAttachmentModel model = new BusinessAttachmentModel();

            try
            {
                //是否需要自动解压缩
                bool isExtract = collection["isExtract"] == null ? false : true;

                model.BusinessType  = businessType;
                model.BusinessKeyId = UtilsHelper.Decrypt2Int(businessKeyId);
                model.UserName      = LoginHelper.LoginUser.UserName;
                //获取后缀名
                string Extension = System.IO.Path.GetExtension(Request.Files[0].FileName).ToLower();
                if (isExtract)
                {
                    switch (Extension)
                    {
                    case ".zip":
                    case ".bz":
                    case ".gz":
                        ServiceProvider.BusinessAttachmentService.UploadBusinessAttachmentbyExtract(businessNumber, model, Request.Files);
                        break;

                    default:
                        ServiceProvider.BusinessAttachmentService.UploadBusinessAttachment(businessNumber, model, Request.Files);
                        break;
                    }
                }
                else
                {
                    ServiceProvider.BusinessAttachmentService.UploadBusinessAttachment(businessNumber, model, Request.Files);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                return(Content(ex.Message + "_-1"));
            }
            return(Content("OK_" + model.FileId));
        }
Example #10
0
        /// <summary>
        /// 记录日志列表
        /// </summary>
        /// <returns></returns>
        public ActionResult RecordLog(int FKType)
        {
            string URL = Request.RawUrl;
            //截取参数(参数中含有特殊字符)
            int    index    = URL.IndexOf('?') + 1;
            string paramstr = URL.Substring(index, URL.Length - index);
            //先用&将参数分组
            var pramas = paramstr.Split('&');
            //再用=号将参数分组
            var pramas2 = pramas[0].Split('=');
            //解密
            int FKvalueInt = 0;

            if (!string.IsNullOrEmpty(pramas2[1]))
            {
                FKvalueInt = UtilsHelper.Decrypt2Int(pramas2[1]);
            }
            ViewBag.FKValue = pramas2[1];
            ViewBag.FKType  = FKType;
            return(View("RecordLog"));
        }
        public ActionResult ReadCert(string Id)
        {
            int certId = UtilsHelper.Decrypt2Int(Id);

            Global.Common.Models.AttachmentModel model = Global.Business.ServiceProvider.AttachmentService.GetById(certId);
            string tempPath      = "/tempFile/";
            string tempFileName  = string.Format("{0}.swf", Guid.NewGuid().ToString());
            string webFileServer = WebUtils.GetSettingsValue("WebFileServer");
            string userId        = WebUtils.GetSettingsValue("WebFileServerUser");
            string pwd           = WebUtils.GetSettingsValue("WebFileServerPwd");
            string oldFileSwf    = model.FileVirtualPath.Replace(".pdf", ".swf");

            try
            {
                if (!UtilsHelper.IsExistInFSServer(webFileServer, oldFileSwf, userId, pwd))
                {
                    if (UtilsHelper.IsExistInFSServer(webFileServer, model.FileVirtualPath, userId, pwd))
                    {
                        Stream swfStream  = UtilsHelper.FileDownload(model.FileAccessPrefix, model.FileVirtualPath, UtilConstants.ServerType.WebFileService);
                        string pdfFilestr = CommonUtils.GetPhysicsPath(string.Format("{0}{1}.pdf", tempPath, Guid.NewGuid()));
                        ToolsLib.FileService.NormalFile.SaveInfoToFile(swfStream, pdfFilestr);
                        string swfSourceFile = UtilsHelper.PdfToSwf(pdfFilestr, tempFileName);
                        model.FileVirtualPath = string.Format("{0}{1}", tempPath, Path.GetFileName(swfSourceFile));
                        UtilsHelper.FileUpload(model.FileAccessPrefix, swfSourceFile, oldFileSwf, UtilConstants.ServerType.WebFileService);
                    }
                }
                else
                {
                    Stream swfStream  = UtilsHelper.FileDownload(model.FileAccessPrefix, oldFileSwf, UtilConstants.ServerType.WebFileService);
                    string swfFilestr = CommonUtils.GetPhysicsPath(string.Format("{0}{1}", tempPath, tempFileName));
                    ToolsLib.FileService.NormalFile.SaveInfoToFile(swfStream, swfFilestr);
                    model.FileVirtualPath = string.Format("{0}{1}", tempPath, tempFileName);
                }
            }
            catch (Exception e)
            {
                return(Content("浏览的文件已经顺坏或者加密"));
            }
            return(RedirectToAction("ReadPdf", "SysManage/Common", new { filePath = model.FileVirtualPath }));
        }
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="knowledgeId"></param>
        /// <returns></returns>
        public ActionResult Edit(string knowledgeId)
        {
            KnowledgesModel model = new KnowledgesModel();

            if (knowledgeId != "0")
            {
                model = ServiceProvider.KnowledgesService.GetById(UtilsHelper.Decrypt2Int(knowledgeId));
            }
            //内容类型
            IList <Global.Common.Models.ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll();

            Global.Common.Models.ParamModel kType = paramList.SingleOrDefault(m => m.ParamCode.Equals(UtilConstants.SysParamType.KnowledgeType));
            ViewBag.KType = new SelectList(kType.itemsList, "ParamItemValue", "ParamItemName");

            if (model.FileId != 0)
            {
                AttachmentModel attach = Global.Business.ServiceProvider.AttachmentService.GetById(model.FileId);
                ViewBag.FileName = attach.FileName;
            }

            return(View(model));
        }
Example #13
0
        //
        // GET: /Organization/Details/5

        public ActionResult Details(int orgId, string parentId)
        {
            //int _orgid = Convert.ToInt32(UtilsHelper.Decrypt(orgId));
            int      _parentId = UtilsHelper.Decrypt2Int(parentId);
            OrgModel thisOrg   = new OrgModel {
                ParentOrgId = _parentId
            };
            OrgModel parentOrg = ServiceProvider.OrgService.GetById(_parentId);

            if (parentOrg == null)
            {
                parentOrg = new OrgModel();
            }
            if (orgId == 0)
            {
                thisOrg.OrgCode = ServiceProvider.OrgService.BuildSubOrgCode(_parentId);//自动填充子组织编号
            }
            else
            {
                thisOrg = ServiceProvider.OrgService.GetById(orgId);
            }

            ViewBag.ParentOrg = parentOrg;

            return(View("OrgDetail", thisOrg));



            //Convert.ToInt32(UtilsHelper.Decrypt(orgId))
            //OrgModel ParentOrg = ServiceProvider.OrgService.GetById(Convert.ToInt32(UtilsHelper.Decrypt(parentId.ToString())));
            //OrgModel thisOrg = ServiceProvider.OrgService.GetById(orgId);

            //以下为获取部门领导名称

            //return View("OrgDetail", thisOrg);
        }
Example #14
0
        public ActionResult SynContact(string contactId)
        {
            ContactModel model = ServiceProvider.ContactService.GetById(UtilsHelper.Decrypt2Int(contactId));
            //获取客户关系数据
            string jsonData = WSProvider.EbusinessProvider.GetContactByItemCode(model.ItemCode, Global.Business.ServiceProvider.ParamService.GetaccessToken(Instrument.Common.Constants.SysParamType.CompanyInfo));
            Dictionary <string, object> dic = ToolsLib.Utility.CommonUtils.JsonDeserialize(jsonData, typeof(Dictionary <string, object>)) as Dictionary <string, object>;

            if (dic["Msg"].ToString() == "OK")
            {
                Hashtable temContact = ToolsLib.Utility.CommonUtils.JsonDeserialize(dic["Data"].ToString(), typeof(Hashtable)) as Hashtable;
                model.FeedbackContent = string.Format("{0}", temContact["FeedbackContent"]);
                if (temContact["FeedbackDate"] == null)
                {
                    model.FeedbackDate = null;
                }
                else
                {
                    model.FeedbackDate = Convert.ToDateTime(temContact["FeedbackDate"]);
                }
                model.State = Convert.ToInt32(temContact["State"]);
                ServiceProvider.ContactService.UpdateFeedback(model);
            }
            return(Content(dic["Msg"].ToString()));
        }
Example #15
0
        public string GetOrderBusinessLog(string FKValue, int FKType)
        {
            //解密
            int FKvalueInt = 0;

            if (!string.IsNullOrEmpty(FKValue))
            {
                FKvalueInt = UtilsHelper.Decrypt2Int(FKValue);
            }

            //获取日志记录列表
            IList <Sys_BusinessLogModel> businessLogList = Global.Business.ServiceProvider.Sys_BusinessLogService.GetByFKValue(FKvalueInt, FKType);

            businessLogList = businessLogList.OrderByDescending(o => o.CreateDate).ToList();
            //姓名、时间、备注、附件(点击即下载)
            StringBuilder sb = new StringBuilder();

            sb.Append("{\"data\":[");
            foreach (var business in businessLogList)
            {
                int index = businessLogList.IndexOf(business);
                sb.AppendFormat("[\"{0}\"", index + 1);
                sb.AppendFormat(",\"<input type='checkbox' name='chk' LogId='{0}'></input> \"", business.LogId);
                sb.AppendFormat(",\"{0}\"", business.CreateUser);
                sb.AppendFormat(",\"{0}\"", business.CreateDate);
                sb.AppendFormat(",\"{0}\"", UtilsHelper.SpecialCharValidate(business.LogConent));
                sb.AppendFormat(",\"{0}\"", business.FileName == "" ? "" : string.Format("<a onclick='fnDownload(this)' FileId='{1}' >{0}</a>", business.FileName, UtilsHelper.Encrypt(business.FileId.ToString())));  //附件
                sb.Append("],");
            }
            sb.Append("]}");
            if (businessLogList.Count > 0)
            {
                sb.Remove(sb.Length - 3, 1);
            }
            return(sb.ToString());
        }
Example #16
0
        public string GetBusinessAttachmentList4Detail(int attachmentType, string bkId)
        {
            IList <BusinessAttachmentModel> attachmentList = new List <BusinessAttachmentModel>();

            if (bkId != "0")
            {
                attachmentList = ServiceProvider.BusinessAttachmentService.GetByBusinessTypeAndId(attachmentType, UtilsHelper.Decrypt2Int(bkId));
            }
            StringBuilder sb = new StringBuilder();

            sb.Insert(0, "{\"data\":[");
            int count = 0;

            foreach (var item in attachmentList)
            {
                sb.AppendFormat("[\"{0}\"", ++count);
                sb.AppendFormat(",\"<a href='/SysManage/Attachment/DownLoad?fileId={0}'>{1}</a>\"", UtilsHelper.Encrypt(item.FileId.ToString()), item.FileName);
                sb.AppendFormat(",\"{0}\"", string.IsNullOrWhiteSpace(item.Remark) ? string.Empty : item.Remark.Replace("\r", "").Replace("\n", ""));

                sb.Append("],");
            }

            if (attachmentList.Count > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            sb.Append("]}");

            return(sb.ToString());
        }
        /// <summary>
        /// 知识库明细
        /// </summary>
        /// <param name="knowledgeId"></param>
        /// <returns></returns>
        public ActionResult Details(string knowledgeId)
        {
            KnowledgesModel model = ServiceProvider.KnowledgesService.GetKnowledgeDetailInfo(UtilsHelper.Decrypt2Int(knowledgeId));
            //内容类型
            IList <Global.Common.Models.ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll();

            Global.Common.Models.ParamModel kType = paramList.SingleOrDefault(m => m.ParamCode.Equals(UtilConstants.SysParamType.KnowledgeType));
            ViewBag.KType = kType.itemsList.FirstOrDefault(s => s.ParamItemValue == String.Format("{0}", model.KType)).ParamItemName;

            //业务附件
            StringBuilder sb = new StringBuilder();

            sb.Append("[");
            if (model.swfFileByte != null && model.swfFileByte.Length > 0)
            {
                string swfFilePath = "/tempFile/" + Guid.NewGuid().ToString() + ".swf";
                ToolsLib.FileService.NormalFile.SaveInfoToFile(model.swfFileByte, swfFilePath);
                ViewBag.FilePath = swfFilePath;
            }
            else
            {
                ViewBag.FilePath = "";
            }
            int i = 1;

            if (model.businessAttachList != null)
            {
                foreach (Hashtable item in model.businessAttachList)
                {
                    sb.Append("[");
                    sb.AppendFormat("\"{0}\"", i++);
                    sb.AppendFormat(",\"<a href='#' onclick='fnDownLoad(this);' data-id='{0}'>{1}</a>\"", UtilsHelper.Encrypt(String.Format("{0}", item["FileId"])), item["FileName"]);
                    sb.Append("],");
                }
                if (model.businessAttachList.Count > 0)
                {
                    sb.Remove(sb.Length - 1, 1);
                }
            }
            sb.Append("]");
            ViewBag.Data = sb.ToString();
            return(View(model));
        }
Example #18
0
 public ActionResult Delete(string contactId)
 {
     ServiceProvider.ContactService.DeleteById(UtilsHelper.Decrypt2Int(contactId));
     return(Content("OK"));
 }
Example #19
0
        public string GetBusinessAttachmentList(int attachmentType, string bkId)
        {
            IList <BusinessAttachmentModel> attachmentList = new List <BusinessAttachmentModel>();

            if (bkId != "0")
            {
                attachmentList = ServiceProvider.BusinessAttachmentService.GetByBusinessTypeAndId(attachmentType, UtilsHelper.Decrypt2Int(bkId));
            }
            StringBuilder sb = new StringBuilder();

            sb.Insert(0, "{\"data\":[");
            int count = 0;

            foreach (var item in attachmentList)
            {
                count++;
                sb.AppendFormat("[\"<input type='checkbox' name='chk{0}' value='{1}|{2}|{3}' />\"", item.BusinessType, item.Id, item.FileId, 0);
                sb.AppendFormat(",\"{0}\"", count);

                sb.AppendFormat(",\"<a href='/SysManage/Attachment/DownLoad?fileId={0}'> {1}</a>\"", UtilsHelper.Encrypt(item.FileId.ToString()), item.FileName);
                sb.AppendFormat(",\" <input class='long_width' id='Remark{0}' type='text'  value='{1}' />&nbsp;&nbsp;<a href='#' onclick='fnUpdateAttachmentRemark({0})'>更新</a>\"", item.Id, string.IsNullOrWhiteSpace(item.Remark) ? string.Empty : item.Remark.Replace("\r", "").Replace("\n", ""));

                sb.Append("],");
            }

            if (attachmentList.Count > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            sb.Append("]}");

            return(sb.ToString());
        }
        public string GetFlowDetails(string instrumentId)
        {
            IList <Common.Models.InstrumentFlowModel> flowList = ServiceProvider.InstrumentFlowService.GetByInstrumentId(UtilsHelper.Decrypt2Int(instrumentId));
            StringBuilder sbData = new StringBuilder();

            sbData.Append("{\"data\":[");
            foreach (var item in flowList)
            {
                sbData.Append("[");
                sbData.AppendFormat("\"{0}\"", string.IsNullOrEmpty(item.Reason) ? "" : item.Reason);
                sbData.AppendFormat(",\"{0}\"", item.Place);
                sbData.AppendFormat(",\"{0}\"", item.Creator);
                sbData.AppendFormat(",\"{0:yyyy-MM-dd HH:mm:ss}\"", item.CreateDate);
                sbData.Append("],");
            }
            if (flowList.Count > 0)
            {
                sbData.Remove(sbData.Length - 1, 1);
            }
            sbData.Append("]}");
            return(sbData.ToString());
        }