Пример #1
0
        public JsonResult GetData(string id, int page, int rows, string order, string sort, string search)
        {
            try
            {
                LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",人员的信息,dd2w", "人员qq2w"
                                               );//写入日志

                int total = 0;
                List <SysPerson> queryData = m_BLL.GetByParam(id, page, rows, order, sort, search, ref total);
                LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",人员的信息,dd", "人员"
                                               );//写入日志

                return(Json(new datagrid
                {
                    total = total,
                    rows = queryData.Select(s => new
                    {
                        Id = s.Id
                        ,
                        Name = s.Name
                        ,
                        MyName = s.MyName
                        ,
                        Password = s.Password
                        ,
                        SurePassword = s.SurePassword
                        ,
                        Sex = s.Sex
                        ,
                        SysDepartmentId = s.SysDepartmentIdOld
                        ,
                        Position = s.Position
                        ,
                        MobilePhoneNumber = s.MobilePhoneNumber
                        ,
                        PhoneNumber = s.PhoneNumber
                        ,
                        Province = s.Province
                        ,
                        City = s.City
                        ,
                        Village = s.Village
                        ,
                        Address = s.Address
                        ,
                        EmailAddress = s.EmailAddress
                        ,
                        Remark = s.Remark
                        ,
                        State = s.State
                        ,
                        CreateTime = s.CreateTime
                        ,
                        CreatePerson = s.CreatePerson
                        ,
                        UpdateTime = s.UpdateTime
                        ,
                        LogonNum = s.LogonNum
                        ,
                        LogonTime = s.LogonTime
                        ,
                        LogonIP = s.LogonIP
                        ,
                        LastLogonTime = s.LastLogonTime
                        ,
                        LastLogonIP = s.LastLogonIP
                        ,
                        PageStyle = s.PageStyle
                        ,
                        UpdatePerson = s.UpdatePerson
                        ,
                        Version = s.Version
                    }

                                            )
                }));
            }
            catch (Exception ex)
            {
                validationErrors.Add(ex.Message + "@");
                validationErrors.Add(ex.Source + "@");
                validationErrors.Add(ex.StackTrace + "@");
                validationErrors.Add(ex.HelpLink + "@");
                validationErrors.Add(ex.HResult.ToString() + "@");

                if (ex.InnerException != null && !string.IsNullOrWhiteSpace(ex.InnerException.Message))
                {
                    validationErrors.Add(ex.InnerException.Message);
                }
                if (ex.InnerException != null && !string.IsNullOrWhiteSpace(ex.InnerException.Source))
                {
                    validationErrors.Add(ex.InnerException.Source);
                }
                if (ex.InnerException != null && !string.IsNullOrWhiteSpace(ex.InnerException.StackTrace))
                {
                    validationErrors.Add(ex.InnerException.StackTrace);
                }
                if (ex.InnerException != null && null != (ex.InnerException.TargetSite))
                {
                    validationErrors.Add(ex.InnerException.TargetSite.Name);
                }

                if (ex.Data != null)
                {
                    validationErrors.Add(ex.Data.Count.ToString());
                }
                if (ex.Data != null)
                {
                    foreach (KeyValuePair <string, string> kvp in ex.Data.Keys)
                    {
                        validationErrors.Add(string.Format("姓名:{0},电影:{1}", kvp.Key, kvp.Value));
                    }
                }

                if (ex.TargetSite != null)
                {
                    validationErrors.Add(ex.TargetSite.Name);
                }
                if (ex.TargetSite != null)
                {
                    validationErrors.Add(ex.TargetSite.ReflectedType.ToString());
                }
                if (ex.TargetSite != null)
                {
                    validationErrors.Add(ex.TargetSite.Module.ToString());
                }
                if (ex.TargetSite != null)
                {
                    validationErrors.Add(ex.TargetSite.MethodImplementationFlags.ToString());
                }
                if (ex.TargetSite != null)
                {
                    validationErrors.Add(ex.TargetSite.MethodHandle.ToString());
                }
                if (ex.TargetSite != null)
                {
                    validationErrors.Add(ex.TargetSite.MetadataToken.ToString());
                }

                string returnValue = string.Empty;
                if (validationErrors != null && validationErrors.Count > 0)
                {
                    validationErrors.All(a =>
                    {
                        returnValue += a.ErrorMessage;
                        return(true);
                    });
                }
                LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",人员的信息,dd" + returnValue, "人员"
                                               );//写入日志
                ExceptionsHander.WriteExceptions(ex);
            }
            return(null);
        }
        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));
        }
        public ActionResult Save(ORDER_TASK_INFORMATION entity)
        {
            Common.ClientResult.OrderTaskGong result = new Common.ClientResult.OrderTaskGong();
            try
            {
                string currentPerson = GetCurrentPerson();
                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;
                        }
                    }
                    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 = currentPerson;
                    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 = currentPerson;
                        item.BAR_CODE_NUM = item.ID;
                        //二维码生成
                        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.FACTORY_NUM;//需要写入的字
                        //string xinghao = "123456789abcd";//需要写入的字
                        int w = imag.Width;
                        int h = imag.Height;
                        int y = 0;
                        int x = 380;
                        for (int i = 0; i < xinghao.Length; i++)
                        {
                            if (x > w)
                            {
                                result.Code    = Common.ClientCode.Fail;
                                result.Message = "内容太多二维码生成失败!";
                                return(Json(result));
                            }
                            else
                            {
                                if (i % 6 == 0)
                                {
                                    x = x + 50;
                                    y = 0;
                                    y = y + 45;
                                    g.DrawString(xinghao[i].ToString(), new Font("宋体", 14), Brushes.Red, new PointF(x, y));//x:值越大越靠右;y:值越小越靠上
                                }
                                else
                                {
                                    y = y + 45;
                                    g.DrawString(xinghao[i].ToString(), new Font("宋体", 14), Brushes.Red, new PointF(x, y));//x:值越大越靠右;y:值越小越靠上
                                }
                            }
                        }
                        System.Drawing.Image ig = CombinImage(imag, ms);
                        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       = currentPerson,
                                DISTRIBUTIONTIME         = DateTime.Now,
                                CREATEPERSON             = currentPerson,
                                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)
            {
                ExceptionsHander.WriteExceptions(lastError);//将异常写入数据库
            }
            return(Json(result));
        }
        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);
        }
