Exemplo n.º 1
0
        //private static readonly int
        /// <summary>
        /// 获得某用户的菜单列表
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public static string GetMenu(ref Account account)
        {
            string menuCacheKey = MENU_CACHING_KEY + account.Id, roleCacheKey = ACCOUNT_ROLEIDS_CACHING_KEY + account.Id;
            string userMenu = string.Empty,dataSource = string.Empty;
            object menuFromCache = HttpRuntime.Cache.Get(menuCacheKey);
            object roldIdsFromCache = HttpRuntime.Cache.Get(roleCacheKey);
            if (menuFromCache == null)
            {
                IHomeBLL home = new HomeBLL();
                //account.roldids在GetMenuByAccount中赋值
                userMenu = home.GetMenuByAccount(ref account);
                dataSource = "menu data from db";
                HttpRuntime.Cache.Insert(menuCacheKey, userMenu);
                HttpRuntime.Cache.Insert(roleCacheKey, account.RoleIds );
            }
            else
            {

                account.RoleIds = (roldIdsFromCache != null) ? (List<string>)roldIdsFromCache : null;
                userMenu = menuFromCache.ToString();
                dataSource = "menu data from cache";
            }

            return userMenu + "<input type='hidden'  id='dataSource' value='" + dataSource + "' />";
        }
Exemplo n.º 2
0
        public bool HandleCommand(string command, List<string> args)
        {
            Account Acct = Program.AcctMgr.GetAccountByUsername(args[0]);
            if (Acct != null)
            {
                Log.Error("CreateAccount", "Username '" + args[0] + "' Already exist.");
                return false;
            }

            Log.Debug("CreateAccount", "1");

            Acct = new Account();
            Acct.Username = args[0].ToUpper();
            Acct.Sha_Password = MakePassword(args[1]);
            Acct.SessionKey = "";
            Acct.Email = "";

            Log.Debug("CreateAccount", "2");

            if (AccountMgr.AccountDB.AddObject(Acct))
                Log.Success("CreateAccount", "New Account : '" + Acct.Username + "'-'" + Acct.Sha_Password + "'");
            else
                Log.Error("CreateAccount", "Can not create account : " + Acct.Username);

            Log.Debug("CreateAccount", "3");

            return true;
        }
        public Common.ClientResult.Result Logon([FromBody] Langben.App.Models.LogonModel logonModel)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();

            if (ModelState.IsValid)
            {
                DAL.Account model = m_BLL.ValidateUser(logonModel.PersonName, logonModel.Password);
                if (model != null)
                {//登录成功
                    IBLL.IResumeBLL rBll    = new ResumeBLL();
                    var             data    = rBll.GetByAccountID(model.Id).FirstOrDefault();
                    Common.Account  account = new Common.Account();
                    account.Name     = model.Name;
                    account.Id       = model.Id;
                    account.ResumeId = data.Id;
                    Utils.WriteCookie("account", account, 7);
                    result.Code = Common.ClientCode.Succeed;
                }
                else
                {
                    result.Code = Common.ClientCode.FindNull;
                }
            }
            else
            {
                result.Code = Common.ClientCode.Fail;
            }
            return(result);
        }
Exemplo n.º 4
0
        public Common.ClientResult.Result ChaKan(string id)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            string returnValue = string.Empty;

            Common.Account account = GetCurrentAccount();
            var            data    = m_BLL.GetYuanShiJILu(ref validationErrors, id, account.UNDERTAKE_LABORATORYName);

            if (!string.IsNullOrWhiteSpace(data))
            {
                result.Code    = Common.ClientCode.Succeed;
                result.Message = data;
                return(result); //提示更新失败
            }
            else
            {
                if (validationErrors != null && validationErrors.Count > 0)
                {
                    validationErrors.All(a =>
                    {
                        returnValue += a.ErrorMessage;
                        return(true);
                    });
                }
                result.Code    = Common.ClientCode.Fail;
                result.Message = Suggestion.UpdateFail + returnValue;
                return(result); //提示更新失败
            }
        }
