示例#1
0
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="data">要更新的数据</param>
        /// <returns>操作是否成功的标志</returns>
        public bool Update(View_ZPX_CVTOffLineTestResult data)
        {
            DepotManagementDataContext context = CommentParameter.DepotDataContext;

            var result = from r in context.ZPX_CVTOffLineTestResult
                         where r.ID == data.编号
                         select r;

            if (result.Count() == 0)
            {
                throw new Exception("找不到要更新的记录,无法进行此操作");
            }

            ZPX_CVTOffLineTestResult updateData = result.Single();

            if (updateData.UserCode != GlobalObject.BasicInfo.LoginID)
            {
                throw new Exception("不是记录创建人员不允许进行此操作");
            }

            if (updateData.ReviewFlag)
            {
                throw new Exception("记录已经审核,不允许进行此操作");
            }

            View_ZPX_CVTOffLineTestResult old = (from r in context.View_ZPX_CVTOffLineTestResult
                                                 where r.编号 == data.编号
                                                 select r).Single();

            if (GlobalObject.StapleFunction.SimpleEqual <View_ZPX_CVTOffLineTestResult>(old, data))
            {
                throw new Exception("数据没有任何变化,不需要进行此操作");
            }

            PlatformManagement.ILogManagement log =
                PlatformManagement.PlatformFactory.GetObject <PlatformManagement.ILogManagement>();

            log.WriteUpdateLog <View_ZPX_CVTOffLineTestResult>(GlobalObject.BasicInfo.LoginID, "下线试验信息管理",
                                                               new List <string>(new string[] { "编号" }), old, data);

            updateData.ProductType   = data.产品型号;
            updateData.ProductNumber = data.产品箱号;
            updateData.Assembler     = data.预装员工号;
            updateData.Date          = ServerTime.Time;
            updateData.QualifiedFlag = data.合格标志;
            updateData.Fault         = data.故障现象;
            updateData.Remark        = data.备注;

            context.SubmitChanges();

            return(true);
        }
示例#2
0
        /// <summary>
        /// 更新说明
        /// </summary>
        /// <param name="data">要更新的数据</param>
        /// <returns>操作是否成功的标志</returns>
        public bool UpdateRemark(View_ZPX_CVTOffLineTestResult data)
        {
            DepotManagementDataContext context = CommentParameter.DepotDataContext;

            var result = from r in context.ZPX_CVTOffLineTestResult
                         where r.ID == data.编号
                         select r;

            if (result.Count() == 0)
            {
                throw new Exception("找不到要更新的记录,无法进行此操作");
            }

            ZPX_CVTOffLineTestResult updateData = result.Single();

            if (updateData.UserCode != GlobalObject.BasicInfo.LoginID)
            {
                throw new Exception("不是记录创建人员不允许进行此操作");
            }

            View_ZPX_CVTOffLineTestResult old = (from r in context.View_ZPX_CVTOffLineTestResult
                                                 where r.编号 == data.编号
                                                 select r).Single();

            PlatformManagement.ILogManagement log =
                PlatformManagement.PlatformFactory.GetObject <PlatformManagement.ILogManagement>();

            log.WriteUpdateLog <View_ZPX_CVTOffLineTestResult>(GlobalObject.BasicInfo.LoginID, "下线试验信息管理",
                                                               new List <string>(new string[] { "编号" }), old, data);

            updateData.Remark = data.备注;

            context.SubmitChanges();

            return(true);
        }