Пример #5
0
        //工作量统计分析
        public JsonResult GetData(string id = "", int page = 11, int rows = 11, string order = "", string sort = "", string search = "")
        {
            try
            {
                int total = 0;
                page = 1;
                rows = 9999;
                List <SHIYANSHIGONGZUO_Result> queryData = m_BLL.GetByParam(id, page, rows, order, sort, search, ref total);
                return(Json(new datagrid
                {
                    total = total,
                    rows = queryData.Select(s => new
                    {
                        ID = s.ID
                        ,
                        WEITUODAN = s.WEITUODAN
                        ,
                        JIANDINGWANCHENG = s.JIANDINGWANCHENG
                        ,
                        SHEBEIGUZHANG = s.SHEBEIGUZHANG
                        ,
                        PIZHUNTONGGUO = s.PIZHUNTONGGUO
                        ,
                        HEGE = s.HEGE
                        ,
                        BUHEGE = s.BUHEGE
                        ,
                        CHAOQI = s.CHAOQI
                    }

                                            )
                }));
            }
            catch (Exception ex)
            {
                validationErrors.Add(ex.Message + "@");
                validationErrors.Add(ex.Source + "@");
                validationErrors.Add(ex.StackTrace + "@");
                validationErrors.Add(ex.HelpLink + "@");
                validationErrors.Add(ex.HResult.ToString() + "@");

                if (ex.InnerException != null && !string.IsNullOrWhiteSpace(ex.InnerException.Message))
                {
                    validationErrors.Add(ex.InnerException.Message);
                }
                if (ex.InnerException != null && !string.IsNullOrWhiteSpace(ex.InnerException.Source))
                {
                    validationErrors.Add(ex.InnerException.Source);
                }
                if (ex.InnerException != null && !string.IsNullOrWhiteSpace(ex.InnerException.StackTrace))
                {
                    validationErrors.Add(ex.InnerException.StackTrace);
                }
                if (ex.InnerException != null && null != (ex.InnerException.TargetSite))
                {
                    validationErrors.Add(ex.InnerException.TargetSite.Name);
                }

                if (ex.Data != null)
                {
                    validationErrors.Add(ex.Data.Count.ToString());
                }
                if (ex.Data != null)
                {
                    foreach (KeyValuePair <string, string> kvp in ex.Data.Keys)
                    {
                        validationErrors.Add(string.Format("姓名:{0},电影:{1}", kvp.Key, kvp.Value));
                    }
                }

                if (ex.TargetSite != null)
                {
                    validationErrors.Add(ex.TargetSite.Name);
                }
                if (ex.TargetSite != null)
                {
                    validationErrors.Add(ex.TargetSite.ReflectedType.ToString());
                }
                if (ex.TargetSite != null)
                {
                    validationErrors.Add(ex.TargetSite.Module.ToString());
                }
                if (ex.TargetSite != null)
                {
                    validationErrors.Add(ex.TargetSite.MethodImplementationFlags.ToString());
                }
                if (ex.TargetSite != null)
                {
                    validationErrors.Add(ex.TargetSite.MethodHandle.ToString());
                }
                if (ex.TargetSite != null)
                {
                    validationErrors.Add(ex.TargetSite.MetadataToken.ToString());
                }

                string returnValue = string.Empty;
                if (validationErrors != null && validationErrors.Count > 0)
                {
                    validationErrors.All(a =>
                    {
                        returnValue += a.ErrorMessage;
                        return(true);
                    });
                }
                LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",人员的信息,dd" + returnValue, "人员"
                                               );//写入日志
                ExceptionsHander.WriteExceptions(ex);
                throw ex;
            }
        }