Exemplo n.º 5
0
        public Common.ClientResult.Result ChaKan(string id)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            string returnValue = string.Empty;

            Common.Account account = GetCurrentAccount();
            string         ID      = id.Split('|')[0];
            string         leixin  = id.Split('|')[1];
            var            data    = m_BLL.GetYuanShiJILu(ref validationErrors, ID, account.UNDERTAKE_LABORATORYName, leixin);

            if (!string.IsNullOrWhiteSpace(data))
            {
                result.Code    = Common.ClientCode.Succeed;
                result.Message = "../" + data;
                return(result); //提示更新失败
            }
            else
            {
                if (validationErrors != null && validationErrors.Count > 0)
                {
                    validationErrors.All(a =>
                    {
                        returnValue += a.ErrorMessage;
                        return(true);
                    });
                }
                result.Code    = Common.ClientCode.Fail;
                result.Message = "努力找啊找,发现尚未找到";
                return(result); //提示更新失败
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// This method is used to create a User, an account and the user's selected roles
        /// </summary>
        /// <param name="user">This parameter is of type User and holds all the details that need to be
        /// stored in the database</param>
        /// <param name="roles">This parameter consists of a List of type int and holds all the details that need to be
        /// stored in the database</param>
        /// <param name="a">This parameter is of type Account and holds all the details that need to be
        /// stored in the database</param>
        public void Create(Common.User user, List <int> roles, Common.Account a)
        {
            //RegistrationResult result = RegistrationResult.Successful;
            //Account checkAccount = this.getAccountByUsername(a.Username);
            //User checkEmail = this.getUserByEmail(user.Email);

            //if (checkAccount == null && checkEmail == null)
            //{
            foreach (int roleID in roles)
            {
                Role r = new DARole(entities).GetRoleByID(roleID);
                a.Role.Add(r);
            }

            //Account ac = this.getAccountByUsername(a.Username);
            //user.AccountID = ac.ID;
            new DAUser(this.entities).Create(user);
            //    result = RegistrationResult.Successful;
            //}
            //else
            //{
            //    if (checkAccount != null)
            //    {
            //        result = RegistrationResult.usernameExists;
            //    }
            //    else
            //    {
            //        result = RegistrationResult.EmailExists;
            //    }
            //}
            //return result;
        }
Exemplo n.º 7
0
        public ActionResult CreateUser(RegistrationModel model)
        {
            if (model.Password.ToString().Length < 6)
            {
                ViewBag.Message = "Password length must be at least 6 characters.";
            }
            else if (new UserAccountServ.UserAccountClient().GetAccountByUsername(model.Username.ToString()) != null)
            {
                ModelState.AddModelError("", "Username taken.");
                ViewBag.Message = "Username already taken.";
            }
            else if (new UserAccountServ.UserAccountClient().GetUserByEmail(model.Email.ToString()) != null)
            {
                ModelState.AddModelError("", "Email taken.");
                ViewBag.Message = "Email already taken.";
            }
            else if (new UserAccountServ.UserAccountClient().GetAccountByPIN(model.PIN) != null)
            {
                ModelState.AddModelError("", "PIN taken.");
                ViewBag.Message = "PIN already taken.";
            }
            else
            {
                Account acc = new UserAccountServ.UserAccountClient().GetAccountByUsername(model.Username);
                int roleID = 0;
                List<int> add = new List<int>();

                for (int i = 0; i < model.roles.Count; i++)
                {
                    if (model.checkboxes[i].Checked)
                    {
                        roleID = model.roles[i].ID;
                        add.Add(roleID);
                    }
                }
                int[] arraylist = add.ToArray();

                User u = new User();
                u.Name = model.Name;
                u.Surname = model.Surname;
                u.Email = model.Email;
                u.Mobile = model.Mobile;
                u.ResidenceName = model.ResidenceName;
                u.StreetName = model.StreetName;

                Account a = new Account();
                a.Username = model.Username;
                a.Password = model.Password;
                a.PIN = model.PIN;

                new UserAccountServ.UserAccountClient().AddUser(u, arraylist, a);

                UtilitiesApplication.Encryption encrytion = new UtilitiesApplication.Encryption();
                ViewBag.Token = "Your token is  " + encrytion.EncryptTripleDES(model.Password.ToString(), model.PIN.ToString()) + "  Please use this to log in.";

            }

            return View(model);
        }
Exemplo n.º 8
0
        public JsonResult GetData(string id, int page, int rows, string order, string sort, string search)
        {
            int total = 0;

            Common.Account account = GetCurrentAccount();
            search += "EQUIPMENT_STATUS_VALUUMN&" + Common.ORDER_STATUS.已分配.GetHashCode() + "*" + Common.ORDER_STATUS.已领取.GetHashCode() + "*" + Common.ORDER_STATUS.试验完成.GetHashCode() + "*" + Common.ORDER_STATUS.待入库.GetHashCode() + "*" + Common.ORDER_STATUS.器具已入库.GetHashCode() + "*" + Common.ORDER_STATUS.器具已领取.GetHashCode() + "";
            search += "^NAME&" + account.UNDERTAKE_LABORATORYName;
            List <VJIANDINGRENWU> queryData = m_BLL.GetByParamX(id, page, rows, order, sort, search, ref total);

            return(Json(new datagrid
            {
                total = total,
                rows = queryData.Select(s => new
                {
                    ID = s.ID
                    ,
                    ORDER_NUMBER = s.ORDER_NUMBER
                    ,
                    APPLIANCE_NAME = s.APPLIANCE_NAME
                    ,
                    MODEL = s.VERSION,
                    FACTORY_NUM = s.FACTORY_NUM
                    ,
                    CERTIFICATE_ENTERPRISE = s.CERTIFICATE_ENTERPRISE
                    ,
                    CUSTOMER_SPECIFIC_REQUIREMENTS = s.CUSTOMER_SPECIFIC_REQUIREMENTS
                    ,
                    ORDER_STATUS = s.ORDER_STATUS
                    ,
                    CREATETIME = s.CREATETIME
                    ,
                    APPLIANCE_PROGRESS = s.APPLIANCE_PROGRESS
                    ,
                    OVERDUE = s.OVERDUE
                    ,
                    STATE = s.STATE
                    ,
                    REPORTSTATUS = s.REPORTSTATUS
                    ,
                    APPROVAL = s.APPROVAL
                    ,
                    INSPECTION_ENTERPRISE = s.INSPECTION_ENTERPRISE
                    ,
                    ISOVERDUE = s.ISOVERDUE
                    ,
                    EQUIPMENT_STATUS_VALUUMN = s.EQUIPMENT_STATUS_VALUUMN
                    ,
                    NAME = s.NAME,
                    VERSION = s.VERSION,
                    ISRECEIVE = s.ISRECEIVE,
                    RETURNREASON = s.RETURNREASON
                    ,
                    REPORTNUMBER = s.REPORTNUMBER
                }

                                        )
            }));
        }
Exemplo n.º 9
0
        /// <summary>
        /// 获取字段,首选默认,MyTexts做为value值
        /// 谢承忠添加(器具登记页面单位绑定)
        /// </summary>
        /// <returns></returns>
        public static SelectList GetMyName()
        {
            ISysPersonBLL    compay = new SysPersonBLL();
            ValidationErrors ve     = new ValidationErrors();
            BaseController   bc     = new BaseController();

            Common.Account account = bc.GetCurrentAccount();
            return(new SelectList(compay.GetMyName(ref ve, account.UNDERTAKE_LABORATORYName), "MyName", "MyName"));
        }
Exemplo n.º 10
0
 /// <summary>
 /// 获取当前登陆人的用户名
 /// </summary>
 /// <returns></returns>
 public static string GetCurrentPerson()
 {
     Common.Account account = GetCurrentAccount();
     if (account != null && !string.IsNullOrWhiteSpace(account.Name))
     {
         return(account.Name);
     }
     return(string.Empty);
 }
Exemplo n.º 11
0
        public ActionResult GetData2(string id, int page = 1, int rows = 999999, string order = "asc", string sort = "ID", string search = null)
        {
            int total = 0;

            Common.Account account = GetCurrentAccount();
            search += "EQUIPMENT_STATUS_VALUUMN&" + Common.ORDER_STATUS.已分配.GetHashCode() + "*" + Common.ORDER_STATUS.已领取.GetHashCode() + "*" + Common.ORDER_STATUS.试验完成.GetHashCode() + "*" + Common.ORDER_STATUS.待入库.GetHashCode() + "*" + Common.ORDER_STATUS.器具已入库.GetHashCode() + "*" + Common.ORDER_STATUS.器具已领取.GetHashCode() + "";
            search += "^NAME&" + account.UNDERTAKE_LABORATORYName;
            List <VJIANDINGRENWU> queryData = m_BLL.GetByParamX(id, page, rows, order, sort, search, ref total);

            string[] fields = "ORDER_NUMBER,REPORTNUMBER,ISRECEIVE,APPLIANCE_NAME,VERSION,FACTORY_NUM,CERTIFICATE_ENTERPRISE,CUSTOMER_SPECIFIC_REQUIREMENTS,APPLIANCE_PROGRESS,ORDER_STATUS,CREATETIME,OVERDUE,STATE,REPORTSTATUS,APPROVAL,INSPECTION_ENTERPRISE".Split(',');
            return(Content(WriteExcleVJianDingRenWu(fields, queryData.ToArray())));
        }
Exemplo n.º 12
0
        public JsonResult GetData(string id, int page, int rows, string order, string sort, string search)
        {
            Common.Account account = GetCurrentAccount();
            int            total   = 0;

            if (string.IsNullOrWhiteSpace(search))
            {
                search += "REPORTSTATUS&" + Common.REPORTSTATUS.待审核;
            }
            search += "^DETECTERID&" + account.PersonName + "^";
            List <VSHENHE> queryData = m_BLL.GetByParamX(id, page, rows, order, sort, search, ref total);

            return(Json(new datagrid
            {
                total = total,
                rows = queryData.Select(s => new
                {
                    ID = s.ID
                    ,
                    REPORTNUMBER = s.REPORTNUMBER
                    ,
                    ORDER_NUMBER = s.ORDER_NUMBER
                    ,
                    APPLIANCE_NAME = s.APPLIANCE_NAME
                    ,
                    VERSION = s.VERSION
                    ,
                    FACTORY_NUM = s.FACTORY_NUM
                    ,
                    CERTIFICATE_ENTERPRISE = s.CERTIFICATE_ENTERPRISE
                    ,
                    CUSTOMER_SPECIFIC_REQUIREMENTS = s.CUSTOMER_SPECIFIC_REQUIREMENTS
                    ,
                    CERTIFICATE_CATEGORY = s.CERTIFICATE_CATEGORY
                    ,
                    QUALIFICATIONS = s.QUALIFICATIONS
                    ,
                    CONCLUSION_EXPLAIN = s.CONCLUSION_EXPLAIN
                    ,
                    CONCLUSION = s.CONCLUSION
                    ,
                    ISAGGREY = s.ISAGGREY,

                    PACKAGETYPE = s.PACKAGETYPE,
                    FILECONCLUSION = s.FILECONCLUSION,
                    REPORTSTATUS = s.REPORTSTATUS
                }

                                        )
            }));
        }
Exemplo n.º 13
0
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public Common.ClientResult.Result Post([FromBody] PRINTREPORT entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            if (entity != null && ModelState.IsValid)
            {
                Common.Account account = GetCurrentAccount();
                entity.CREATETIME   = DateTime.Now;       //打印时间
                entity.CREATEPERSON = account.PersonName; //打印者

                entity.ID = Result.GetNewId();
                string returnValue = string.Empty;
                //预备方案数据
                PREPARE_SCHEME prep = new PREPARE_SCHEME();
                prep.ID          = entity.PREPARE_SCHEMEID;
                prep.PRINTSTATUS = Common.REPORTSTATUS.报告已打印.ToString();

                prep.REPORTSTATUS   = Common.REPORTSTATUS.报告已打印.ToString();
                prep.REPORTSTATUSZI = Common.REPORTSTATUS.报告已打印.GetHashCode().ToString();

                if (m_BLL.Create(ref validationErrors, entity) && m_BLL2.EditField(ref validationErrors, prep))//修改预备方案数据
                {
                    LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",打印报告的信息的Id为" + entity.ID, "打印报告"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Succeed;
                    result.Message = Suggestion.InsertSucceed;
                    return(result); //提示创建成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",打印报告的信息," + returnValue, "打印报告"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.InsertFail + returnValue;
                    return(result); //提示插入失败
                }
            }

            result.Code    = Common.ClientCode.FindNull;
            result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对
            return(result);
        }
        public ORDER_TASK_INFORMATIONShow UpdateDataByID(string id)
        {
            Common.Account account = GetCurrentAccount();
            string         UNDERTAKE_LABORATORYID  = string.Empty;
            string         ORDER_STATUS            = string.Empty;
            APPLIANCE_DETAIL_INFORMATION queryData = m_BLL.GetById(id);//查询器具明细表数据

            foreach (var item in queryData.APPLIANCE_LABORATORY)
            {
                UNDERTAKE_LABORATORYID += item.UNDERTAKE_LABORATORYID + ",";//实验室
                if (item.UNDERTAKE_LABORATORYID == account.UNDERTAKE_LABORATORYName)
                {
                    ORDER_STATUS = item.ORDER_STATUS;//器具状态
                }
            }
            ORDER_TASK_INFORMATIONShow ordershow = new ORDER_TASK_INFORMATIONShow();

            ordershow.ID = queryData.ORDER_TASK_INFORMATION.ID;                                                         //委托单id
            ordershow.ACCEPT_ORGNIZATION            = queryData.ORDER_TASK_INFORMATION.ACCEPT_ORGNIZATION;              //受理单位
            ordershow.INSPECTION_ENTERPRISE         = queryData.ORDER_TASK_INFORMATION.INSPECTION_ENTERPRISE;           //送检单位
            ordershow.INSPECTION_ENTERPRISE_ADDRESS = queryData.ORDER_TASK_INFORMATION.INSPECTION_ENTERPRISE_ADDRESS;   //送检单位地址
            ordershow.INSPECTION_ENTERPRISE_POST    = queryData.ORDER_TASK_INFORMATION.INSPECTION_ENTERPRISE_POST;      //送检单位邮政编码
            ordershow.CONTACTS                       = queryData.ORDER_TASK_INFORMATION.CONTACTS;                       //联系人
            ordershow.CONTACT_PHONE                  = queryData.ORDER_TASK_INFORMATION.CONTACT_PHONE;                  //联系电话
            ordershow.FAX                            = queryData.ORDER_TASK_INFORMATION.FAX;                            //传真
            ordershow.CERTIFICATE_ENTERPRISE         = queryData.ORDER_TASK_INFORMATION.CERTIFICATE_ENTERPRISE;         //证书单位
            ordershow.CERTIFICATE_ENTERPRISE_ADDRESS = queryData.ORDER_TASK_INFORMATION.CERTIFICATE_ENTERPRISE_ADDRESS; //证书单位地址
            ordershow.CERTIFICATE_ENTERPRISE_POST    = queryData.ORDER_TASK_INFORMATION.CERTIFICATE_ENTERPRISE_POST;    //证书单位邮政编码
            ordershow.CONTACTS2                      = queryData.ORDER_TASK_INFORMATION.CONTACTS2;                      //联系人2
            ordershow.CONTACT_PHONE2                 = queryData.ORDER_TASK_INFORMATION.CONTACT_PHONE2;                 //联系电话2
            ordershow.FAX2                           = queryData.ORDER_TASK_INFORMATION.FAX2;                           //传真2
            ordershow.CUSTOMER_SPECIFIC_REQUIREMENTS = queryData.ORDER_TASK_INFORMATION.CUSTOMER_SPECIFIC_REQUIREMENTS; //客户特殊要求
            ordershow.APPLIANCE_DETAIL_INFORMATIONShows.Add(new APPLIANCE_DETAIL_INFORMATIONShow()
            {
                ID                           = queryData.ID,                //器具明细id
                APPLIANCE_NAME               = queryData.APPLIANCE_NAME,    //器具名称
                VERSION                      = queryData.VERSION,           //型号
                FORMAT                       = queryData.FORMAT,            //规格
                FACTORY_NUM                  = queryData.FACTORY_NUM,       //出厂编号
                NUM                          = queryData.NUM,               //数量
                ATTACHMENT                   = queryData.ATTACHMENT,        //附件
                APPEARANCE_STATUS            = queryData.APPEARANCE_STATUS, //外观状态
                MAKE_ORGANIZATION            = queryData.MAKE_ORGANIZATION, //制造单位
                UNDERTAKE_LABORATORYIDString = UNDERTAKE_LABORATORYID,      //实验室
                REMARKS                      = queryData.REMARKS,           //备注
                ORDER_STATUS                 = ORDER_STATUS                 //状态
            });
            return(ordershow);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 写cookie
        /// </summary>
        /// <param name="strname"></param>
        /// <param name="mycookie"></param>
        /// <param name="days"></param>
        public static void WriteCookie(string strname, Common.Account mycookie, int days)
        {
            HttpCookie cookie = HttpContext.Current.Request.Cookies[strname];

            if (cookie == null)
            {
                cookie = new HttpCookie(strname);
            }
            cookie.Value = UrlEncode(SerializeObject(mycookie));
            if (days > 0)
            {
                cookie.Expires = DateTime.Now.AddDays(days);
            }
            HttpContext.Current.Response.AppendCookie(cookie);
        }
Exemplo n.º 16
0
        public ActionResult ZaiXianShenHe(string id)
        {
            Common.Account account = GetCurrentAccount();
            string         APPLIANCE_DETAIL_INFORMATIONID = string.Empty;

            string[]       IDD  = id.Split('^');
            PREPARE_SCHEME pr   = m_BLL4.GetById(IDD[0]);
            FILE_UPLOADER  file = m_BLL2.GetPREPARE_SCHEMEID(IDD[0]);

            //IList<APPLIANCE_LABORATORY> appliance = m_BLL3.GetByRefPREPARE_SCHEMEID(IDD[0]);
            foreach (var item in pr.APPLIANCE_LABORATORY)
            {
                if (IDD[1] == "H")
                {
                    if (account.UNDERTAKE_LABORATORYName == item.UNDERTAKE_LABORATORYID)
                    {
                        APPLIANCE_DETAIL_INFORMATIONID = item.APPLIANCE_DETAIL_INFORMATIONID;
                        ViewBag.REPORTSTATUS           = item.PREPARE_SCHEME.REPORTSTATUS;//报告状态用来判断是否启用
                    }
                }
                else
                {
                    APPLIANCE_DETAIL_INFORMATIONID = item.APPLIANCE_DETAIL_INFORMATIONID;
                    ViewBag.REPORTSTATUS           = item.PREPARE_SCHEME.REPORTSTATUS;//报告状态用来判断是否启用
                }
            }

            ViewBag.HEIFSP            = IDD[1];                                      //判断是审核的下载预览还是审批的下载预览
            ViewBag.FILE_UPLOADER_ID  = IDD[0];                                      //附件的id
            ViewBag.PREPARE_SCHEME_ID = file.PREPARE_SCHEMEID;                       //预备方案的id
            ViewBag.APPLIANCE_DETAIL_INFORMATIONID = APPLIANCE_DETAIL_INFORMATIONID; //器具明细的id
            int    end    = file.FULLPATH.LastIndexOf("\\up");
            string dizhi  = file.FULLPATH.Substring(end);
            int    end2   = file.FULLPATH2.LastIndexOf("\\up");
            string dizhi2 = file.FULLPATH2.Substring(end);
            string x      = "/";
            string sx     = @"\";

            ViewBag.FULLPATH     = dizhi.Replace(sx, x);  //证书地址
            ViewBag.FULLPATH2    = dizhi2.Replace(sx, x); //原始记录地址
            ViewBag.NAME         = file.NAME;             //证书名字
            ViewBag.NAME2        = file.NAME2;            //原始记录
            ViewBag.CONCLUSION   = file.CONCLUSION;       //结论
            ViewBag.AUDITOPINION = pr.AUDITOPINION;       //审核意见
            ViewBag.APPROVAL     = pr.APPROVAL;           //审批意见
            ViewBag.id           = id;
            return(View());
        }
Exemplo n.º 17
0
        public Common.ClientResult.Result PutSTORAGEINSTRUCTI_STATU(string id)
        {
            Common.Account             account = GetCurrentAccount();
            Common.ClientResult.Result result  = new Common.ClientResult.Result();
            string returnValue = string.Empty;

            string[] deleteId = id.GetString().Split(',');
            List <APPLIANCE_LABORATORY> listappory = m_BLL.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(id);

            if (deleteId != null && deleteId.Length > 0)
            {
                foreach (var item in listappory)
                {
                    //数据校验
                    if (m_BLL.EditSTORAGEINSTRUCTI_STATU(ref validationErrors, deleteId) && m_BLL2.EditSTORAGEINSTRUCTI_STATU(ref validationErrors, deleteId))
                    {
                        LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息信息的Id为" + string.Join(",", deleteId), "器具明细信息"
                                                       );//写入日志
                        result.Code    = Common.ClientCode.Succeed;
                        result.Message = Suggestion.UpdateSucceed;
                        return(result); //提示更新成功
                    }
                    else
                    {
                        if (validationErrors != null && validationErrors.Count > 0)
                        {
                            validationErrors.All(a =>
                            {
                                returnValue += a.ErrorMessage;
                                return(true);
                            });
                        }
                        LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具明细信息信息的Id为" + string.Join(",", deleteId) + "," + returnValue, "器具明细信息"
                                                       );//写入日志
                        result.Code    = Common.ClientCode.Fail;
                        result.Message = Suggestion.UpdateFail + returnValue;
                        return(result); //提示更新失败
                    }
                }
                result.Code    = Common.ClientCode.FindNull;
                result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式";
            }
            return(result); //提示输入的数据的格式不对
        }
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public Common.ClientResult.Result Register([FromBody] Langben.App.Models.RegisterModel model)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            string message = string.Empty;

            if (ModelState.IsValid)
            {
                bool invite = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["InviteCodeEnabled"]);

                if (invite)
                {
                    if (string.IsNullOrWhiteSpace(model.InviteCode))
                    {
                        result.Message = "邀请码不能为空";
                    }
                }
                else if (string.IsNullOrWhiteSpace(model.Name))
                {
                    result.Message = "绰号不能为空";
                }
                else if ((string.IsNullOrWhiteSpace(model.PhoneNumber)) || (model.PhoneNumber.Substring(0, 1) != "1") || (model.PhoneNumber.Length != 11))
                {
                    result.Message = "手机号码格式不正确";
                }
                else if (string.IsNullOrWhiteSpace(model.Password) || model.Password.Length < 6)
                {
                    result.Message = "密码长度至少6位";
                }
                else
                {
                    Common.Account account = m_BLL.Register(model.Name.Trim(), model.PhoneNumber.Trim(), model.Password.Trim(), model.InviteCode, ref message);
                    result.Message = message;
                    if (string.IsNullOrWhiteSpace(message))
                    {
                        Utils.WriteCookie("account", account, 7);
                        result.Code = Common.ClientCode.Succeed;
                        return(result); //提示创建成功
                    }
                }
            }

            result.Code = Common.ClientCode.FindNull;
            return(result);
        }
