/// <summary>
        /// 获取知识库
        /// </summary>
        /// <returns></returns>
        public JsonResult GetAllKnowledgeListJsonData()
        {
            //提取DataTable参数
            DataTableUtils.DataTableModel dtm = DataTableUtils.GetJquerydataTableParams();
            //构造输入参数
            PagingModel paging = new PagingModel();

            paging.PageSize    = dtm.PageSize;
            paging.PageCurrent = dtm.PageIndex;
            paging.Where       = string.IsNullOrWhiteSpace(dtm.FieldCondition) ? "1=1" : dtm.FieldCondition;
            IList <Hashtable> knowledgeList = ServiceProvider.KnowledgesService.GetAllKnowledgesListForPaging(paging);
            //系统参数
            IList <Global.Common.Models.ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll();
            ParamModel pState = paramList.SingleOrDefault(p => p.ParamCode.Equals(UtilConstants.SysParamType.KnowledgeState));
            ParamModel pType  = paramList.SingleOrDefault(p => p.ParamCode.Equals(UtilConstants.SysParamType.KnowledgeType));

            //Json数据格式组装
            dtm.iTotalRecords        = paging.RecordCount;
            dtm.iTotalDisplayRecords = dtm.iTotalRecords;
            dtm.aaData = new List <List <string> >();

            StringBuilder operate = new StringBuilder();

            foreach (var item in knowledgeList)
            {
                dtm.aaData.Add(new List <string>());
                string knowledgeId = UtilsHelper.Encrypt(item["KnowledgeId"].ToString());
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("<input type='checkbox' name='chk' value='{0}'>", knowledgeId));
                operate.AppendFormat("<div knowledgeId='{0}'>", knowledgeId);
                if (LoginHelper.LoginUserAuthorize.Contains("/CustKnowledge/Edit".ToLower()))
                {
                    operate.AppendFormat("<a href='#' onclick='fnEdit(this)'>编辑</a>&nbsp;|&nbsp;");
                }
                if (LoginHelper.LoginUserAuthorize.Contains("/CustKnowledge/Details".ToLower()))
                {
                    operate.AppendFormat("<a href='#' onclick='fnDetail(this)'>查看</a>");
                }
                operate.Append("</div>");

                dtm.aaData[dtm.aaData.Count - 1].Add(operate.ToString());
                operate.Clear();
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["Title"]));
                ParamItemModel itemModel = pType.itemsList.SingleOrDefault(p => p.ParamItemValue.Equals(item["KType"].ToString()));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", itemModel == null ? "" : itemModel.ParamItemName));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["Abstract"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["Creator"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:yyyy-MM-dd}", item["CreatDate"]));
            }

            JsonResult jr = Json(new
            {
                sEcho                = dtm.sEcho,
                iTotalRecords        = dtm.iTotalRecords,
                iTotalDisplayRecords = dtm.iTotalDisplayRecords,
                aaData               = dtm.aaData
            }, JsonRequestBehavior.AllowGet);

            return(jr);
        }
Exemple #2
0
        /// <summary>
        /// 根据机构名字模糊查找
        /// </summary>
        /// <param name="input">搜索条件</param>
        /// <returns></returns>
        public IList <Hashtable> SearchByName(string input, int id)
        {
            ParamItemModel paramItem = new ParamItemModel {
                ParamItemName = input, ParamId = id
            };

            return(DBProvider.dbMapper.SelectList <Hashtable>("Sys_ParamItems.SearchByName", paramItem));
        }
        public JsonResult GetOperateLogListJsonData()
        {
            //提取DataTable参数
            DataTableUtils.DataTableModel dtm = DataTableUtils.GetJquerydataTableParams();
            //构造输入参数
            PagingModel paging = new PagingModel();

            paging.PageSize    = dtm.PageSize;
            paging.PageCurrent = dtm.PageIndex;
            paging.FieldShow   = "OperateType,Operator,OperateDate,OperateIP,OperateContent,TargetPK,TargetType";
            paging.Where       = "1=1";
            if (!string.IsNullOrWhiteSpace(dtm.FieldCondition))
            {
                paging.Where = dtm.FieldCondition;
            }
            //paging.Where = string.Format(" 1 = 1 and {0}", dtm.FieldCondition);
            if (!string.IsNullOrEmpty(dtm.KeyWord))
            {
                paging.Where = string.Format("{0} and (Operator like '%{1}%' or OperateContent like '%{1}%' or TargetType like '%{1}%')", paging.Where, dtm.KeyWord);
            }

            IList <ParamModel> paramAllList     = Global.Business.ServiceProvider.ParamService.GetAll();
            ParamModel         operateTypeParam = paramAllList.SingleOrDefault(S => S.ParamCode == UtilConstants.SysParamType.OperateType);
            ParamItemModel     item             = null;

            //数据库查询数据
            IList <Hashtable> operateList = ServiceProvider.OperateLogService.GetAllOperateLogListForPaging(paging);

            //Json数据格式组装
            dtm.iTotalRecords        = paging.RecordCount;
            dtm.iTotalDisplayRecords = dtm.iTotalRecords;
            dtm.aaData = new List <List <string> >();
            StringBuilder sb      = new StringBuilder();
            string        orderId = string.Empty;

            foreach (Hashtable row in operateList)
            {
                dtm.aaData.Add(new List <string>());
                item = operateTypeParam.itemsList.SingleOrDefault(p => p.ParamItemValue.Equals(row["OperateType"].ToString()));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item == null?"":item.ParamItemName));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", row["Operator"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", row["OperateIP"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", row["OperateContent"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", row["TargetPK"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", (UtilConstants.TargetType)Convert.ToInt32(row["TargetType"])));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:yyyy-MM-dd HH:mm:ss}", row["OperateDate"]));
            }
            JsonResult jr = Json(new
            {
                sEcho                = dtm.sEcho,
                iTotalRecords        = dtm.iTotalRecords,
                iTotalDisplayRecords = dtm.iTotalDisplayRecords,
                aaData               = dtm.aaData
            }, JsonRequestBehavior.AllowGet);

            return(jr);
        }