Exemplo n.º 19
0
        /// <summary>
        /// 计算不确定度页
        /// </summary>
        /// <param name="ID">控件ID</param>
        /// <param name="RULEID">检测项目ID</param>
        /// <param name="PREPARE_SCHEMEID">预备方案ID</param>
        /// <returns></returns>
        public ActionResult JiSuanBuQueDingDu(string ID = "", string RULEID = "", string PREPARE_SCHEMEID = "", string URL = "")
        {
            Common.Account account = GetCurrentAccount();
            if (string.IsNullOrWhiteSpace(URL) || URL.Trim() == "")
            {
                URL = GetBuQueDingDuUrl(URL);
            }
            string htmlValue = "";

            if (DirFile.FileExists(URL))
            {
                htmlValue = DirFile.ReadFile(URL);
            }
            ViewBag.ID                        = ID;
            ViewBag.RULEID                    = RULEID;
            ViewBag.HTMLVALUE                 = htmlValue;
            ViewBag.PREPARE_SCHEMEID          = PREPARE_SCHEMEID;
            ViewBag.URL                       = URL;
            ViewBag.UNDERTAKE_LABORATORY_NAME = account.UNDERTAKE_LABORATORYName;
            return(View());
        }
Exemplo n.º 20
0
        public bool GetISRECEIVE(string id)
        {
            Common.Account account           = GetCurrentAccount();
            bool           IS                = false;
            List <APPLIANCE_LABORATORY> list = m_BLL.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(id);

            foreach (var item in list)
            {
                if (item.UNDERTAKE_LABORATORYID == account.UNDERTAKE_LABORATORYName)
                {
                    if (item.ISRECEIVE == Common.ISRECEIVE.是.ToString())
                    {
                        IS = true;
                    }
                    else
                    {
                        IS = false;
                    }
                }
            }
            return(IS);
        }
Exemplo n.º 21
0
        public bool HandleCommand(string command, List<string> args)
        {
            string Username = args[0];
            string Password = args[1];

            Account Acct = Program.AcctMgr.GetAccount(Username);
            if (Acct != null)
            {
                Log.Error("CreateAccount", "This username is already used");
                return false;
            }

            Acct = new Account();
            Acct.Username = Username.ToLower();
            Acct.Password = Password.ToLower();
            Acct.Ip = "127.0.0.1";
            Acct.Token = "";
            Acct.GmLevel = 0;
            AccountMgr.Database.AddObject(Acct);

            return true;
        }
Exemplo n.º 22
0
        public ActionResult XuanZheFangAn(string id)
        {
            Common.Account account = GetCurrentAccount();
            string         Id      = string.Empty;                //预备方案表ID
            string         APPLIANCE_LABORATORYID = string.Empty; //器具明细信息_承接实验室ID
            APPLIANCE_DETAIL_INFORMATION appl     = m_BLL5.GetById(id);

            foreach (var item in appl.APPLIANCE_LABORATORY)
            {
                if (account.UNDERTAKE_LABORATORYName == item.UNDERTAKE_LABORATORYID)
                {
                    Id = item.PREPARE_SCHEMEID;
                    APPLIANCE_LABORATORYID = item.ID;
                }
            }
            ViewBag.Id = Id;
            ViewBag.APPLIANCE_LABORATORYID         = APPLIANCE_LABORATORYID;
            ViewBag.APPLIANCE_DETAIL_INFORMATIONID = id;//器具明细表id

            string erchizi = string.Empty;

            if (!string.IsNullOrEmpty(Id))
            {
                PREPARE_SCHEME prepare = m_BLL3.GetById(Id);//二次进入绑定数据
                erchizi             += "REPORT_CATEGORY*" + prepare.REPORT_CATEGORY + ",";
                erchizi             += "CERTIFICATE_CATEGORY*" + prepare.CERTIFICATE_CATEGORY + ",";
                erchizi             += "CONTROL_NUMBER*" + prepare.CONTROL_NUMBER + ",";
                erchizi             += "QUALIFICATIONS*" + prepare.QUALIFICATIONS + ",";
                erchizi             += "CERTIFICATE_CATEGORY*" + prepare.CERTIFICATE_CATEGORY + ",";
                erchizi             += "CERTIFICATION_AUTHORITY*" + prepare.CERTIFICATION_AUTHORITY + ",";
                erchizi             += "CNAS*" + prepare.CNAS;
                ViewBag.SBL          = erchizi;
                ViewBag.REPORTSTATUS = prepare.REPORTSTATUS; //报告状态(前段判断是否能修改)
                ViewBag.PACKAGETYPE  = prepare.PACKAGETYPE;  //判断报告类型是上传还是系统生成,用来判断启用上传报告还是建立方案
            }
            ViewBag.SYS = account.UNDERTAKE_LABORATORYName;  //实验室
            return(View());
        }
Exemplo n.º 23
0
        /// <summary>
        /// 注册
        /// </summary>
        public Common.Account Register(string name, string phoneNumber, string password, string inviteCode, ref string message)
        {
            //获取用户信息,请确定web.config中的连接字符串正确
            using (SysEntities db = new SysEntities())
            {
                bool invites = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["InviteCodeEnabled"]);

                if (!invites)
                {
                    password = EncryptAndDecrypte.EncryptString(password);
                    var dataAccount = (from p in db.Account
                                       where p.PhoneNumber == phoneNumber ||
                                       p.Name == name
                                       select p).FirstOrDefault();
                    if (dataAccount == null)
                    {
                        Invite invite = new Invite()
                        {
                            Id    = Common.Result.GetNewId(),
                            Code  = GetByRndNum(5),
                            State = StateEnums.QY
                            ,
                            CreateTime   = DateTime.Now,
                            CreatePerson = name
                        };
                        db.Invite.Add(invite);
                        Invite invite2 = new Invite()
                        {
                            Id    = Common.Result.GetNewId(),
                            Code  = GetByRndNum(5),
                            State = StateEnums.QY
                            ,
                            CreateTime   = DateTime.Now,
                            CreatePerson = name
                        };
                        db.Invite.Add(invite2);
                        var account = new DAL.Account()
                        {
                            Id          = Common.Result.GetNewId(),
                            State       = StateEnums.QY,
                            PhoneNumber = phoneNumber,
                            Name        = name,
                            Password    = password

                            ,
                            CreateTime   = DateTime.Now,
                            CreatePerson = phoneNumber
                        };
                        db.Account.Add(account);
                        Resume resume = new Resume()
                        {
                            Id                   = Common.Result.GetNewId(),
                            AccountId            = account.Id,
                            CreateTime           = DateTime.Now,
                            CreatePerson         = name,
                            Name                 = "默认",
                            Remark               = "注册账号自动创建",
                            Sort                 = 0,
                            State                = StateEnums.QY,
                            CompletionPercentage = 0
                        };
                        db.Resume.Add(resume);

                        SysNotice notice = new SysNotice();
                        notice.Id           = Result.GetNewId();
                        notice.CreatePerson = name;
                        notice.CreateTime   = DateTime.Now;
                        notice.AccountId    = account.Id;
                        notice.Message      = "您的邀请码为:" + invite.Code + ",另一个为:" + invite2.Code;
                        db.SysNotice.Add(notice);

                        db.SaveChanges();

                        Common.Account accountCommon = new Common.Account();
                        accountCommon.ResumeId = resume.Id;
                        accountCommon.Name     = name;
                        accountCommon.Id       = account.Id;
                        return(accountCommon);
                    }
                    else
                    {
                        if (phoneNumber == dataAccount.PhoneNumber)
                        {
                            message = "手机号码已经存在";
                        }
                        else if (name == dataAccount.Name)
                        {
                            message = "绰号已经存在";
                        }
                    }
                }
                else
                {
                    var data = (from p in db.Invite
                                where p.Code == inviteCode &&
                                p.State == StateEnums.QY
                                select p).FirstOrDefault();
                    if (data != null)
                    {
                        password = EncryptAndDecrypte.EncryptString(password);
                        var dataAccount = (from p in db.Account
                                           where p.PhoneNumber == phoneNumber ||
                                           p.Name == name
                                           select p).FirstOrDefault();
                        if (dataAccount == null)
                        {
                            data.State        = StateEnums.JY;
                            data.UpdatePerson = name;
                            data.UpdateTime   = DateTime.Now;
                            Invite invite = new Invite()
                            {
                                Id    = Common.Result.GetNewId(),
                                Code  = GetByRndNum(5),
                                State = StateEnums.QY
                                ,
                                CreateTime   = DateTime.Now,
                                CreatePerson = name
                            };
                            db.Invite.Add(invite);
                            Invite invite2 = new Invite()
                            {
                                Id    = Common.Result.GetNewId(),
                                Code  = GetByRndNum(5),
                                State = StateEnums.QY
                                ,
                                CreateTime   = DateTime.Now,
                                CreatePerson = name
                            };
                            db.Invite.Add(invite2);
                            var account = new DAL.Account()
                            {
                                Id          = Common.Result.GetNewId(),
                                State       = StateEnums.QY,
                                PhoneNumber = phoneNumber,
                                Name        = name,
                                Password    = password

                                ,
                                CreateTime   = DateTime.Now,
                                CreatePerson = phoneNumber
                            };
                            db.Account.Add(account);
                            Resume resume = new Resume()
                            {
                                Id                   = Common.Result.GetNewId(),
                                AccountId            = account.Id,
                                CreateTime           = DateTime.Now,
                                CreatePerson         = name,
                                Name                 = "默认",
                                Remark               = "注册账号自动创建",
                                Sort                 = 0,
                                State                = StateEnums.QY,
                                CompletionPercentage = 0
                            };
                            db.Resume.Add(resume);

                            SysNotice notice = new SysNotice();
                            notice.Id           = Result.GetNewId();
                            notice.CreatePerson = name;
                            notice.CreateTime   = DateTime.Now;
                            notice.AccountId    = account.Id;
                            notice.Message      = "您的邀请码为:" + invite.Code + ",另一个为:" + invite2.Code;
                            db.SysNotice.Add(notice);

                            db.SaveChanges();

                            Common.Account accountCommon = new Common.Account();
                            accountCommon.ResumeId = resume.Id;
                            accountCommon.Name     = name;
                            accountCommon.Id       = account.Id;
                            return(accountCommon);
                        }
                        else
                        {
                            if (phoneNumber == dataAccount.PhoneNumber)
                            {
                                message = "手机号码已经存在";
                            }
                            else if (name == dataAccount.Name)
                            {
                                message = "绰号已经存在";
                            }
                        }
                    }
                    else
                    {
                        message = "邀请码不正确";
                    }
                }
            }
            return(null);
        }