Exemple #4
0
        public ActionResult ItemDetails(int paramId, int itemId)
        {
            ParamItemModel model = ServiceProvider.ParamItemService.GetById(itemId);

            if (model == null)
            {
                model = new ParamItemModel();
            }
            UpdateModel(model);
            return(View("ParamItemDetail", model));
        }
Exemple #5
0
        /// <summary>
        /// 判断是否存在指定的参数项值
        /// </summary>
        /// <param name="paramItemId">要排除比较的参数项的Id</param>
        /// <param name="paramId">参数项所属的分类的Id</param>
        /// <param name="paramItemValue">要比较的值</param>
        /// <returns></returns>
        public int IsExistParamItemValue(int paramItemId, int paramId, string paramItemValue)
        {
            ParamItemModel comparedModel = new ParamItemModel()
            {
                ParamItemId    = paramItemId,
                ParamId        = paramId,
                ParamItemValue = paramItemValue
            };

            return(DBProvider.dbMapper.SelectObject <int>("Sys_ParamItems.IsExistParamItemValue", comparedModel));
        }
Exemple #6
0
 /// <summary>
 /// 保存实体数据.
 /// </summary>
 public void Save(ParamItemModel model)
 {
     if (model.ParamItemId == 0)
     {
         DBProvider.ParamItemDAO.Add(model);
     }
     else
     {
         DBProvider.ParamItemDAO.Update(model);
     }
 }
Exemple #7
0
 public string SaveParamItem(ParamItemModel model)
 {
     try
     {
         Save(model);
         return("OK");
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }
Exemple #8
0
        /// <summary>
        /// 获取公司编号
        /// </summary>
        /// <param name="CompanyInfo"></param>
        /// <returns></returns>
        public string GetCompanyCode(string CompanyInfo)
        {
            IList <ParamModel> paramList = ServiceProvider.ParamService.GetAll();
            ParamModel         company   = paramList.SingleOrDefault(t => t.ParamCode == CompanyInfo);

            if (null == company)
            {
                company = new Global.Common.Models.ParamModel();
            }
            ParamItemModel pCompany = company.itemsList.SingleOrDefault(s => s.ParamItemName.Equals("公司编号"));

            return(pCompany == null ? "" : pCompany.ParamItemValue);
        }
Exemple #9
0
        /// <summary>
        /// 获取accessToken
        /// </summary>
        /// <returns></returns>
        public string GetaccessToken(string CompanyInfo)
        {
            IList <Global.Common.Models.ParamModel> paramList = ServiceProvider.ParamService.GetAll();
            ParamModel company = paramList.SingleOrDefault(t => t.ParamCode == CompanyInfo);

            if (null == company)
            {
                company = new Global.Common.Models.ParamModel();
            }
            ParamItemModel pCompany = company.itemsList.SingleOrDefault(s => s.ParamItemName.Equals("公司编号"));
            ParamItemModel Pwd      = company.itemsList.SingleOrDefault(s => s.ParamItemName.Equals("密码"));

            return(SSOHelper.Encrypt(string.Format("{0}|{1}", pCompany == null ? "" : pCompany.ParamItemValue, Pwd == null ? "" : Pwd.ParamItemValue)));
        }
Exemple #10
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()));
        }
Exemple #11
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));
        }
Exemple #12
0
        public string GetCetificationList(string barCode, string accessToKen)
        {
            try
            {
                if (!ToKenHelper.CheckAccessToKen(accessToKen))
                {
                    return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = commonErrorMsg }));
                }

                InstrumentModel instrumentModel = ServiceProvider.InstrumentService.GetByBarCode(barCode);
                if (instrumentModel == null)
                {
                    return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = "不存在该设备!" }));
                }
                IList <InstrumentCertificationModel> certList = ServiceProvider.InstrumentCertificationService.GetByInstrumentId(instrumentModel.InstrumentId);
                if (certList.Count < 1)
                {
                    return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = "周检记录为空!" }));
                }
                ////系统参数
                IList <ParamModel>     paramList          = Global.Business.ServiceProvider.ParamService.GetAll();
                IList <ParamItemModel> CertificationState = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.InstrumentCertificationState).itemsList;
                ParamItemModel         mParamItem         = new ParamItemModel();
                for (int i = 0; i < certList.Count; i++)
                {
                    mParamItem = CertificationState.SingleOrDefault(c => c.ParamItemValue == string.Format("{0}", certList[i].RecordState));
                    certList[i].RecordStateName = mParamItem == null ? string.Empty : mParamItem.ParamItemName;
                }
                return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = "OK", Data = certList }));
            }
            catch (Exception ex)
            {
                log.Error(ex);
                return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = ex.Message }));
            }
        }