Exemplo n.º 24
0
        public Common.ClientResult.Result EditSENDBACK([FromBody] APPLIANCE_LABORATORY entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            APPLIANCE_LABORATORY       aryOne = null;

            if (entity != null && ModelState.IsValid)
            {   //数据校验
                Common.Account account             = GetCurrentAccount();
                List <APPLIANCE_LABORATORY> appory = m_BLL.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(entity.APPLIANCE_DETAIL_INFORMATION.ID);
                aryOne = appory.Find(f => f.UNDERTAKE_LABORATORYID == account.UNDERTAKE_LABORATORYName); //选择的器具
                if (!string.IsNullOrWhiteSpace(aryOne.PREPARE_SCHEMEID))
                {                                                                                        //如果有报告产生,就不能退回
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = "已经生成报告编号,如果器具不能检测,请完成不合格报告。";
                    return(result);
                }

                var currentPerson = GetCurrentAccount();
                entity.BACKTIME   = DateTime.Now;
                entity.BACKPERSON = currentPerson.PersonName;
                string returnValue = string.Empty;
                //通过前端传过来的值来判断枚举中属于什么值给器具状态值赋值
                if (!string.IsNullOrEmpty(entity.ORDER_STATUS))
                {
                    if (Enum.IsDefined(typeof(Common.ORDER_STATUS), entity.ORDER_STATUS))
                    {
                        entity.EQUIPMENT_STATUS_VALUUMN = Enum.Parse(typeof(Common.ORDER_STATUS), entity.ORDER_STATUS).GetHashCode().ToString();
                    }
                }


                entity.ID = aryOne.ID;
                if (m_BLL.EditField(ref validationErrors, entity))
                {
                    if (entity.ORDER_STATUS == Common.ORDER_STATUS.已退回.ToString())  //退回
                    {
                        //获取委托单id
                        APPLIANCE_DETAIL_INFORMATION appl = m_BLL2.GetById(entity.APPLIANCE_DETAIL_INFORMATION.ID);
                        appl.ORDER_TASK_INFORMATION.ORDER_STATUS = Common.ORDER_STATUS_INFORMATION.退回.ToString();
                        m_BLL3.EditField(ref validationErrors, appl.ORDER_TASK_INFORMATION);
                        LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具退回的Id为" + entity.ID, "器具明细信息"
                                                       );//写入日志
                        result.Code    = Common.ClientCode.Succeed;
                        result.Message = "退回成功!";
                        return(result); //提示更新成功
                    }
                    else if (entity.ORDER_STATUS == Common.ORDER_STATUS.待入库.ToString())
                    {
                        entity.APPLIANCE_DETAIL_INFORMATION.STORAGEINSTRUCTIONS = entity.STORAGEINSTRUCTIONS.ToString(); //入库说明
                        if (m_BLL2.EditField(ref validationErrors, entity.APPLIANCE_DETAIL_INFORMATION))                 //修改器具明细表中的入库说明
                        {
                            if (appory.Remove(aryOne))
                            {
                                var aryTwo = appory.FirstOrDefault();
                                if (aryTwo != null)
                                {
                                    result.Message = "请通知" + aryTwo.UNDERTAKE_LABORATORYID + "该器具不能检测";
                                }
                                else
                                {
                                    result.Message = "退回成功!";
                                }
                            }
                            else
                            {
                                result.Message = Suggestion.UpdateSucceed;
                            }
                            LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具退回的Id为" + entity.ID, "器具明细信息"
                                                           );//写入日志
                            result.Code = Common.ClientCode.Succeed;

                            return(result); //提示更新成功
                        }
                    }
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具退回的Id为" + entity.ID + "," + returnValue, "器具明细信息"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.UpdateFail + returnValue;
                    return(result); //提示更新失败
                }


                result.Code    = Common.ClientCode.FindNull;
                result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式";
            }
            return(result); //提示输入的数据的格式不对
        }
Exemplo n.º 25
0
 public void AddAccount(Account a)
 {
     entities.Account.AddObject(a);
     entities.SaveChanges();
 }
        public Common.ClientResult.Result Post([FromBody] PREPARE_SCHEME entity)
        {
            Common.ClientResult.OrderTaskGong result = new Common.ClientResult.OrderTaskGong();
            try
            {
                Common.Account account = GetCurrentAccount();
                string         putid   = entity.ID;

                if (entity != null && ModelState.IsValid)
                {
                    entity.CREATETIME   = DateTime.Now;
                    entity.CREATEPERSON = account.PersonName;
                    //修改证书编号
                    entity.ID = Result.GetNewId();
                    string returnValue       = string.Empty;
                    APPLIANCE_LABORATORY app = new APPLIANCE_LABORATORY();
                    if (string.IsNullOrWhiteSpace(entity.APPLIANCE_LABORATORYID))
                    {
                        LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",中间表没有id" + entity.ID, "预备方案表数据保存");//写入日志
                        result.Code    = Common.ClientCode.Fail;
                        result.Message = "中间表ID没取到";
                        return(result); //提示更新成功
                    }
                    app.ID = entity.APPLIANCE_LABORATORYID;
                    app.PREPARE_SCHEMEID = entity.ID;
                    if (!string.IsNullOrEmpty(putid))//判断是否为第二次进入
                    {
                        //修改
                        entity.ID = putid;
                        if (m_BLL.EditField(ref validationErrors, entity) && m_BLL.UPTSerialNumber(entity.ID))
                        {
                            LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",预备方案信息修改" + entity.ID, "预备方案");//写入日志
                            result.Code    = Common.ClientCode.Succeed;
                            result.Message = Suggestion.UpdateSucceed;
                            result.Id      = entity.ID;
                            return(result); //提示更新成功
                        }
                        else
                        {
                            if (validationErrors != null && validationErrors.Count > 0)
                            {
                                validationErrors.All(a =>
                                {
                                    returnValue += a.ErrorMessage;
                                    return(true);
                                });
                            }
                            LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",预备方案信息的Id为" + entity.ID + "," + returnValue, "预备方案"
                                                           );//写入日志
                            result.Code    = Common.ClientCode.Fail;
                            result.Message = Suggestion.UpdateFail + returnValue;
                            return(result); //提示更新失败
                        }
                    }
                    else
                    {
                        try
                        {
                            if (m_BLL.Create(ref validationErrors, entity))
                            {
                                LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",预备方案的信息的Id为" + entity.ID, "预备方案保存");//写入日志
                                result.Code = Common.ClientCode.Succeed;
                                result.Id   = entity.ID;
                            }
                            else
                            {
                                if (validationErrors != null && validationErrors.Count > 0)
                                {
                                    validationErrors.All(a =>
                                    {
                                        returnValue += a.ErrorMessage;
                                        return(true);
                                    });
                                }
                                result.Code    = Common.ClientCode.Fail;
                                result.Message = returnValue + "预备方案添加数据出错!";
                                result.Id      = entity.ID;
                                return(result);
                            }
                        }
                        catch (Exception ex)
                        {
                            validationErrors.Add(ex.Message);
                            ExceptionsHander.WriteExceptions(ex);
                        }

                        if (m_BLL2.EditField(ref validationErrors, app))
                        {
                            LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",中间表出错了" + app.ID, "中间表修改");//写入日志
                            result.Code = Common.ClientCode.Succeed;
                            result.Id   = entity.ID;
                        }
                        else
                        {
                            result.Code    = Common.ClientCode.Fail;
                            result.Message = validationErrors + "中间表修改出错了!";
                            result.Id      = entity.ID;
                            return(result);
                        }
                        if (m_BLL.UPTSerialNumber(entity.ID))
                        {
                            LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",修改编号" + entity.ID, "修改编号");//写入日志
                            result.Code = Common.ClientCode.Succeed;
                            result.Id   = entity.ID;
                        }
                        else
                        {
                            result.Code    = Common.ClientCode.Fail;
                            result.Message = validationErrors + "修改编号出错!";
                            result.Id      = entity.ID;
                            return(result);
                        }
                        return(result);
                    }
                }
            }
            catch (Exception ex)
            {
                validationErrors.Add(ex.Message);
                ExceptionsHander.WriteExceptions(ex);
            }
            result.Code    = Common.ClientCode.FindNull;
            result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对
            return(result);
        }