Exemple #13
0
        public JsonResult GetAllContactJsonData()
        {
            //查询标准器具
            DataTableUtils.DataTableModel dtm = DataTableUtils.GetJquerydataTableParams();
            PagingModel paging = new PagingModel();

            paging.PageSize    = dtm.PageSize;
            paging.PageCurrent = dtm.PageIndex;
            paging.FieldShow   = @"ContactId,CompanyName,CaseType,Abstract,State,ContactContent,FeedbackContent,FeedbackDate,Creator,CreatId,CreatDate,ItemCode";
            paging.Where       = string.IsNullOrWhiteSpace(dtm.FieldCondition) ? dtm.FieldCondition = "1=1" : dtm.FieldCondition;
            IList <Hashtable> contractList = Instrument.Business.ServiceProvider.ContactService.GetAllContactListForPaging(paging);
            ////系统参数
            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;

            //Json数据格式组装
            dtm.iTotalRecords        = paging.RecordCount;
            dtm.iTotalDisplayRecords = dtm.iTotalRecords;
            dtm.aaData = new List <List <string> >();
            StringBuilder sbOperate = new StringBuilder();

            foreach (var item in contractList)
            {
                dtm.aaData.Add(new List <string>());
                sbOperate.Clear();    //操作
                sbOperate.AppendFormat("<div contactId='{0}' >", UtilsHelper.Encrypt(item["ContactId"].ToString()));
                int state = Convert.ToInt32(item["State"]);
                if (state.Equals(Common.Constants.ContactState.草稿.GetHashCode()))
                {
                    if (LoginHelper.LoginUserAuthorize.ContainsKey("新增联络单-修改"))
                    {
                        sbOperate.Append("<a href='#' onclick='fnEditContact(this);'>编辑</a>&nbsp;&nbsp;");
                    }
                    if (LoginHelper.LoginUserAuthorize.ContainsKey("/Contact/Delete".ToLower()))
                    {
                        sbOperate.Append("<a href='#' onclick='fnDeleteContact(this);'>删除</a>&nbsp;&nbsp;");
                    }
                    if (LoginHelper.LoginUserAuthorize.ContainsKey("/Contact/Send".ToLower()))
                    {
                        sbOperate.Append("<a href='#' onclick='fnSendContact(this);'>提交</a>&nbsp;&nbsp;");
                    }
                }
                if (!state.Equals(Common.Constants.ContactState.草稿.GetHashCode()))
                {
                    if (LoginHelper.LoginUserAuthorize.ContainsKey("/Contact/Detail".ToLower()))
                    {
                        sbOperate.Append("<a href='#' onclick='fnViewContact(this);'>查看</a>&nbsp;&nbsp;");
                    }
                }
                if (state.Equals(Common.Constants.ContactState.已提交.GetHashCode()))
                {
                    if (LoginHelper.LoginUserAuthorize.ContainsKey("/Contact/SynContact".ToLower()))
                    {
                        sbOperate.Append("<a href='#' onclick='fnSynContact(this);'>更新同步</a>&nbsp;&nbsp;");
                    }
                }
                if (state.Equals(Common.Constants.ContactState.已反馈.GetHashCode()))
                {
                    if (LoginHelper.LoginUserAuthorize.ContainsKey("/Contact/Solve".ToLower()))
                    {
                        sbOperate.Append("<a href='#' onclick='fnSolveContact(this);'>解决</a>&nbsp;&nbsp;");
                    }
                }
                sbOperate.Append("</div>");
                dtm.aaData[dtm.aaData.Count - 1].Add(sbOperate.ToString());
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["CompanyName"]));
                //事项分类
                itemCaseType = pCaseType.itemsList.SingleOrDefault(p => p.ParamItemValue.Equals(item["CaseType"].ToString()));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", itemCaseType == null ? "" : itemCaseType.ParamItemName));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["Abstract"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(((Constants.ContactState)Convert.ToInt32(item["State"])).ToString());    //状态
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:yyyy-MM-dd}", item["FeedbackDate"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["Creator"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:yyyy-MM-dd}", item["CreatDate"]));
            }
            JsonResult jr = Json(new
            {
                sEcho                = dtm.sEcho,
                iTotalRecords        = dtm.iTotalRecords,
                iTotalDisplayRecords = dtm.iTotalDisplayRecords,
                aaData               = dtm.aaData
            }, JsonRequestBehavior.AllowGet);

            return(jr);
        }
        public JsonResult GetAllInstrumentJsonData()
        {
            //查询标准器具
            DataTableUtils.DataTableModel dtm = DataTableUtils.GetJquerydataTableParams();
            PagingModel paging = new PagingModel();

            paging.PageSize    = dtm.PageSize;
            paging.PageCurrent = dtm.PageIndex;
            paging.FieldShow   = @"InstrumentId,RecordState,InstrumentName,ManageNo,CertificateNo,Specification,InstrumentCate,Manufacturer,SerialNo,DueStartDate,DueEndDate,LeaderName,BelongDepart,StorePalce,CreateDate,CreateUser";
            paging.Where       = GetSearchCondition(dtm);
            IList <Hashtable> instrumentList = ServiceProvider.InstrumentService.GetAllInstrumentListForPaging(paging);
            //系统参数
            IList <ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll();

            IList <OrgModel> orgList         = Global.Business.ServiceProvider.OrgService.GetAll();
            OrgModel         belongDeptModel = new OrgModel();
            ParamItemModel   mInstrumentCate = null;
            //分类
            ParamModel             InstrumentCate = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.InstrumentCate); //设备分类
            IList <ParamItemModel> paramItemList  = InstrumentCate.itemsList;

            //Json数据格式组装
            dtm.iTotalRecords        = paging.RecordCount;
            dtm.iTotalDisplayRecords = dtm.iTotalRecords;
            dtm.aaData = new List <List <string> >();
            StringBuilder sbOperate = new StringBuilder();

            foreach (var item in instrumentList)
            {
                dtm.aaData.Add(new List <string>());
                sbOperate.Clear();    //操作
                sbOperate.AppendFormat("<div instrumentId='{0}' instrumentName='{1}'>", UtilsHelper.Encrypt(item["InstrumentId"].ToString()), item["InstrumentName"]);
                if (LoginHelper.LoginUserAuthorize.ContainsKey("/InstrumentFlow/FlowDetails".ToLower()))
                {
                    //详细
                    sbOperate.Append("<a href='#' onclick='fnInstrumentFlowDetail(this);'>流转明细</a>&nbsp;&nbsp;");
                }

                sbOperate.Append("</div>");
                dtm.aaData[dtm.aaData.Count - 1].Add(sbOperate.ToString());
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["InstrumentName"])); //仪器名称
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["Specification"]));  //型号
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["SerialNo"]));       //出厂编号
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["ManageNo"]));       //管理编号
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["CertificateNo"]));  //证书编号

                mInstrumentCate = paramItemList.SingleOrDefault(t => t.ParamItemValue == Convert.ToString(item["InstrumentCate"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(mInstrumentCate == null ? "" : mInstrumentCate.ParamItemName);
                //分公司
                belongDeptModel = orgList.SingleOrDefault(o => o.OrgCode == string.Format("{0}", item["BelongDepart"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(belongDeptModel == null ? "" : belongDeptModel.OrgName);
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:d}", item["DueStartDate"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0}", item["LeaderName"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:d}", item["CreateUser"]));
            }
            JsonResult jr = Json(new
            {
                sEcho                = dtm.sEcho,
                iTotalRecords        = dtm.iTotalRecords,
                iTotalDisplayRecords = dtm.iTotalDisplayRecords,
                aaData               = dtm.aaData
            }, JsonRequestBehavior.AllowGet);

            return(jr);
        }
Exemple #15
0
        public void ExportOverTimeAndWarnList(int state, int day)
        {
            StringBuilder                   sqlWhere     = new StringBuilder();
            ParamItemModel                  mParamItem   = new ParamItemModel();
            IList <ParamItemModel>          overTimeList = new List <ParamItemModel>();
            IList <InstrumentWaitSendModel> preSendList  = new List <InstrumentWaitSendModel>();

            if (state == 0)
            {
                sqlWhere.AppendFormat("'{0:yyyy-MM-dd}'>DueEndDate and ManageLevel !='C' and RecordState={1}", DateTime.Now, UtilConstants.InstrumentState.过期禁用.GetHashCode());
                preSendList = ServiceProvider.InstrumentWaitSendService.GetByUserId(LoginHelper.LoginUser.UserId);
            }
            if (state == 1)
            {
                sqlWhere.AppendFormat("DueEndDate<='{0:yyyy-MM-dd}' and DueEndDate>='{1:yyyy-MM-dd}' and ManageLevel !='C'", DateTime.Now.AddDays(day), DateTime.Now);
            }
            IList <Instrument.Common.Models.InstrumentModel> instrumentList = ServiceProvider.InstrumentService.GetAllInstrumentListByWhere(sqlWhere.ToString());
            //数据列表
            DataTable dtData = new DataTable();

            if (state == 0)
            {
                dtData.Columns.Add("RecordState", typeof(string));    //仪器状态
                overTimeList = Global.Business.ServiceProvider.ParamService.GetAll().SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.InstrumentState).itemsList;
            }
            if (state == 1)
            {
                dtData.Columns.Add("WarnDay", typeof(string));    //预警天数
            }
            dtData.Columns.Add("InstrumentName", typeof(string)); //仪器名字
            dtData.Columns.Add("CertificateNo", typeof(string));  //证书编号
            dtData.Columns.Add("DueEndDate", typeof(string));     //到期日期
            dtData.Columns.Add("Specification", typeof(string));  //仪器型号
            dtData.Columns.Add("ManageNo", typeof(string));       //管理编号
            dtData.Columns.Add("SerialNo", typeof(string));       //出厂编号

            int      warnDay;
            DateTime dueEndDate;
            InstrumentWaitSendModel instrumentWaitSendModel = null;

            foreach (var item in instrumentList)
            {
                DataRow drData = dtData.NewRow();
                if (state == 0)
                {
                    instrumentWaitSendModel = preSendList.SingleOrDefault(i => i.InstrumentId.Equals(item.InstrumentId));
                    if (instrumentWaitSendModel != null)
                    {
                        continue;
                    }
                    mParamItem            = overTimeList.SingleOrDefault(c => c.ParamItemValue == string.Format("{0}", item.RecordState));
                    drData["RecordState"] = mParamItem == null ? "" : mParamItem.ParamItemName;
                }
                else
                {
                    if (!string.IsNullOrWhiteSpace(string.Format("{0}", item.DueEndDate)))
                    {
                        dueEndDate = Convert.ToDateTime(string.Format("{0:d}", item.DueEndDate));
                    }
                    else
                    {
                        dueEndDate = DateTime.MinValue;
                    }
                    warnDay           = (dueEndDate - Convert.ToDateTime(string.Format("{0:d}", DateTime.Now))).Days;
                    warnDay           = warnDay < 0 ? 0 : warnDay;
                    warnDay           = (dueEndDate - Convert.ToDateTime(string.Format("{0:d}", DateTime.Now))).Days;
                    warnDay           = warnDay < 0 ? 0 : warnDay;
                    drData["WarnDay"] = warnDay;
                }
                drData["InstrumentName"] = item.InstrumentName;
                drData["CertificateNo"]  = item.CertificateNo;
                drData["DueEndDate"]     = string.Format("{0:yyyy-MM-dd}", item.DueEndDate);
                drData["Specification"]  = item.Specification;
                drData["ManageNo"]       = item.ManageNo;
                drData["SerialNo"]       = item.SerialNo;
                dtData.Rows.Add(drData);
            }
            //导出
            string[] head = new string[] { "仪器状态", "仪器名称", "证书编号", "到期日期", "仪器型号", "管理编号", "出厂编号" };
            if (state == 1)
            {
                head[0] = "预警天数";
            }
            List <string> headerList = new List <string>(head);

            string result = ToolsLib.FileService.ExcelFile.WriteDataToExcel(headerList, dtData, "Sheet1", ToolsLib.LibConst.ExcelVersion.Excel2007);

            ToolsLib.FileService.WebServer.DownLoadFile(result, string.Format("{0:yyyyMMddHHmmss}仪器预警{1}", DateTime.Now, System.IO.Path.GetExtension(result)), true);
        }
Exemple #16
0
 /// <summary>
 /// 更新一条数据.
 /// </summary>
 public void Update(ParamItemModel model)
 {
     DBProvider.dbMapper.Update("Sys_ParamItems.Update", model);
 }
Exemple #17
0
 /// <summary>
 /// 增加一条数据.
 /// </summary>
 public void Add(ParamItemModel model)
 {
     DBProvider.dbMapper.Insert("Sys_ParamItems.Insert", model);
 }
        public JsonResult GetAllCertificationJsonData()
        {
            DataTableUtils.DataTableModel dtm = DataTableUtils.GetJquerydataTableParams();
            //string where = GetCertificationSearchCondition(dtm);
            PagingModel paging = new PagingModel();

            paging.PageSize          = dtm.PageSize;
            paging.PageCurrent       = dtm.PageIndex;
            dtm.iTotalDisplayRecords = dtm.iTotalRecords;
            paging.FieldShow         = @"LogId,InstrumentId,CertificationCode,FileId,CheckDate,EndDate,SendInstrumentDate,CheckResult,ErrorValue,RecordState,IsUseding,CertMoney,CreateDate,CreateUser";
            paging.Where             = string.IsNullOrWhiteSpace(dtm.FieldCondition) ? dtm.FieldCondition = "1=1" : dtm.FieldCondition;
            //是否超期
            string overTime = Request["searchIsOverTime"];

            if (!string.IsNullOrEmpty(overTime))
            {
                if (overTime == "0")
                {
                    paging.Where = string.Format("{0} and {1}", paging.Where, "GetDate()<=EndDate");//未超期
                }
                else
                {
                    paging.Where = string.Format("{0} and {1}", paging.Where, "GetDate()>EndDate");//已超期
                }
            }
            //是否上传报告
            string UpdateReport = Request["searchIsUpdateReport"];

            if (!string.IsNullOrEmpty(UpdateReport))
            {
                paging.Where = string.Format("{0} and {1}", paging.Where, UpdateReport == "0" ? "(FileId IS null or FileId=0)" : "FileId>0");
            }

            //添加委托单查询条件.
            string orderParam = Request["InstrumentParam"];

            if (!string.IsNullOrWhiteSpace(orderParam))
            {
                orderParam = string.Format(" and {0}", orderParam);
            }
            paging.Where = string.Format("{0} and (InstrumentId In (Select InstrumentId From Instrument_BaseInfo Where {2}{1}))", paging.Where, orderParam, GetManageCondition("InstrumentForm=0 "));

            DateTime                dueEndDate;
            bool                    isOverTime = false;
            IList <Hashtable>       instrumentCertificationList = ServiceProvider.InstrumentCertificationService.GetInstrumentCertificationListForPaging(paging);
            IList <int>             instrumentIds  = instrumentCertificationList.Select(s => Convert.ToInt32(s["InstrumentId"])).Distinct().ToList();
            IList <InstrumentModel> instrumentList = ServiceProvider.InstrumentService.GetByIds(instrumentIds);

            dtm.iTotalRecords        = paging.RecordCount;
            dtm.iTotalDisplayRecords = dtm.iTotalRecords;

            ////系统参数
            IList <ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll();

            Global.Common.Models.OrgModel               belongDeptModel = new Global.Common.Models.OrgModel();
            Global.Common.Models.ParamItemModel         mInstrumentCate = null;
            IList <Global.Common.Models.ParamItemModel> paramItemList   = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.InstrumentCate).itemsList;
            ///周检状态
            IList <ParamItemModel> CertificationState = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.InstrumentCertificationState).itemsList;
            ParamItemModel         mParamItem         = new ParamItemModel();

            StringBuilder sbData = new StringBuilder();

            dtm.aaData = new List <List <string> >();
            foreach (var item in instrumentCertificationList)
            {
                InstrumentModel instrumentModel = instrumentList.SingleOrDefault(p => p.InstrumentId == Convert.ToInt32(item["InstrumentId"]));
                if (instrumentModel == null)
                {
                    instrumentModel = new InstrumentModel();
                }
                if (item["EndDate"] == null)
                {
                    isOverTime = true;
                }
                else
                {
                    dueEndDate = Convert.ToDateTime(string.Format("{0:d}", item["EndDate"]));
                    //是否过期
                    isOverTime = DateTime.Now.CompareTo(dueEndDate) > 0 ? true : false;
                }
                dtm.aaData.Add(new List <string>());
                sbData.Clear();
                sbData.AppendFormat("<a href='#' onclick='fnDetails({0})'>详细</a>&nbsp;&nbsp;", item["LogId"]);
                if (item["FileId"] != null)
                {
                    sbData.Append("<a href='#' onclick='fnDownFile(\"" + UtilsHelper.Encrypt(item["FileId"].ToString()) + "\");'>下 载</a>&nbsp;&nbsp;");
                    //sbData.Append(string.Format("<a href='/Certification/ReadCert?Id={1}' target='_blank' >{0}</a>","浏 览", UtilsHelper.Encrypt(item["FileId"].ToString())));
                }
                dtm.aaData[dtm.aaData.Count - 1].Add(sbData.ToString());
                mParamItem = CertificationState.SingleOrDefault(c => c.ParamItemValue == string.Format("{0}", item["RecordState"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(mParamItem == null ? "" : mParamItem.ParamItemName);                    //状态
                dtm.aaData[dtm.aaData.Count - 1].Add(isOverTime ? "已超期" : "未超期");                                            //证书超期
                dtm.aaData[dtm.aaData.Count - 1].Add(item["FileId"] == null || item["FileId"].ToString() == "" ? "否" : "是"); //是否上传证书
                dtm.aaData[dtm.aaData.Count - 1].Add(item["EndDate"] == null ? null : string.Format("{0:yyyy-MM-dd}", item["EndDate"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(item["CertificationCode"] == null ? "" : item["CertificationCode"].ToString());
                dtm.aaData[dtm.aaData.Count - 1].Add(string.Format("{0:F2}", item["CertMoney"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(instrumentModel.InstrumentName);
                mInstrumentCate = paramItemList.SingleOrDefault(t => t.ParamItemValue == Convert.ToString(instrumentModel.InstrumentCate));
                dtm.aaData[dtm.aaData.Count - 1].Add(mInstrumentCate == null ? "" : mInstrumentCate.ParamItemName);
                dtm.aaData[dtm.aaData.Count - 1].Add(instrumentModel.ManageNo);
                dtm.aaData[dtm.aaData.Count - 1].Add(instrumentModel.Specification);
                dtm.aaData[dtm.aaData.Count - 1].Add(instrumentModel.SerialNo);
                dtm.aaData[dtm.aaData.Count - 1].Add(item["CheckDate"] == null ? null : string.Format("{0:yyyy-MM-dd}", item["CheckDate"]));

                dtm.aaData[dtm.aaData.Count - 1].Add(item["CheckResult"] == null ? null : item["CheckResult"].ToString());
                dtm.aaData[dtm.aaData.Count - 1].Add(item["ErrorValue"] == null ? null : item["ErrorValue"].ToString());

                dtm.aaData[dtm.aaData.Count - 1].Add(item["CreateDate"] == null ? null : string.Format("{0:yyyy-MM-dd}", item["CreateDate"]));
                dtm.aaData[dtm.aaData.Count - 1].Add(item["CreateUser"] == null ? null : item["CreateUser"].ToString());
            }
            JsonResult jr = Json(new
            {
                sEcho                = dtm.sEcho,
                iTotalRecords        = dtm.iTotalRecords,
                iTotalDisplayRecords = dtm.iTotalDisplayRecords,
                aaData               = dtm.aaData,
            }, JsonRequestBehavior.AllowGet);

            return(jr);
        }
        public ActionResult Export()
        {
            DataTable dtData = new DataTable();

            DataTableUtils.DataTableModel dtm = DataTableUtils.GetJquerydataTableParams();
            string where = GetCertificationSearchCondition(dtm);
            string Where = string.IsNullOrWhiteSpace(dtm.FieldCondition) ? dtm.FieldCondition = "1=1" : dtm.FieldCondition;
            //是否超期
            string overTime = Request["searchIsOverTime"];

            if (!string.IsNullOrEmpty(overTime))
            {
                if (overTime == "0")
                {
                    Where = string.Format("{0} and {1}", Where, "GetDate()<=EndDate");//未超期
                }
                else
                {
                    Where = string.Format("{0} and {1}", Where, "GetDate()>EndDate");//已超期
                }
            }
            //添加委托单查询条件.
            string orderParam = Request["InstrumentParam"];

            if (!string.IsNullOrWhiteSpace(orderParam))
            {
                orderParam = string.Format(" and {0}", orderParam);
            }
            if (!string.IsNullOrWhiteSpace(orderParam))
            {
                Where = string.Format("{0} and (InstrumentId In (Select InstrumentId From Instrument_BaseInfo Where {2}{1}))", Where, orderParam, GetManageCondition("InstrumentForm=0 "));
            }

            IList <InstrumentCertificationModel> instrumentCertificationList = ServiceProvider.InstrumentCertificationService.GetByWhere(Where);
            IList <int>             instrumentIds  = instrumentCertificationList.Select(s => Convert.ToInt32(s.InstrumentId)).Distinct().ToList();
            IList <InstrumentModel> instrumentList = ServiceProvider.InstrumentService.GetByIds(instrumentIds);

            if (0 == instrumentCertificationList.Count)
            {
                Response.Write("没有要导出的内容。");
                Response.End();
                return(Content(""));
            }
            dtData.Columns.Add("RecordState", typeof(string));    //周检状态
            dtData.Columns.Add("IsOverTime", typeof(string));     //是否过期
            dtData.Columns.Add("CertificateNo", typeof(string));  //证书编号
            dtData.Columns.Add("CertMoney", typeof(string));      //费用
            dtData.Columns.Add("InstrumentName", typeof(string)); //仪器名称
            dtData.Columns.Add("ManageNo", typeof(string));       //管理编号
            dtData.Columns.Add("Specification", typeof(string));  //型号规格
            dtData.Columns.Add("SerialNo", typeof(string));       //出厂编号
            dtData.Columns.Add("CheckDate", typeof(string));      //检验日期
            dtData.Columns.Add("EndDate", typeof(string));        //有效日期
            dtData.Columns.Add("CheckResult", typeof(string));    //检测结果
            dtData.Columns.Add("ErrorValue", typeof(string));     //误 差
            dtData.Columns.Add("CreateDate", typeof(string));     //创建日期
            dtData.Columns.Add("CreateUser", typeof(string));     //创建人


            DateTime dueEndDate;
            bool     isOverTime = false;

            ////系统参数
            IList <ParamModel> paramList = Global.Business.ServiceProvider.ParamService.GetAll();
            ///周检状态
            IList <ParamItemModel> CertificationState = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.InstrumentCertificationState).itemsList;
            ParamItemModel         mParamItem         = new ParamItemModel();

            foreach (var item in instrumentCertificationList)
            {
                DataRow drData = dtData.NewRow();
                mParamItem            = CertificationState.SingleOrDefault(c => c.ParamItemValue == string.Format("{0}", item.RecordState));
                drData["RecordState"] = mParamItem == null ? "" : mParamItem.ParamItemName;   //周检状态
                InstrumentModel instrumentModel = instrumentList.SingleOrDefault(p => p.InstrumentId == Convert.ToInt32(item.InstrumentId));
                if (instrumentModel == null)
                {
                    instrumentModel = new InstrumentModel();
                }
                if (instrumentModel.DueEndDate == null)
                {
                    dueEndDate = DateTime.MinValue;
                }
                else
                {
                    dueEndDate = Convert.ToDateTime(string.Format("{0:d}", instrumentModel.DueEndDate));
                }
                if (item.EndDate == null)
                {
                    isOverTime = true;
                }
                else
                {
                    dueEndDate = Convert.ToDateTime(string.Format("{0:d}", item.EndDate));
                    //是否过期
                    isOverTime = DateTime.Now.CompareTo(dueEndDate) > 0 ? true : false;
                }
                //isOverTime = DateTime.Now.CompareTo(dueEndDate) > 0 ? true : false;
                drData["IsOverTime"]     = isOverTime ? "已超期" : "未超期";                                                        //是否过期
                drData["CertificateNo"]  = item.CertificationCode == null ? null : item.CertificationCode.ToString();         //证书编号
                drData["CertMoney"]      = string.Format("{0:F2}", item.CertMoney);
                drData["InstrumentName"] = instrumentModel.InstrumentName;                                                    //仪器名称
                drData["ManageNo"]       = instrumentModel.ManageNo;                                                          //管理编号
                drData["Specification"]  = instrumentModel.Specification;                                                     //型号规格
                drData["SerialNo"]       = instrumentModel.SerialNo;                                                          //出厂编号
                drData["CheckDate"]      = item.CheckDate == null ? null : string.Format("{0:yyyy-MM-dd}", item.CheckDate);   //检验日期
                drData["EndDate"]        = item.EndDate == null ? null : string.Format("{0:yyyy-MM-dd}", item.EndDate);       //有效日期
                drData["CheckResult"]    = item.CheckResult;                                                                  //检测结果
                drData["ErrorValue"]     = item.ErrorValue;                                                                   //误 差
                drData["CreateDate"]     = item.CreateDate == null ? null : string.Format("{0:yyyy-MM-dd}", item.CreateDate); //创建日期
                drData["CreateUser"]     = item.CreateUser;                                                                   //创建人
                dtData.Rows.Add(drData);
            }

            //导出
            List <string> headerList = new List <string>(new string[] {
                "周检状态", "是否过期", "证书编号", "费用", "仪器名称", "管理编号", "仪器型号", "出厂编号", "检验日期", "有效日期", "检测结果", "误 差", "创建日期", "创建人"
            });
            string result = ToolsLib.FileService.ExcelFile.WriteDataToExcel(headerList, dtData, "证书", ToolsLib.LibConst.ExcelVersion.Excel2007);

            ToolsLib.FileService.WebServer.DownLoadFile(result, string.Format("{0:yyyyMMddHHmmss}证书{1}", DateTime.Now, System.IO.Path.GetExtension(result)), true);
            return(Content("OK"));
        }
Exemple #20
0
        public string GetInstrumentDetailByBarCode(string barCode, string accessToKen)
        {
            try
            {
                if (!ToKenHelper.CheckAccessToKen(accessToKen))
                {
                    return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = commonErrorMsg }));
                }
                InstrumentModel model = ServiceProvider.InstrumentService.GetByBarCode(barCode);
                if (model == null)
                {
                    return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = "设备不存在!" }));
                }
                #region 数据处理
                IList <Global.Common.Models.OrgModel> orgList = Global.Business.ServiceProvider.OrgService.GetAll();
                Global.Common.Models.OrgModel         org     = orgList.SingleOrDefault(S => S.OrgCode == model.BelongDepart);
                //系统参数
                IList <ParamModel>     paramList          = Global.Business.ServiceProvider.ParamService.GetAll();
                IList <ParamItemModel> InstrumentCate     = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.InstrumentCate).itemsList;
                IList <ParamItemModel> CalibrationType    = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.CalibrationType).itemsList;
                IList <ParamItemModel> InstrumentType     = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.InstrumentType).itemsList;
                IList <ParamItemModel> RecordState        = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.InstrumentState).itemsList;
                IList <ParamItemModel> VerificationType   = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.VerificationType).itemsList;
                IList <ParamItemModel> AssetsState        = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.AssetsState).itemsList;
                IList <ParamItemModel> manageLevel        = paramList.SingleOrDefault(t => t.ParamCode == Instrument.Common.Constants.SysParamType.ManageLevel).itemsList;
                ParamItemModel         mInstrumentCate    = InstrumentCate.SingleOrDefault(p => p.ParamItemValue.Equals(model.InstrumentCate.ToString()));
                ParamItemModel         mSubInstrumentCate = InstrumentCate.SingleOrDefault(p => p.ParamItemValue.Equals(model.SubInstrumentCate.ToString()));
                ParamItemModel         mCalibrationType   = CalibrationType.SingleOrDefault(p => p.ParamItemValue.Equals(model.CalibrationType.ToString()));
                ParamItemModel         mInstrumentType    = InstrumentType.SingleOrDefault(p => p.ParamItemValue.Equals(model.InstrumentType.ToString()));
                ParamItemModel         mRecordState       = RecordState.SingleOrDefault(p => p.ParamItemValue.Equals(model.RecordState.ToString()));
                ParamItemModel         mAssetsState       = AssetsState.SingleOrDefault(p => p.ParamItemValue.Equals(model.RecordState.ToString()));
                ParamItemModel         mVerificationType  = VerificationType.SingleOrDefault(p => p.ParamItemValue.Equals(model.VerificationType.ToString()));
                ParamItemModel         mmanageLevel       = manageLevel.SingleOrDefault(p => p.ParamItemValue.Equals(string.IsNullOrEmpty(model.ManageLevel) ? "" : model.ManageLevel.ToString()));
                DateTime dueEndDate;
                bool     isOverTime = false;
                int      warnDay    = 0;
                if (!string.IsNullOrWhiteSpace(string.Format("{0}", model.DueEndDate)))
                {
                    dueEndDate = Convert.ToDateTime(string.Format("{0:d}", model.DueEndDate));
                }
                else
                {
                    dueEndDate = DateTime.MinValue;
                }
                //预警天数
                isOverTime = dueEndDate < Convert.ToDateTime(string.Format("{0:d}", DateTime.Now));
                warnDay    = (dueEndDate - Convert.ToDateTime(string.Format("{0:d}", DateTime.Now))).Days;
                warnDay    = warnDay < 0 ? 0 : warnDay;
                //超期无预警天数
                if (isOverTime)
                {
                    warnDay = 0;
                }

                IList <Hashtable> htList = new List <Hashtable>();
                Hashtable         ht     = new Hashtable();
                ht.Add("Name", model.InstrumentForm == Instrument.Common.Constants.InstrumentForm.仪器.GetHashCode() ? "仪器名称" : "资产名称");
                ht.Add("Value", string.Format("{0}", model.InstrumentName));
                htList.Add(ht);
                ht = new Hashtable();
                ht.Add("Name", model.InstrumentForm == Instrument.Common.Constants.InstrumentForm.仪器.GetHashCode() ? "仪器型号" : "型号规格");
                ht.Add("Value", string.Format("{0}", model.Specification));
                htList.Add(ht);
                if (model.InstrumentForm == Instrument.Common.Constants.InstrumentForm.仪器.GetHashCode())
                {
                    ht = new Hashtable();
                    ht.Add("Name", "证书超期");
                    ht.Add("Value", model.DueEndDate == null ? "" : isOverTime ? "已超期" : "未超期");
                    htList.Add(ht);
                    ht = new Hashtable();
                    ht.Add("Name", "超期预警");
                    ht.Add("Value", string.Format("{0}", (warnDay == 0) ? "无预警" : warnDay.ToString() + "天"));
                    htList.Add(ht);
                    ht = new Hashtable();
                    ht.Add("Name", "到期日期");
                    ht.Add("Value", model.DueEndDate == null ? string.Empty : DateTime.Parse(model.DueEndDate.ToString()).ToString("yyyy-MM-dd"));
                    htList.Add(ht);
                    ht = new Hashtable();
                    ht.Add("Name", "设备状态");
                    ht.Add("Value", string.Format("{0}", mRecordState == null ? string.Empty : mRecordState.ParamItemName));
                    htList.Add(ht);
                    ht = new Hashtable();
                    ht.Add("Name", "证书编号");
                    ht.Add("Value", string.Format("{0}", model.CertificateNo));
                    htList.Add(ht);
                    ht = new Hashtable();
                    ht.Add("Name", "校准日期");
                    ht.Add("Value", model.DueStartDate == null ? string.Empty : DateTime.Parse(model.DueStartDate.ToString()).ToString("yyyy-MM-dd"));
                    htList.Add(ht);
                    ht = new Hashtable();
                    ht.Add("Name", "管理级别");
                    ht.Add("Value", string.Format("{0}", mmanageLevel == null ? string.Empty : mmanageLevel.ParamItemName));
                    htList.Add(ht);
                    ht = new Hashtable();
                    ht.Add("Name", "校准周期");
                    ht.Add("Value", string.Format("{0}", model.InspectCycle));
                    htList.Add(ht);
                    ht = new Hashtable();
                }
                else
                {
                    ht = new Hashtable();
                    ht.Add("Name", "资产状态");
                    ht.Add("Value", string.Format("{0}", mAssetsState == null ? string.Empty : mAssetsState.ParamItemName));
                    htList.Add(ht);
                }
                ht = new Hashtable();
                ht.Add("Name", "管理编号");
                ht.Add("Value", string.Format("{0}", model.ManageNo));
                htList.Add(ht);
                ht = new Hashtable();
                ht.Add("Name", "资产编号");
                ht.Add("Value", string.Format("{0}", model.AssetsNo));
                htList.Add(ht);
                ht = new Hashtable();
                ht.Add("Name", "出厂编号");
                ht.Add("Value", string.Format("{0}", model.SerialNo));
                htList.Add(ht);
                ht = new Hashtable();
                ht.Add("Name", "所属部门");
                ht.Add("Value", string.Format("{0}", org == null ? string.Empty : org.OrgName));
                htList.Add(ht);
                if (model.InstrumentForm == Instrument.Common.Constants.InstrumentForm.仪器.GetHashCode())
                {
                    ht = new Hashtable();
                    ht.Add("Name", "设备分类");
                    ht.Add("Value", string.Format("{0}", mInstrumentCate == null ? string.Empty : mInstrumentCate.ParamItemName));
                    htList.Add(ht);
                    ht = new Hashtable();
                    ht.Add("Name", "设备子分类");
                    ht.Add("Value", string.Format("{0}", mSubInstrumentCate == null ? string.Empty : mSubInstrumentCate.ParamItemName));
                    htList.Add(ht);
                    ht = new Hashtable();
                    ht.Add("Name", "计量类别");
                    ht.Add("Value", string.Format("{0}", mVerificationType == null ? string.Empty : mVerificationType.ParamItemName));
                    htList.Add(ht);
                    ht = new Hashtable();
                    ht.Add("Name", "技术特征");
                    ht.Add("Value", string.Format("{0}", model.TechniqueCharacter));
                    htList.Add(ht);
                    ht = new Hashtable();
                    ht.Add("Name", "计量特性");
                    ht.Add("Value", string.Format("{0}", model.MeasureCharacter));
                    htList.Add(ht);
                    ht = new Hashtable();
                    ht.Add("Name", "存放地点");
                    ht.Add("Value", string.Format("{0}", model.StorePalce));
                    htList.Add(ht);
                    ht = new Hashtable();
                    ht.Add("Name", "设备类别");
                    ht.Add("Value", string.Format("{0}", mInstrumentType == null ? string.Empty : mInstrumentType.ParamItemName));
                    htList.Add(ht);
                }
                ht = new Hashtable();
                ht.Add("Name", "资产属性");
                ht.Add("Value", string.Format("{0}", mCalibrationType == null ? string.Empty : mCalibrationType.ParamItemName));
                htList.Add(ht);
                ht = new Hashtable();
                ht.Add("Name", "保管人");
                ht.Add("Value", string.Format("{0}", model.LeaderName));
                htList.Add(ht);
                ht = new Hashtable();
                ht.Add("Name", "存放地点");
                ht.Add("Value", string.Format("{0}", model.StorePalce));
                htList.Add(ht);
                ht = new Hashtable();
                ht.Add("Name", "购置日期");
                ht.Add("Value", model.BuyDate == null ? string.Empty : DateTime.Parse(model.BuyDate.ToString()).ToString("yyyy-MM-dd"));
                htList.Add(ht);
                ht = new Hashtable();
                ht.Add("Name", "购置金额");
                ht.Add("Value", string.Format("{0:F2}", model.Price));
                htList.Add(ht);
                ht = new Hashtable();
                ht.Add("Name", "生产厂家");
                ht.Add("Value", string.Format("{0}", model.Manufacturer));
                htList.Add(ht);
                ht = new Hashtable();
                ht.Add("Name", "联系信息");
                ht.Add("Value", string.Format("{0}", model.ManufactureContactor));
                htList.Add(ht);
                ht = new Hashtable();
                ht.Add("Name", "备注");
                ht.Add("Value", string.Format("{0}", model.Remark));
                htList.Add(ht);
                #endregion
                object result = new { Msg = "OK", Data = htList };
                return(ToolsLib.Utility.CommonUtils.JsonSerialize(result));
            }
            catch (Exception ex)
            {
                log.Error(ex);
                object msg = new { Msg = ex.Message };
                return(ToolsLib.Utility.CommonUtils.JsonSerialize(msg));
            }
        }
Exemple #21
0
 public ActionResult SaveItem(ParamItemModel model, FormCollection collection)
 {
     return(Content(ServiceProvider.ParamItemService.SaveParamItem(model)));
 }