Exemplo n.º 27
0
        public Common.ClientResult.Result LINGQU([FromBody] APPLIANCE_LABORATORY entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            string returnValue = string.Empty;
            string id          = entity.APPLIANCE_DETAIL_INFORMATIONID.TrimEnd(',');

            string[] deleteId = id.Split(',');//截取id
            if (deleteId != null && deleteId.Length > 0)
            {
                Common.Account account = GetCurrentAccount();
                bool           qu      = false;
                foreach (var item in deleteId)
                {
                    if (GetISRECEIVE(item))
                    {
                        qu = true;
                    }
                    else
                    {
                        qu = false;
                        break;
                    }
                }
                if (qu)
                {
                    foreach (var item2 in deleteId)//修改器具状态
                    {
                        APPLIANCE_DETAIL_INFORMATION appion = new APPLIANCE_DETAIL_INFORMATION();
                        APPLIANCE_DETAIL_INFORMATION adi    = m_BLL2.GetById(item2);
                        List <APPLIANCE_LABORATORY>  listry = m_BLL.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(item2);
                        foreach (var item3 in listry)
                        {
                            APPLIANCE_LABORATORY app = new APPLIANCE_LABORATORY();

                            if (item3.UNDERTAKE_LABORATORYID == account.UNDERTAKE_LABORATORYName)
                            {
                                app.ORDER_STATUS             = Common.ORDER_STATUS.已领取.ToString();
                                app.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.已领取.GetHashCode().ToString();
                                app.RECEIVEPERSON            = account.PersonName;
                                app.RECEIVETIME = DateTime.Now;
                            }
                            app.ID = item3.ID;


                            app.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            if (m_BLL.EditField(ref validationErrors, app))
                            {
                                LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息_承接实验室的Id为" + appion.ID, "器具领取状态修改");//写入日志
                                result.Code    = Common.ClientCode.Succeed;
                                result.Message = Suggestion.UpdateSucceed;
                            }
                            else
                            {
                                if (validationErrors != null && validationErrors.Count > 0)
                                {
                                    validationErrors.All(a =>
                                    {
                                        returnValue += a.ErrorMessage;
                                        return(true);
                                    });
                                }
                                LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具明细信息_承接实验室的Id为" + appion.ID + "," + returnValue, "器具领取状态修改");//写入日志
                                result.Code    = Common.ClientCode.Fail;
                                result.Message = Suggestion.UpdateFail + returnValue;
                                return(result); //提示更新失败
                            }
                        }
                        appion.ID = item2;
                        if (adi.APPLIANCE_RECIVE == "是")
                        {
                            appion.APPLIANCE_PROGRESS = account.UNDERTAKE_LABORATORYName;
                        }
                        if (m_BLL2.EditField(ref validationErrors, appion))
                        {
                            LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息信息的Id为" + appion.ID, "器具领取所在实验室修改");//写入日志
                            result.Code    = Common.ClientCode.Succeed;
                            result.Message = Suggestion.UpdateSucceed;
                        }
                        else
                        {
                            if (validationErrors != null && validationErrors.Count > 0)
                            {
                                validationErrors.All(a =>
                                {
                                    returnValue += a.ErrorMessage;
                                    return(true);
                                });
                            }
                            LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具明细信息信息的Id为" + appion.ID + "," + returnValue, "器具领取所在实验室修改");//写入日志
                            result.Code    = Common.ClientCode.Fail;
                            result.Message = Suggestion.UpdateFail + returnValue;
                            return(result); //提示更新失败
                        }
                    }
                }
            }
            return(result); //提示输入的数据的格式不对
        }
        public Common.ClientResult.Result SheIsPi([FromBody] PREPARE_SCHEME entity)
        {
            Common.ClientResult.OrderTaskGong result = new Common.ClientResult.OrderTaskGong();
            if (entity != null && ModelState.IsValid)
            {   //数据校验
                Common.Account account       = GetCurrentAccount();
                string         currentPerson = GetCurrentPerson();
                entity.UPDATETIME   = DateTime.Now;
                entity.UPDATEPERSON = currentPerson;
                string returnValue = string.Empty;
                List <APPLIANCE_LABORATORY> APPlist      = m_BLL2.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(entity.APPLIANCE_DETAIL_INFORMATIONID);
                THEREVIEWPROCESS            SH           = new THEREVIEWPROCESS();   //审核操作记录
                THEAPPROVALPROCESS          SP           = new THEAPPROVALPROCESS(); //审批操作记录
                APPLIANCE_LABORATORY        applianceOne = APPlist.Find(f => f.PREPARE_SCHEMEID == entity.ID);
                APPLIANCE_LABORATORY        applianceTwo = null;
                if (APPlist.Remove(applianceOne))
                {
                    applianceTwo = APPlist.FirstOrDefault();
                }
                APPLIANCE_DETAIL_INFORMATION adi = m_BLL3.GetById(applianceOne.APPLIANCE_DETAIL_INFORMATIONID);
                if (entity.SHPI == "H")
                {
                    entity.AUDITTIME     = DateTime.Now;//审核时间
                    entity.AUDITTEPERSON = currentPerson;
                    if (entity.ISAGGREY == "不同意")
                    {
                        entity.REPORTSTATUS   = Common.REPORTSTATUS.审核驳回.ToString();
                        entity.REPORTSTATUSZI = Common.REPORTSTATUS.审核驳回.GetHashCode().ToString();

                        if (applianceTwo != null)
                        {
                            applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceOne);
                            applianceTwo.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceTwo);
                        }
                        else
                        {
                            applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceOne);
                        }
                    }
                    else if (entity.ISAGGREY == "同意")
                    {
                        entity.REPORTSTATUS   = Common.REPORTSTATUS.待批准.ToString();
                        entity.REPORTSTATUSZI = Common.REPORTSTATUS.待批准.GetHashCode().ToString();
                        if (adi.APPLIANCE_RECIVE == "是")
                        {
                            applianceOne.ORDER_STATUS             = Common.ORDER_STATUS.试验完成.ToString();               //自己改变状态
                            applianceOne.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.试验完成.GetHashCode().ToString(); //自己改变状态
                        }
                        if (applianceTwo != null)
                        {
                            applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceOne);
                            applianceTwo.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceTwo);
                        }
                        else
                        {
                            applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceOne);
                        }
                    }
                    #region 审核过程记录
                    SH.ID                 = Result.GetNewId();   //id
                    SH.CREATEPERSON       = account.PersonName;  //审核者
                    SH.CREATETIME         = DateTime.Now;        //审核时间
                    SH.REVIEWCONCLUSION   = entity.ISAGGREY;
                    SH.REVIEWCONCLUSIONZI = entity.AUDITOPINION; //审核意见
                    SH.PREPARE_SCHEMEID   = entity.ID;
                    if (!m_BLL4.Create(ref validationErrors, SH))
                    {
                        if (validationErrors != null && validationErrors.Count > 0)
                        {
                            validationErrors.All(a =>
                            {
                                returnValue += a.ErrorMessage;
                                return(true);
                            });
                        }
                        LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",预备方案信息的Id为" + entity.ID, "审核过程记录");//写入日志
                    }
                    #endregion
                }
                else if (entity.SHPI == "P")
                {
                    entity.APPROVALDATE    = DateTime.Now;
                    entity.APPROVALEPERSON = currentPerson;
                    if (entity.APPROVALISAGGREY == "不同意")
                    {
                        entity.REPORTSTATUS   = Common.REPORTSTATUS.批准驳回.ToString();
                        entity.REPORTSTATUSZI = Common.REPORTSTATUS.批准驳回.GetHashCode().ToString();
                        if (applianceTwo != null)
                        {
                            if (applianceTwo.ORDER_STATUS == Common.ORDER_STATUS.已分配.ToString())
                            {
                                applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                                applianceTwo.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            }
                            else if (applianceTwo.ORDER_STATUS == Common.ORDER_STATUS.已领取.ToString())
                            {
                                applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                                applianceTwo.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                            }
                            else if (applianceTwo.PREPARE_SCHEME.REPORTSTATUS == Common.REPORTSTATUS.待批准.ToString())
                            {
                                applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                                applianceTwo.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            }
                            else if (applianceTwo.PREPARE_SCHEME.REPORTSTATUS == Common.REPORTSTATUS.已批准.ToString())
                            {
                                applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                                applianceTwo.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            }
                            else if (applianceTwo.PREPARE_SCHEME.REPORTSTATUS == Common.REPORTSTATUS.批准驳回.ToString())
                            {
                                applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                                applianceTwo.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                            }
                            m_BLL2.EditField(ref validationErrors, applianceOne);
                            m_BLL2.EditField(ref validationErrors, applianceTwo);
                        }
                        else
                        {
                            applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceOne);
                        }
                    }
                    else if (entity.APPROVALISAGGREY == "同意")
                    {
                        entity.REPORTSTATUS   = Common.REPORTSTATUS.已批准.ToString();
                        entity.REPORTSTATUSZI = Common.REPORTSTATUS.已批准.GetHashCode().ToString();
                        if (adi != null)
                        {
                            if (adi.APPLIANCE_RECIVE == "是")
                            {
                                applianceOne.ORDER_STATUS             = Common.ORDER_STATUS.待入库.ToString();
                                applianceOne.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.待入库.GetHashCode().ToString();
                            }
                            else
                            {
                                applianceOne.ORDER_STATUS             = Common.ORDER_STATUS.器具未收.ToString();
                                applianceOne.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.器具未收.GetHashCode().ToString();
                            }
                        }

                        applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                        m_BLL2.EditField(ref validationErrors, applianceOne);
                    }
                    #region 审批过程记录
                    SP.ID                   = Result.GetNewId(); //id
                    SP.CREATEPERSON         = account.Name;      //审核者
                    SP.CREATETIME           = DateTime.Now;      //审核时间
                    SP.APPROVALCONCLUSION   = entity.APPROVALISAGGREY;
                    SP.PREPARE_SCHEMEID     = entity.ID;
                    SP.APPROVALCONCLUSIONZI = entity.APPROVAL;//审批意见
                    if (!m_BLL5.Create(ref validationErrors, SP))
                    {
                        if (validationErrors != null && validationErrors.Count > 0)
                        {
                            validationErrors.All(a =>
                            {
                                returnValue += a.ErrorMessage;
                                return(true);
                            });
                        }
                        LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",预备方案信息的Id为" + entity.ID, "审批过程记录");//写入日志
                    }

                    #endregion
                }


                bool HE = false;
                if (!string.IsNullOrEmpty(applianceOne.ORDER_STATUS) || !string.IsNullOrEmpty(entity.REPORTSTATUS))
                {
                    HE = m_BLL.EditField(ref validationErrors, entity);//器具明细修改
                }
                try
                {
                    if (entity.REPORTSTATUS == Common.REPORTSTATUS.待批准.ToString() || entity.REPORTSTATUS == Common.REPORTSTATUS.已批准.ToString())
                    {
                        Langben.Report.ReportBLL rBLL = new Langben.Report.ReportBLL();
                        string err = "";
                        rBLL.AddQianMing(entity.ID, entity.REPORTSTATUS, out err);
                    }
                }
                catch (Exception ex)
                {
                }
                if (HE)
                {
                    LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",预备方案信息的Id为" + entity.ID, "预备方案"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Succeed;
                    result.Message = Suggestion.UpdateSucceed;
                    result.Id      = entity.ID;
                    return(result); //提示更新成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",预备方案信息的Id为" + entity.ID + "," + returnValue, "预备方案"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.UpdateFail + returnValue;
                    return(result); //提示更新失败
                }
            }
            result.Code    = Common.ClientCode.FindNull;
            result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式";
            return(result); //提示输入的数据的格式不对
        }
Exemplo n.º 29
0
 /// <summary>
 /// Create a new Account object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="username">Initial value of the Username property.</param>
 /// <param name="password">Initial value of the Password property.</param>
 /// <param name="pIN">Initial value of the PIN property.</param>
 public static Account CreateAccount(global::System.Int32 id, global::System.String username, global::System.String password, global::System.Int32 pIN)
 {
     Account account = new Account();
     account.ID = id;
     account.Username = username;
     account.Password = password;
     account.PIN = pIN;
     return account;
 }
Exemplo n.º 30
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Account EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAccount(Account account)
 {
     base.AddObject("Account", account);
 }
Exemplo n.º 31
0
        public ActionResult JianLiFangAn(string id)
        {
            //id = "161008163205467348401f1aec5a1|161008162529892766577f2f96359";
            Common.Account account          = GetCurrentAccount();
            string[]       bs               = id.Split('|');
            string         PREPARE_SCHEMEID = bs[0];                                                                 //预备方案id
            string         APPLIANCE_DETAIL_INFORMATIONID = bs[1];                                                   //器具明细id
            APPLIANCE_DETAIL_INFORMATION    appion        = m_BLL5.GetById(APPLIANCE_DETAIL_INFORMATIONID);          //器具明细表
            List <METERING_STANDARD_DEVICE> mete          = m_BLL3.GetRefMETERING_STANDARD_DEVICE(PREPARE_SCHEMEID); //标准装置/计量标准器信息表
            PREPARE_SCHEME     prme     = m_BLL3.GetById(PREPARE_SCHEMEID);                                          //预备方案表
            PREPARE_SCHEMEShow prepShow = new PREPARE_SCHEMEShow();                                                  //预备方案类

            if (prme != null && prme.SCHEME != null)
            {
                //为什么获取不到SCHEME这个对象
                prepShow.SCHEMENAME = prme.SCHEME.NAME; //  选择方案模板
                prepShow.SCHEMEID   = prme.SCHEME.ID;   //  选择方案模板
            }
            if (prme != null && prme.STANDARDCHOICE != null)
            {
                foreach (var item in prme.STANDARDCHOICE)
                {
                    //rows[i].ID + "*" + rows[i].GROUPS + "*A*" + rows[i].CERTIFICATE_NUM
                    prepShow.METERING_STANDARD_DEVICEID += item.ID + "*" + item.METERING_STANDARD_DEVICEID + "*" + item.GROUPS + "*" + item.TYPE + "*" + item.NAMES + "&" + item.NAMES + "^";
                }
            }
            foreach (var item in prme.APPLIANCE_LABORATORY)
            {
                if (item.RECYCLING != null)
                {
                    prepShow.REPORTNUMBER = item.RECYCLING;
                }
                else
                {
                    prepShow.REPORTNUMBER = m_BLL3.GetSerialNumber(PREPARE_SCHEMEID);//报告编号
                }
            }
            prepShow.APPLIANCE_DETAIL_INFORMATIONShows.APPLIANCE_NAME = appion.APPLIANCE_NAME;       //器具名称
            prepShow.APPLIANCE_DETAIL_INFORMATIONShows.VERSION        = appion.VERSION;              //器具型号
            prepShow.APPLIANCE_DETAIL_INFORMATIONShows.FORMAT         = appion.FORMAT;               //器具规格
            prepShow.APPLIANCE_DETAIL_INFORMATIONShows.FACTORY_NUM    = appion.FACTORY_NUM;          //出厂编号
            prepShow.ACCURACY_GRADE  = prme.ACCURACY_GRADE;                                          //准确度等级
            prepShow.RATED_FREQUENCY = prme.RATED_FREQUENCY;                                         //额定频率
            prepShow.PULSE_CONSTANT  = prme.PULSE_CONSTANT;                                          //脉冲常数
            prepShow.APPLIANCE_DETAIL_INFORMATIONShows.MAKE_ORGANIZATION = appion.MAKE_ORGANIZATION; //制造单位
            prepShow.TEMPERATURE      = prme.TEMPERATURE;                                            //环境温度
            prepShow.HUMIDITY         = prme.HUMIDITY;                                               //相对湿度
            prepShow.CHECK_PLACE      = prme.CHECK_PLACE;                                            //检定/校准地点
            prepShow.CALIBRATION_DATE = prme.CALIBRATION_DATE;                                       //检定/校准日期
            prepShow.DETECTERID       = prme.DETECTERID;                                             //核验员
            prepShow.OTHER            = prme.OTHER;                                                  //其他
            prepShow.ID = prme.ID;                                                                   //id

            ViewBag.CERTIFICATE_CATEGORY      = prme.CERTIFICATE_CATEGORY;                           //证书类别
            ViewBag.UNDERTAKE_LABORATORY_NAME = account.UNDERTAKE_LABORATORYName;                    //实验室
            foreach (var item in prme.APPLIANCE_LABORATORY)
            {
                if (item.UNDERTAKE_LABORATORYID == account.UNDERTAKE_LABORATORYName)
                {
                    ViewBag.ORDER_STATUS = item.ORDER_STATUS;//器具状态
                }
            }
            ViewBag.ACCEPT_ORGNIZATION = appion.ORDER_TASK_INFORMATION.ACCEPT_ORGNIZATION;//受理单位
            return(View(prepShow));
        }
        public ActionResult Save(ORDER_TASK_INFORMATION entity)
        {
            Common.ClientResult.OrderTaskGong result = new Common.ClientResult.OrderTaskGong();
            try
            {
                Common.Account account = GetCurrentAccount();
                if (string.IsNullOrWhiteSpace(entity.ID))
                {
                    List <COMPANY> companylist  = m_BLL2.GetByParam(null, "asc", "ID", "COMPANYNAME&" + entity.INSPECTION_ENTERPRISE + "");
                    List <COMPANY> companylist2 = m_BLL2.GetByParam(null, "asc", "ID", "COMPANYNAME&" + entity.CERTIFICATE_ENTERPRISE + "");


                    foreach (var item in companylist)
                    {
                        if (item.COMPANY2 != null)
                        {
                            entity.INSPECTION_ENTERPRISEHELLD = item.COMPANY2.COMPANYNAME;
                            break;
                        }
                    }
                    foreach (var item in companylist2)
                    {
                        if (item.COMPANY2 != null)
                        {
                            entity.CERTIFICATE_ENTERPRISEHELLD = item.COMPANY2.COMPANYNAME;
                            break;
                        }
                        else
                        {
                            entity.CERTIFICATE_ENTERPRISEHELLD = entity.CERTIFICATE_ENTERPRISE;
                            break;
                        }
                    }
                    string ORDER_NUMBER = m_BLL.GetORDER_NUMBER(ref validationErrors);
                    var    order        = ORDER_NUMBER.Split('*');// DC2016001 * 1 * 2016
                    entity.ORDER_STATUS = Common.ORDER_STATUS_INFORMATION.保存.ToString();
                    var ms = new System.IO.MemoryStream();
                    entity.CREATETIME   = DateTime.Now;
                    entity.CREATEPERSON = account.PersonName;
                    entity.ID           = Result.GetNewId();

                    entity.ORDER_NUMBER   = order[0].ToString();
                    entity.ORSERIALNUMBER = Convert.ToDecimal(order[1]);
                    entity.ORYEARS        = order[2].ToString();

                    entity.ORDER_STATUS = Common.ORDER_STATUS_INFORMATION.保存.ToString();

                    string path = Server.MapPath("~/up/ErWeiMa/");
                    foreach (var item in entity.APPLIANCE_DETAIL_INFORMATION)
                    {
                        item.ID           = Result.GetNewId();
                        item.CREATETIME   = DateTime.Now;
                        item.CREATEPERSON = account.PersonName;
                        string bianma = Regex.Replace(Guid.NewGuid().ToString().Replace("-", ""), "[a-z]", "", RegexOptions.IgnoreCase).Substring(0, 8);
                        item.BAR_CODE_NUM = entity.ORSERIALNUMBER.ToString().PadLeft(4, '0') + bianma;
                        //二维码生成
                        ErrorCorrectionLevel Ecl    = ErrorCorrectionLevel.M; //误差校正水平
                        string           Content    = item.ID;                //待编码内容
                        QuietZoneModules QuietZones = QuietZoneModules.Two;   //空白区域
                        int    ModuleSize           = 3;                      //大小
                        var    encoder = new QrEncoder(Ecl);
                        QrCode qr;
                        if (encoder.TryEncode(Content, out qr))//对内容进行编码,并保存生成的矩阵
                        {
                            Renderer r = new Renderer(ModuleSize);
                            r.QuietZoneModules = QuietZones;
                            r.WriteToStream(qr.Matrix, ms, ImageFormat.Png);
                        }
                        //QRCodeHelper.GetQRCode(item.ID, ms);
                        var pathErWeiMa = path + item.ID + ".png";

                        //System.IO.FileStream fs = new System.IO.FileStream(pathErWeiMa, System.IO.FileMode.OpenOrCreate);


                        //System.IO.BinaryWriter w = new System.IO.BinaryWriter(fs);
                        #region 二维码加字
                        System.IO.FileStream fss = new System.IO.FileStream(Server.MapPath("~/up/moban.png"), System.IO.FileMode.OpenOrCreate);
                        int filelength           = 0;
                        filelength = (int)fss.Length;        //获得文件长度
                        Byte[] image = new Byte[filelength]; //建立一个字节数组
                        fss.Read(image, 0, filelength);      //按字节流读取
                        System.Drawing.Image imag = System.Drawing.Image.FromStream(fss);
                        //System.Drawing.Image Image = System.Drawing.Image.FromStream(ms);
                        Graphics g = null;
                        g = Graphics.FromImage(imag);
                        string xinghao = item.BAR_CODE_NUM;//需要写入的字
                        //string xinghao = "123456789abcd";//需要写入的字
                        int          w      = imag.Width;
                        int          h      = imag.Height; //entity.INSPECTION_ENTERPRISE
                        StringFormat format = new StringFormat();
                        format.Alignment     = StringAlignment.Center;
                        format.LineAlignment = StringAlignment.Center;
                        DrawString(g, item.BAR_CODE_NUM, new Font("宋体", 14), new SolidBrush(Color.Black), new PointF(430, 200), format, -90f);
                        var COMPANY = m_BLL2.GetAll();
                        var dw      = COMPANY.Where(m => m.COMPANYNAME == entity.INSPECTION_ENTERPRISE).Select(s => s.POSTCODE).Single();
                        DrawString(g, dw, new Font("宋体", 14), new SolidBrush(Color.Black), new PointF(490, 200), format, -90f);
                        //g.DrawString(item.BAR_CODE_NUM, new Font("宋体", 10), Brushes.Red, new PointF(350, 0));//x:值越大越靠右;y:值越小越靠上
                        //if (entity.INSPECTION_ENTERPRISE.Length>9)
                        //{
                        //    string zhi = entity.INSPECTION_ENTERPRISE.Substring(0, 9);
                        //    string zhi2= entity.INSPECTION_ENTERPRISE.Remove(0, 9);
                        //    g.DrawString(zhi, new Font("宋体", 14), Brushes.Red, new PointF(0, 320));//x:值越大越靠右;y:值越小越靠上
                        //    g.DrawString(zhi2, new Font("宋体", 14), Brushes.Red, new PointF(0, 380));//x:值越大越靠右;y:值越小越靠上
                        //}
                        //else
                        //{
                        //    g.DrawString(entity.INSPECTION_ENTERPRISE, new Font("宋体", 14), Brushes.Red, new PointF(0, 320));//x:值越大越靠右;y:值越小越靠上
                        //}

                        System.Drawing.Image ig = CombinImage(imag, ms);
                        //System.Drawing.Image ig = imag;
                        fss.Close();
                        TuPanBaoCun(ig, pathErWeiMa);
                        //生成pdf
                        //图片
                        //Image image = Image.GetInstance(imagePath);
                        //cell = new PdfPCell(image, true);
                        //table.AddCell(cell);
                        PDF.Create(path + item.ID);
                        #endregion

                        //w.Write(ms.ToArray());
                        //fs.Close();
                        //器具明细信息_承接实验室表添加数据
                        foreach (var it in item.UNDERTAKE_LABORATORYID.TrimEnd(',').Split(','))
                        {
                            item.APPLIANCE_LABORATORY.Add(new APPLIANCE_LABORATORY()
                            {
                                ID = Result.GetNewId(),
                                UNDERTAKE_LABORATORYID   = it,
                                ORDER_STATUS             = Common.ORDER_STATUS.保存.ToString(),
                                EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.保存.GetHashCode().ToString(),
                                DISTRIBUTIONPERSON       = account.PersonName,
                                DISTRIBUTIONTIME         = DateTime.Now,
                                CREATEPERSON             = account.PersonName,
                                CREATETIME = DateTime.Now,
                                ISRECEIVE  = Common.ISRECEIVE.是.ToString(),
                                RECYCLING  = entity.RECYCLING
                            });
                        }
                    }
                    ms.Close();

                    string returnValue = string.Empty;
                    if (m_BLL.Create(ref validationErrors, entity))
                    {
                        LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",委托单信息的信息的Id为" + entity.ID, "委托单信息"
                                                       );//写入日志
                        result.Code    = Common.ClientCode.Succeed;
                        result.Message = Suggestion.InsertSucceed;
                        result.Id      = entity.ID;
                        return(Json(result)); //提示创建成功
                    }
                    else
                    {
                        if (validationErrors != null && validationErrors.Count > 0)
                        {
                            validationErrors.All(a =>
                            {
                                returnValue += a.ErrorMessage;
                                return(true);
                            });
                        }
                        LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",委托单信息的信息," + returnValue, "委托单信息"
                                                       );//写入日志
                        result.Code    = Common.ClientCode.Fail;
                        result.Message = Suggestion.InsertFail + returnValue;
                        return(Json(result)); //提示插入失败
                    }
                }
                else
                {
                }


                result.Code    = Common.ClientCode.FindNull;
                result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对
            }
            catch (Exception lastError)
            {
                // fss.Close();
                ExceptionsHander.WriteExceptions(lastError);//将异常写入数据库
            }
            return(Json(result));
        }