Exemple #1
0
 /// <summary>
 /// 删除项目
 /// </summary>
 /// <param name="ids"></param>
 /// <returns></returns>
 public static bool DeleteProjectByIds(string ids, out string errMsg)
 {
     errMsg = "";
     try
     {
         SqlParameter[] para = new SqlParameter[]
         {
             new SqlParameter("@model", "Project"),
             new SqlParameter("@ids", ids),
             new SqlParameter("@return", SqlDbType.Bit)
         };
         para[2].Direction = ParameterDirection.ReturnValue;
         int i        = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_ModelByIdsDelete", para);
         int stateTag = (int)para[2].Value;
         if (stateTag > 0)
         {
             if (i > 0)
             {
                 EventLog e = new EventLog();
                 e.TargetIds = ids.ToString();
                 e.CodeTag   = "DeleteProjectByIds";
                 e.LogName   = "删除项目";
                 EventLogService.AddEventLog <Model.Project>(e, null);
                 return(true);
             }
             else
             {
                 errMsg = "该记录已被删除!";
                 return(false);
             }
         }
         else if (stateTag == 0)
         {
             errMsg = "选中记录中有关联数据不能删除!";
             return(false);
         }
         else if (stateTag == -1)
         {
             errMsg = "网络繁忙,请稍后再试!";
             return(false);
         }
         else
         {
             errMsg = "未知异常!";
             return(false);
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         ErrorLog e = new ErrorLog();
         e.TargetIds = ids.ToString();
         e.CodeTag   = "DeleteProjectByIds";
         e.LogName   = "删除项目";
         e.ErrorMsg  = ex.Message.ToString();
         ErrorLogService.AddErrorLog <Model.Project>(e, null);
         return(false);
     }
 }
Exemple #2
0
 /// <summary>
 /// 根据id修改试件
 /// </summary>
 /// <param name="Model.Piece"></param>
 /// <returns></returns>
 public static bool ModifyPieceById(ref Model.Piece model, out string errMsg)
 {
     errMsg = "";
     try
     {
         model.Name        = model.Name.Trim();
         model.Description = model.Description.Trim();
         SqlParameter[] para = new SqlParameter[]
         {
             new SqlParameter("@Id", model.Id),
             new SqlParameter("@Name", model.Name),
             new SqlParameter("@Number", model.Number),
             new SqlParameter("@Order", model.Order),
             new SqlParameter("@Count", model.Count),
             new SqlParameter("@PrintedCount", model.PrintedCount),
             new SqlParameter("@IsPrinted", model.IsPrinted),
             new SqlParameter("@Ots", model.Ots),
             new SqlParameter("@DelegateNumber", model.DelegateNumber),
             new SqlParameter("@AccessoryFactory", model.AccessoryFactory),
             new SqlParameter("@VehicleType", model.VehicleType),
             new SqlParameter("@TestContent", model.TestContent),
             new SqlParameter("@SendPerson", model.SendPerson),
             new SqlParameter("@ChargePerson", model.ChargePerson),
             new SqlParameter("@SendDate", model.SendDate),
             new SqlParameter("@Place", model.Place),
             new SqlParameter("@IsEnable", model.IsEnable),
             new SqlParameter("@Description", model.Description),
             new SqlParameter("@Modifier", model.Modifier),
             new SqlParameter("@ModifiedDate", model.ModifiedDate)
         };
         int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_PieceByIdUpdate", para);
         if (i > 0)
         {
             EventLog e = new EventLog();
             e.TargetIds = model.Id.ToString();
             e.CodeTag   = "ModifyPieceById";
             e.LogName   = "修改试件";
             EventLogService.AddEventLog <Model.Piece>(e, model);
             return(true);
         }
         else
         {
             errMsg = "该记录已被删除,不能修改!";
             return(false);
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         ErrorLog e = new ErrorLog();
         e.TargetIds = model.Id.ToString();
         e.CodeTag   = "ModifyPieceById";
         e.LogName   = "修改试件";
         e.ErrorMsg  = ex.Message.ToString();
         ErrorLogService.AddErrorLog <Model.Piece>(e, model);
         return(false);
     }
 }
Exemple #3
0
        /// <summary>
        /// 修改账户密码
        /// </summary>
        /// <param name="Model.User"></param>
        /// <returns></returns>
        public static bool Updatepwd(ref Model.Accountpwd model, out string errMsg)
        {
            int outState = 0;

            errMsg = "";
            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@User", model.User),
                    new SqlParameter("@OldPassword", model.OldPassword.Trim()),
                    new SqlParameter("@NewPassword", model.NewPassword.Trim()),
                    new SqlParameter("@OutState", outState)
                };
                para[3].Direction = ParameterDirection.Output;
                int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_AccountpwdUpdate", para);
                if (i > 0)
                {
                    EventLog e = new EventLog();
                    e.TargetIds = model.User.ToString();
                    e.CodeTag   = "Updatepwd";
                    e.LogName   = "修改账户密码";
                    EventLogService.AddEventLog <Model.Accountpwd>(e, model);
                    return(true);
                }
                else
                {
                    outState = (int)para[3].Value;
                    if (outState == -1)
                    {
                        errMsg = "用户已被其他用户删除,不能修改密码";
                    }
                    else if (outState == -2)
                    {
                        errMsg = "密码错误";
                    }
                    else
                    {
                        errMsg = "未知错误";
                    }
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                ErrorLog e = new ErrorLog();
                e.TargetIds = model.User.ToString();
                e.CodeTag   = "Updatepwd";
                e.LogName   = "修改密码";
                e.ErrorMsg  = ex.Message.ToString();
                ErrorLogService.AddErrorLog <Model.Accountpwd>(e, model);
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <returns></returns>
        public static bool Login(ref Model.Login login, out string errMsg)
        {
            try
            {
                errMsg = "";
                string         sql  = "select Id,Name,Role,IsEnable from [User] where (Phone = @LogName and Password = @LogPassword) or (Email = @LogName and Password = @LogPassword)";
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@LogName", login.LogName.Trim()),
                    new SqlParameter("@LogPassword", login.LogPassword)
                };
                DataTable dtUser = DBHelper.ExecuteGetDataTable(CommandType.Text, sql, para);
                if (dtUser.Rows.Count > 0)
                {
                    DataRow dr = dtUser.Rows[0];
                    if ((bool)dr["IsEnable"])
                    {
                        login.LogId    = (int)dr["Id"];
                        login.IsPassed = true;

                        EventLog e = new EventLog();
                        e.TargetIds = login.LogId.ToString();
                        e.CodeTag   = "Login";
                        e.LogName   = "用户登录";
                        EventLogService.AddEventLog <Model.Login>(e, login);
                        return(true);
                    }
                    else
                    {
                        errMsg         = "该用户已被禁用";
                        login.IsPassed = false;
                        return(false);
                    }
                }
                else
                {
                    errMsg         = "用户名或密码不正确";
                    login.IsPassed = false;
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                ErrorLog e = new ErrorLog();
                e.TargetIds = login.LogId.ToString();
                e.CodeTag   = "Login";
                e.LogName   = "用户登录";
                e.ErrorMsg  = ex.Message.ToString();
                ErrorLogService.AddErrorLog <Model.Login>(e, login);
                return(false);
            }
        }
Exemple #5
0
 /// <summary>
 /// 添加用户
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static bool AddUser(ref Model.User model, out string errMsg)
 {
     errMsg = "";
     try
     {
         model.Name      = model.Name.Trim();
         model.Phone     = model.Phone.Trim();
         model.Email     = model.Email.Trim();
         model.Signature = model.Signature.Trim();
         SqlParameter[] para = new SqlParameter[]
         {
             new SqlParameter("@Name", model.Name),
             new SqlParameter("@Phone", model.Phone),
             new SqlParameter("@Email", model.Email),
             new SqlParameter("@Role", model.Role),
             new SqlParameter("@Signature", model.Signature),
             new SqlParameter("@IsSignNeeded", model.IsSignNeeded),
             new SqlParameter("@Creater", model.Creater),
             new SqlParameter("@CreatedDate", model.CreatedDate),
             new SqlParameter("@Modifier", model.Modifier),
             new SqlParameter("@ModifiedDate", model.ModifiedDate),
             new SqlParameter("@return", SqlDbType.Int)
         };
         para[10].Direction = ParameterDirection.ReturnValue;
         int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_UserInsert", para);
         if (i > 0)
         {
             model.Id = int.Parse(para[10].Value.ToString());
             EventLog e = new EventLog();
             e.TargetIds = para[10].Value.ToString();
             e.CodeTag   = "AddUser";
             e.LogName   = "添加用户";
             EventLogService.AddEventLog <Model.User>(e, model);
             return(true);
         }
         else
         {
             errMsg = "添加记录失败,受影响行数为0";
             return(false);
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         ErrorLog e = new ErrorLog();
         e.TargetIds = "0";
         e.CodeTag   = "AddUser";
         e.LogName   = "添加用户";
         e.ErrorMsg  = ex.Message.ToString();
         ErrorLogService.AddErrorLog <Model.User>(e, model);
         return(false);
     }
 }
Exemple #6
0
 /// <summary>
 /// 添加车辆
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static bool AddCar(ref Model.Car model, out string errMsg)
 {
     errMsg = "";
     try
     {
         model.Number      = model.Number.Trim();
         model.Vin         = model.Vin.Trim();
         model.Model       = model.Model.Trim();
         model.Description = model.Description.Trim();
         SqlParameter[] para = new SqlParameter[]
         {
             new SqlParameter("@Number", model.Number),
             new SqlParameter("@Vin", model.Vin),
             new SqlParameter("@Model", model.Model),
             new SqlParameter("@Description", model.Description),
             new SqlParameter("@Creater", model.Creater),
             new SqlParameter("@CreatedDate", model.CreatedDate),
             new SqlParameter("@Modifier", model.Modifier),
             new SqlParameter("@ModifiedDate", model.ModifiedDate),
             new SqlParameter("@return", SqlDbType.Int)
         };
         para[8].Direction = ParameterDirection.ReturnValue;
         int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_CarInsert", para);
         if (i > 0)
         {
             model.Id = int.Parse(para[8].Value.ToString());
             EventLog e = new EventLog();
             e.TargetIds = para[8].Value.ToString();
             e.CodeTag   = "AddCar";
             e.LogName   = "添加车辆";
             EventLogService.AddEventLog <Model.Car>(e, model);
             return(true);
         }
         else
         {
             errMsg = "添加记录失败,受影响行数为0";
             return(false);
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         ErrorLog e = new ErrorLog();
         e.TargetIds = "0";
         e.CodeTag   = "AddCar";
         e.LogName   = "添加车辆";
         e.ErrorMsg  = ex.Message.ToString();
         ErrorLogService.AddErrorLog <Model.Car>(e, model);
         return(false);
     }
 }
Exemple #7
0
 /// <summary>
 /// 根据id修改用户
 /// </summary>
 /// <param name="Model.User"></param>
 /// <returns></returns>
 public static bool ModifyUserById(ref Model.User model, out string errMsg)
 {
     errMsg = "";
     try
     {
         model.Name      = model.Name.Trim();
         model.Phone     = model.Phone.Trim();
         model.Email     = model.Email.Trim();
         model.Signature = model.Signature.Trim();
         SqlParameter[] para = new SqlParameter[]
         {
             new SqlParameter("@Id", model.Id),
             new SqlParameter("@Name", model.Name.Trim()),
             new SqlParameter("@Phone", model.Phone.Trim()),
             new SqlParameter("@Email", model.Email.Trim()),
             new SqlParameter("@Role", model.Role),
             new SqlParameter("@Signature", model.Signature.Trim()),
             new SqlParameter("@IsSignNeeded", model.IsSignNeeded),
             new SqlParameter("@IsEnable", model.IsEnable),
             new SqlParameter("@Modifier", model.Modifier),
             new SqlParameter("@ModifiedDate", model.ModifiedDate)
         };
         int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_UserByIdUpdate", para);
         if (i > 0)
         {
             EventLog e = new EventLog();
             e.TargetIds = model.Id.ToString();
             e.CodeTag   = "ModifyUserById";
             e.LogName   = "修改用户";
             EventLogService.AddEventLog <Model.User>(e, model);
             return(true);
         }
         else
         {
             errMsg = "该记录已被删除,不能修改!";
             return(false);
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         ErrorLog e = new ErrorLog();
         e.TargetIds = model.Id.ToString();
         e.CodeTag   = "ModifyUserById";
         e.LogName   = "修改用户";
         e.ErrorMsg  = ex.Message.ToString();
         ErrorLogService.AddErrorLog <Model.User>(e, model);
         return(false);
     }
 }
Exemple #8
0
 /// <summary>
 /// 添加角色
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static bool AddRole(ref Model.Role model, out string errMsg)
 {
     errMsg = "";
     try
     {
         model.Name        = model.Name.Trim();
         model.Description = model.Description.Trim();
         int[]          powers      = model.Powers.ToArray();
         string[]       arrayPowers = Array.ConvertAll(powers, delegate(int s) { return(s.ToString()); });
         SqlParameter[] para        = new SqlParameter[]
         {
             new SqlParameter("@Name", model.Name),
             new SqlParameter("@Powers", string.Join(",", arrayPowers)),
             new SqlParameter("@Description", model.Description),
             new SqlParameter("@Creater", model.Creater),
             new SqlParameter("@CreatedDate", model.CreatedDate),
             new SqlParameter("@Modifier", model.Modifier),
             new SqlParameter("@ModifiedDate", model.ModifiedDate),
             new SqlParameter("@return", SqlDbType.Int)
         };
         para[7].Direction = ParameterDirection.ReturnValue;
         int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_RoleInsert", para);
         if (i > 0)
         {
             model.Id = int.Parse(para[7].Value.ToString());
             EventLog e = new EventLog();
             e.TargetIds = para[7].Value.ToString();
             e.CodeTag   = "AddRole";
             e.LogName   = "添加角色";
             EventLogService.AddEventLog <Model.Role>(e, model);
             return(true);
         }
         else
         {
             errMsg = "添加记录失败,受影响行数为0";
             return(false);
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         ErrorLog e = new ErrorLog();
         e.TargetIds = "0";
         e.CodeTag   = "AddRole";
         e.LogName   = "添加角色";
         e.ErrorMsg  = ex.Message.ToString();
         ErrorLogService.AddErrorLog <Model.Role>(e, model);
         return(false);
     }
 }
Exemple #9
0
        /// <summary>
        /// 添加驾驶员签名
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool AddSignature(ref Signature model, out string errMsg)
        {
            errMsg = "";
            bool result;

            try
            {
                model.Name = model.Name.Trim();
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@Name", model.Name),
                    new SqlParameter("@Sign", Convert.FromBase64String(model.Sign)),
                    new SqlParameter("@Creater", model.Creater),
                    new SqlParameter("@CreatedDate", model.CreatedDate),
                    new SqlParameter("@return", SqlDbType.Int)
                };
                para[4].Direction = ParameterDirection.ReturnValue;
                int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_SignatureInsert", para);
                if (i > 0)
                {
                    model.Id = int.Parse(para[4].Value.ToString());
                    EventLog e = new EventLog();
                    e.TargetIds = para[4].Value.ToString();
                    e.CodeTag   = "AddSignature";
                    e.LogName   = "添加驾驶员签名";
                    EventLogService.AddEventLog <Model.Signature>(e, model);
                    return(true);
                }
                else
                {
                    errMsg = "添加记录失败,受影响行数为0";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                ErrorLogService.AddErrorLog <Signature>(new ErrorLog
                {
                    TargetIds = "0",
                    CodeTag   = "AddSignature",
                    LogName   = "添加驾驶员签名",
                    ErrorMsg  = ex.Message.ToString()
                }, model);
                result = false;
            }
            return(result);
        }
Exemple #10
0
 /// <summary>
 /// 根据id修改加油单
 /// </summary>
 /// <param name="Model.Bill"></param>
 /// <returns></returns>
 public static bool ModifyBillById(ref Model.Bill model, out string errMsg)
 {
     errMsg = "";
     try
     {
         model.DriverName = model.DriverName.Trim();
         SqlParameter[] para = new SqlParameter[]
         {
             new SqlParameter("@Id", model.Id),
             new SqlParameter("@Project", model.Project),
             new SqlParameter("@Department", model.Department),
             new SqlParameter("@Oil", model.Oil),
             new SqlParameter("@Volume", model.Volume),
             new SqlParameter("@Mileage", model.Mileage),
             new SqlParameter("@DriverName", model.DriverName),
             new SqlParameter("@Rate", model.Rate),
             new SqlParameter("@Time", model.Time),
             new SqlParameter("@Modifier", model.Modifier),
             new SqlParameter("@ModifiedDate", model.ModifiedDate)
         };
         int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_BillByIdUpdate", para);
         if (i > 0)
         {
             EventLog e = new EventLog();
             e.TargetIds = model.Id.ToString();
             e.CodeTag   = "ModifyBillById";
             e.LogName   = "修改加油单";
             EventLogService.AddEventLog <Model.Bill>(e, model);
             return(true);
         }
         else
         {
             errMsg = "该记录已被删除,不能修改!";
             return(false);
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         ErrorLog e = new ErrorLog();
         e.TargetIds = model.Id.ToString();
         e.CodeTag   = "ModifyBillById";
         e.LogName   = "修改加油单";
         e.ErrorMsg  = ex.Message.ToString();
         ErrorLogService.AddErrorLog <Model.Bill>(e, model);
         return(false);
     }
 }
Exemple #11
0
 /// <summary>
 /// 根据id修改车辆
 /// </summary>
 /// <param name="Model.Car"></param>
 /// <returns></returns>
 public static bool ModifyCarById(ref Model.Car model, out string errMsg)
 {
     errMsg = "";
     try
     {
         model.Number      = model.Number.Trim();
         model.Vin         = model.Vin.Trim();
         model.Model       = model.Model.Trim();
         model.Description = model.Description.Trim();
         SqlParameter[] para = new SqlParameter[]
         {
             new SqlParameter("@Id", model.Id),
             new SqlParameter("@Number", model.Number),
             new SqlParameter("@Vin", model.Vin),
             new SqlParameter("@Model", model.Model),
             new SqlParameter("@Description", model.Description),
             new SqlParameter("@Modifier", model.Modifier),
             new SqlParameter("@ModifiedDate", model.ModifiedDate)
         };
         int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_CarByIdUpdate", para);
         if (i > 0)
         {
             EventLog e = new EventLog();
             e.TargetIds = model.Id.ToString();
             e.CodeTag   = "ModifyCarById";
             e.LogName   = "修改车辆";
             EventLogService.AddEventLog <Model.Car>(e, model);
             return(true);
         }
         else
         {
             errMsg = "该记录已被删除,不能修改!";
             return(false);
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         ErrorLog e = new ErrorLog();
         e.TargetIds = model.Id.ToString();
         e.CodeTag   = "ModifyCarById";
         e.LogName   = "修改车辆";
         e.ErrorMsg  = ex.Message.ToString();
         ErrorLogService.AddErrorLog <Model.Car>(e, model);
         return(false);
     }
 }
Exemple #12
0
 /// <summary>
 /// 根据id修改角色
 /// </summary>
 /// <param name="Model.Role"></param>
 /// <returns></returns>
 public static bool ModifyRoleById(ref Model.Role model, out string errMsg)
 {
     errMsg = "";
     try
     {
         model.Name        = model.Name.Trim();
         model.Description = model.Description.Trim();
         int[]          powers      = model.Powers.ToArray();
         string[]       powersArray = Array.ConvertAll(powers, delegate(int s) { return(s.ToString()); });
         SqlParameter[] para        = new SqlParameter[]
         {
             new SqlParameter("@Id", model.Id),
             new SqlParameter("@Name", model.Name),
             new SqlParameter("@Powers", string.Join(",", powersArray)),
             new SqlParameter("@Description", model.Description),
             new SqlParameter("@Modifier", model.Modifier),
             new SqlParameter("@ModifiedDate", model.ModifiedDate)
         };
         int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_RoleByIdUpdate", para);
         if (i > 0)
         {
             EventLog e = new EventLog();
             e.TargetIds = model.Id.ToString();
             e.CodeTag   = "ModifyRoleById";
             e.LogName   = "修改角色";
             EventLogService.AddEventLog <Model.Role>(e, model);
             return(true);
         }
         else
         {
             errMsg = "该记录已被删除,不能修改!";
             return(false);
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         ErrorLog e = new ErrorLog();
         e.TargetIds = model.Id.ToString();
         e.CodeTag   = "ModifyRoleById";
         e.LogName   = "修改角色";
         e.ErrorMsg  = ex.Message.ToString();
         ErrorLogService.AddErrorLog <Model.Role>(e, model);
         return(false);
     }
 }
Exemple #13
0
 /// <summary>
 /// 根据id修改偏好设置
 /// </summary>
 /// <param name="Model.Preference"></param>
 /// <returns></returns>
 public static bool ModifyPreferenceById(ref Model.Preference model, out string errMsg)
 {
     errMsg = "";
     try
     {
         SqlParameter[] para = new SqlParameter[]
         {
             new SqlParameter("@Id", model.Id),
             new SqlParameter("@ShortcutHour", model.ShortcutHour),
             new SqlParameter("@FinishHour", model.FinishHour),
             new SqlParameter("@Modifier", model.Modifier),
             new SqlParameter("@ModifiedDate", model.ModifiedDate)
         };
         int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_PreferenceByIdUpdate", para);
         if (i > 0)
         {
             EventLog e = new EventLog();
             e.TargetIds = model.Id.ToString();
             e.CodeTag   = "ModifyPreferenceById";
             e.LogName   = "修改偏好设置";
             EventLogService.AddEventLog <Model.Preference>(e, model);
             return(true);
         }
         else
         {
             errMsg = "该记录已被删除,不能修改!";
             return(false);
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         ErrorLog e = new ErrorLog();
         e.TargetIds = model.Id.ToString();
         e.CodeTag   = "ModifyPreferenceById";
         e.LogName   = "修改偏好设置";
         e.ErrorMsg  = ex.Message.ToString();
         ErrorLogService.AddErrorLog <Model.Preference>(e, model);
         return(false);
     }
 }
Exemple #14
0
 /// <summary>
 /// 根据id打印试件
 /// </summary>
 /// <param name="Model.Piece"></param>
 /// <returns></returns>
 public static bool PrintPieceById(ref Model.PiecePrinter model, out string errMsg)
 {
     errMsg = "";
     try
     {
         SqlParameter[] para = new SqlParameter[]
         {
             new SqlParameter("@Id", model.Id),
             new SqlParameter("@Count", model.Count),
             new SqlParameter("@Modifier", model.Modifier),
             new SqlParameter("@ModifiedDate", model.ModifiedDate)
         };
         int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_PiecePrint", para);
         if (i > 0)
         {
             EventLog e = new EventLog();
             e.TargetIds = model.Id.ToString();
             e.CodeTag   = "PrintPieceById";
             e.LogName   = "打印试件";
             EventLogService.AddEventLog <Model.PiecePrinter>(e, model);
             return(true);
         }
         else
         {
             errMsg = "该试件已被删除,不能打印!";
             return(false);
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         ErrorLog e = new ErrorLog();
         e.TargetIds = model.Id.ToString();
         e.CodeTag   = "ModifyPieceById";
         e.LogName   = "打印试件";
         e.ErrorMsg  = ex.Message.ToString();
         ErrorLogService.AddErrorLog <Model.PiecePrinter>(e, model);
         return(false);
     }
 }
Exemple #15
0
 /// <summary>
 /// 密码重置
 /// </summary>
 /// <param name="Model.User"></param>
 /// <returns></returns>
 public static bool Resetpwd(ref Model.Resetpwd model, out string errMsg)
 {
     errMsg = "";
     try
     {
         SqlParameter[] para = new SqlParameter[]
         {
             new SqlParameter("@User", model.User),
             new SqlParameter("@NewPassword", model.NewPassword.Trim())
         };
         int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_UserResetpwd", para);
         if (i > 0)
         {
             EventLog e = new EventLog();
             e.TargetIds = model.User.ToString();
             e.CodeTag   = "Resetpwd";
             e.LogName   = "密码重置";
             EventLogService.AddEventLog <Model.Resetpwd>(e, model);
             return(true);
         }
         else
         {
             errMsg = "该记录已被删除,不能执行密码重置";
             return(false);
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         ErrorLog e = new ErrorLog();
         e.TargetIds = model.User.ToString();
         e.CodeTag   = "Resetpwd";
         e.LogName   = "密码重置";
         e.ErrorMsg  = ex.Message.ToString();
         ErrorLogService.AddErrorLog <Model.Resetpwd>(e, model);
         return(false);
     }
 }
Exemple #16
0
        /// <summary>
        /// 取回申请单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool RecaptureTrace(ref Model.Tracerecapture model, out string errMsg)
        {
            errMsg = "";
            try
            {
                model.EndInfo = model.EndInfo.Trim();
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@Trace", model.Trace),
                    new SqlParameter("@Instance", model.Instance),
                    new SqlParameter("@Car", model.Car),
                    new SqlParameter("@EndInfo", model.EndInfo),
                    new SqlParameter("@Creater", model.Creater),
                    new SqlParameter("@CreatedDate", model.CreatedDate),
                    new SqlParameter("@OutState", SqlDbType.Int),
                    new SqlParameter("@return", SqlDbType.Int)
                };
                para[6].Direction = ParameterDirection.Output;
                para[7].Direction = ParameterDirection.ReturnValue;
                DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_TraceRecapture", para);
                int outState    = int.Parse(para[6].Value.ToString());
                int returnValue = int.Parse(para[7].Value.ToString());
                if (returnValue > 0)
                {
                    EventLog e = new EventLog();
                    e.TargetIds = returnValue.ToString();
                    e.CodeTag   = "RecaptureTrace";
                    e.LogName   = "取回申请单";
                    EventLogService.AddEventLog <Model.Tracerecapture>(e, model);
                    return(true);
                }
                else
                {
                    switch (outState)
                    {
                    case -100:
                        errMsg = "该申请单处于非待审核状态,可能已被其他用户取回,不能取回申请单";
                        break;

                    case -200:
                        errMsg = "该申请单待审核履历已结束,可能已被其他用户取回,不能取回申请单";
                        break;

                    case -1:
                        errMsg = "更新申请单履历信息失败";
                        break;

                    case -2:
                        errMsg = "更新申请单信息失败";
                        break;

                    case -3:
                        errMsg = "更新车辆信息失败";
                        break;

                    default:
                        errMsg = "异常错误";
                        break;
                    }
                    ErrorLog e = new ErrorLog();
                    e.TargetIds = model.Car.ToString();
                    e.CodeTag   = "RecaptureTrace";
                    e.LogName   = "取回申请单";
                    e.ErrorMsg  = errMsg;
                    ErrorLogService.AddErrorLog <Model.Tracerecapture>(e, model);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                ErrorLog e = new ErrorLog();
                e.TargetIds = "0";
                e.CodeTag   = "RecaptureTrace";
                e.LogName   = "取回申请单";
                e.ErrorMsg  = ex.Message.ToString();
                ErrorLogService.AddErrorLog <Model.Tracerecapture>(e, model);
                return(false);
            }
        }
Exemple #17
0
        /// <summary>
        /// 试件还原
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool RestorePiece(ref Model.Piecerestore model, out string errMsg)
        {
            errMsg = "";
            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@Piece", model.Piece),
                    new SqlParameter("@Creater", model.Creater),
                    new SqlParameter("@CreatedDate", model.CreatedDate),
                    new SqlParameter("@OutState", SqlDbType.Int),
                    new SqlParameter("@return", SqlDbType.Int)
                };
                para[3].Direction = ParameterDirection.Output;
                para[4].Direction = ParameterDirection.ReturnValue;
                DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_PieceRestore", para);
                int outState    = int.Parse(para[3].Value.ToString());
                int returnValue = int.Parse(para[4].Value.ToString());
                if (returnValue > 0)
                {
                    EventLog e = new EventLog();
                    e.TargetIds = returnValue.ToString();
                    e.CodeTag   = "RestorePiece";
                    e.LogName   = "试件还原";
                    EventLogService.AddEventLog <Model.Piecerestore>(e, model);
                    return(true);
                }
                else
                {
                    switch (outState)
                    {
                    case -100:
                        errMsg = "该试件下有申请单没有归档,不能归档该试件";
                        break;

                    case -1:
                        errMsg = "归档试件失败";
                        break;

                    default:
                        errMsg = "异常错误";
                        break;
                    }
                    ErrorLog e = new ErrorLog();
                    e.TargetIds = model.Piece.ToString();
                    e.CodeTag   = "RestorePiece";
                    e.LogName   = "试件还原";
                    e.ErrorMsg  = errMsg;
                    ErrorLogService.AddErrorLog <Model.Piecerestore>(e, model);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                ErrorLog e = new ErrorLog();
                e.TargetIds = "0";
                e.CodeTag   = "RestorePiece";
                e.LogName   = "试件还原";
                e.ErrorMsg  = ex.Message.ToString();
                ErrorLogService.AddErrorLog <Model.Piecerestore>(e, model);
                return(false);
            }
        }
Exemple #18
0
 /// <summary>
 /// 添加试件
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static bool AddPiece(ref Model.Piece model, out string errMsg)
 {
     errMsg = "";
     try
     {
         model.Name        = model.Name.Trim();
         model.Description = model.Description.Trim();
         SqlParameter[] para = new SqlParameter[]
         {
             new SqlParameter("@Name", model.Name),
             new SqlParameter("@Number", model.Number),
             new SqlParameter("@Order", model.Order),
             new SqlParameter("@Count", model.Count),
             new SqlParameter("@PrintedCount", model.PrintedCount),
             new SqlParameter("@IsPrinted", model.IsPrinted),
             new SqlParameter("@Ots", model.Ots),
             new SqlParameter("@DelegateNumber", model.DelegateNumber),
             new SqlParameter("@AccessoryFactory", model.AccessoryFactory),
             new SqlParameter("@VehicleType", model.VehicleType),
             new SqlParameter("@TestContent", model.TestContent),
             new SqlParameter("@SendPerson", model.SendPerson),
             new SqlParameter("@ChargePerson", model.ChargePerson),
             new SqlParameter("@SendDate", model.SendDate),
             new SqlParameter("@Place", model.Place),
             new SqlParameter("@IsEnable", model.IsEnable),
             new SqlParameter("@Description", model.Description),
             new SqlParameter("@Creater", model.Creater),
             new SqlParameter("@CreatedDate", model.CreatedDate),
             new SqlParameter("@Modifier", model.Modifier),
             new SqlParameter("@ModifiedDate", model.ModifiedDate),
             new SqlParameter("@return", SqlDbType.Int)
         };
         para[21].Direction = ParameterDirection.ReturnValue;
         int i = DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_PieceInsert", para);
         if (i > 0)
         {
             model.Id = int.Parse(para[21].Value.ToString());
             EventLog e = new EventLog();
             e.TargetIds = para[21].Value.ToString();
             e.CodeTag   = "AddPiece";
             e.LogName   = "添加试件";
             EventLogService.AddEventLog <Model.Piece>(e, model);
             return(true);
         }
         else
         {
             errMsg = "添加记录失败,受影响行数为0";
             return(false);
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         ErrorLog e = new ErrorLog();
         e.TargetIds = "0";
         e.CodeTag   = "AddPiece";
         e.LogName   = "添加试件";
         e.ErrorMsg  = ex.Message.ToString();
         ErrorLogService.AddErrorLog <Model.Piece>(e, model);
         return(false);
     }
 }
Exemple #19
0
        /// <summary>
        /// 归档申请单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool ArchiveInstance(ref Model.Instancearchive model, out string errMsg)
        {
            errMsg = "";
            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@Instance", model.Instance),
                    new SqlParameter("@Car", model.Car),
                    new SqlParameter("@Creater", model.Creater),
                    new SqlParameter("@CreatedDate", model.CreatedDate),
                    new SqlParameter("@OutState", SqlDbType.Int),
                    new SqlParameter("@return", SqlDbType.Int)
                };
                para[4].Direction = ParameterDirection.Output;
                para[5].Direction = ParameterDirection.ReturnValue;
                DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_InstanceArchive", para);
                int outState    = int.Parse(para[4].Value.ToString());
                int returnValue = int.Parse(para[5].Value.ToString());
                if (returnValue > 0)
                {
                    EventLog e = new EventLog();
                    e.TargetIds = returnValue.ToString();
                    e.CodeTag   = "ArchiveInstance";
                    e.LogName   = "归档申请单";
                    EventLogService.AddEventLog <Model.Instancearchive>(e, model);
                    return(true);
                }
                else
                {
                    switch (outState)
                    {
                    case -100:
                        errMsg = "该申请单处于已归档状态,可能已被其他用户归档,不能重复归档";
                        break;

                    case -1:
                        errMsg = "更新申请单履历归档状态失败";
                        break;

                    case -2:
                        errMsg = "更新申请单归档状态失败";
                        break;

                    case -3:
                        errMsg = "更新车辆信息失败";
                        break;

                    default:
                        errMsg = "异常错误";
                        break;
                    }
                    ErrorLog e = new ErrorLog();
                    e.TargetIds = model.Car.ToString();
                    e.CodeTag   = "ArchiveInstance";
                    e.LogName   = "归档申请单";
                    e.ErrorMsg  = errMsg;
                    ErrorLogService.AddErrorLog <Model.Instancearchive>(e, model);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                ErrorLog e = new ErrorLog();
                e.TargetIds = "0";
                e.CodeTag   = "ArchiveInstance";
                e.LogName   = "归档申请单";
                e.ErrorMsg  = ex.Message.ToString();
                ErrorLogService.AddErrorLog <Model.Instancearchive>(e, model);
                return(false);
            }
        }
Exemple #20
0
        public static bool AddBill(ref Bill model, out string errMsg)
        {
            errMsg = "";
            bool result;

            try
            {
                model.DriverName = model.DriverName.Trim();
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@Car", model.Car),
                    new SqlParameter("@Instance", model.Instance),
                    new SqlParameter("@Project", model.Project),
                    new SqlParameter("@Department", model.Department),
                    new SqlParameter("@Oil", model.Oil),
                    new SqlParameter("@Volume", model.Volume),
                    new SqlParameter("@Mileage", model.Mileage),
                    new SqlParameter("@DriverName", model.DriverName),
                    new SqlParameter("@Signature", model.Signature),
                    new SqlParameter("@Rate", model.Rate),
                    new SqlParameter("@Oiler", model.Oiler),
                    new SqlParameter("@Time", model.Time),
                    new SqlParameter("@IsLost", model.IsLost),
                    new SqlParameter("@Creater", model.Creater),
                    new SqlParameter("@CreatedDate", model.CreatedDate),
                    new SqlParameter("@OutState", SqlDbType.Int),
                    new SqlParameter("@return", SqlDbType.Int)
                };
                para[15].Direction = ParameterDirection.Output;
                para[16].Direction = ParameterDirection.ReturnValue;
                DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_BillInsert", para);
                int outState    = int.Parse(para[15].Value.ToString());
                int returnValue = int.Parse(para[16].Value.ToString());
                if (returnValue > 0)
                {
                    model.Id = returnValue;
                    EventLogService.AddEventLog <Bill>(new EventLog
                    {
                        TargetIds = returnValue.ToString(),
                        CodeTag   = "AddBill",
                        LogName   = "添加加油单"
                    }, model);
                    result = true;
                }
                else
                {
                    switch (outState)
                    {
                    case -100:
                        errMsg = "该车辆下对应加油申请单已结束,不能加油";
                        break;

                    case -200:
                        errMsg = "该车辆下对应加油申请单没有通过审核或被审核员中止,不能加油";
                        break;

                    case -300:
                        errMsg = "该车辆下对应加油申请单已被暂停,不能加油";
                        break;

                    case -400:
                        errMsg = "该车辆下对应加油申请单可加油时间不在当前时间范围,不能加油";
                        break;

                    case -500:
                        errMsg = "车辆里程数重复,不能重复提交相同里程数的加油单";
                        break;

                    case -1:
                        errMsg = "添加加油单失败";
                        break;

                    case -2:
                        errMsg = "更新申请单信息失败";
                        break;

                    case -3:
                        errMsg = "更新车辆信息失败";
                        break;

                    default:
                        errMsg = "异常错误";
                        break;
                    }
                    ErrorLog e = new ErrorLog();
                    e.TargetIds = model.Car.ToString();
                    e.CodeTag   = "AddBill";
                    e.LogName   = "添加加油单";
                    e.ErrorMsg  = errMsg;
                    ErrorLogService.AddErrorLog <Model.Bill>(e, model);
                    result = false;
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                ErrorLogService.AddErrorLog <Bill>(new ErrorLog
                {
                    TargetIds = "0",
                    CodeTag   = "AddBill",
                    LogName   = "添加加油单",
                    ErrorMsg  = ex.Message.ToString()
                }, model);
                result = false;
            }
            return(result);
        }
Exemple #21
0
        /// <summary>
        /// 中止申请单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool AbortInstance(ref Model.Instanceabort model, out string errMsg)
        {
            errMsg = "";
            try
            {
                model.Status    = model.Status.Trim();
                model.StartInfo = model.StartInfo.Trim();
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@Trace", model.Trace),
                    new SqlParameter("@Instance", model.Instance),
                    new SqlParameter("@Car", model.Car),
                    new SqlParameter("@Status", model.Status),
                    new SqlParameter("@StartInfo", model.StartInfo),
                    new SqlParameter("@Creater", model.Creater),
                    new SqlParameter("@CreatedDate", model.CreatedDate),
                    new SqlParameter("@OutState", SqlDbType.Int),
                    new SqlParameter("@return", SqlDbType.Int)
                };
                para[7].Direction = ParameterDirection.Output;
                para[8].Direction = ParameterDirection.ReturnValue;
                DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_InstanceAbort", para);
                int outState    = int.Parse(para[7].Value.ToString());
                int returnValue = int.Parse(para[8].Value.ToString());
                if (returnValue > 0)
                {
                    EventLog e = new EventLog();
                    e.TargetIds = returnValue.ToString();
                    e.CodeTag   = "AbortInstance";
                    e.LogName   = "中止申请单";
                    EventLogService.AddEventLog <Model.Instanceabort>(e, model);
                    return(true);
                }
                else
                {
                    switch (outState)
                    {
                    case -100:
                        errMsg = "该申请单已被归档,不能中止";
                        break;

                    case -200:
                        errMsg = "该申请单处于待审核状态,不能中止";
                        break;

                    case -300:
                        errMsg = "该申请单处于未发布状态,不能中止";
                        break;

                    case -400:
                        errMsg = "该申请单已被禁用,不能中止";
                        break;

                    case -500:
                        errMsg = "该申请单最后一个履历处于未完成状态,不能中止";
                        break;

                    case -1:
                        errMsg = "添加申请单履历失败";
                        break;

                    case -2:
                        errMsg = "更新申请单中止状态失败";
                        break;

                    case -3:
                        errMsg = "更新车辆信息失败";
                        break;

                    default:
                        errMsg = "异常错误";
                        break;
                    }
                    ErrorLog e = new ErrorLog();
                    e.TargetIds = model.Car.ToString();
                    e.CodeTag   = "AbortInstance";
                    e.LogName   = "中止申请单";
                    e.ErrorMsg  = errMsg;
                    ErrorLogService.AddErrorLog <Model.Instanceabort>(e, model);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                ErrorLog e = new ErrorLog();
                e.TargetIds = "0";
                e.CodeTag   = "AbortInstance";
                e.LogName   = "中止申请单";
                e.ErrorMsg  = ex.Message.ToString();
                ErrorLogService.AddErrorLog <Model.Instanceabort>(e, model);
                return(false);
            }
        }
Exemple #22
0
        /// <summary>
        /// 新建申请单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool AddInstance(ref Model.Instancenew model, out string errMsg)
        {
            errMsg = "";
            try
            {
                model.UserName = model.UserName.Trim();
                int[]          oils      = model.Oils.ToArray();
                string[]       arrayOils = Array.ConvertAll(oils, delegate(int s) { return(s.ToString()); });
                SqlParameter[] para      = new SqlParameter[]
                {
                    new SqlParameter("@Car", model.Car),
                    new SqlParameter("@Project", model.Project),
                    new SqlParameter("@Department", model.Department),
                    new SqlParameter("@UserName", model.UserName),
                    new SqlParameter("@Oils", string.Join(",", arrayOils)),
                    new SqlParameter("@Goal", model.Goal.Trim()),
                    new SqlParameter("@StartDate", model.StartDate),
                    new SqlParameter("@EndDate", model.EndDate),
                    new SqlParameter("@StartInfo", model.StartInfo.Trim()),
                    new SqlParameter("@Creater", model.Creater),
                    new SqlParameter("@CreatedDate", model.CreatedDate),
                    new SqlParameter("@OutState", SqlDbType.Int),
                    new SqlParameter("@return", SqlDbType.Int)
                };
                para[11].Direction = ParameterDirection.Output;
                para[12].Direction = ParameterDirection.ReturnValue;
                DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_InstanceInsert", para);
                int outState    = int.Parse(para[11].Value.ToString());
                int returnValue = int.Parse(para[12].Value.ToString());
                if (returnValue > 0)
                {
                    EventLog e = new EventLog();
                    e.TargetIds = returnValue.ToString();
                    e.CodeTag   = "AddInstance";
                    e.LogName   = "新建申请单";
                    EventLogService.AddEventLog <Model.Instancenew>(e, model);
                    return(true);
                }
                else
                {
                    switch (outState)
                    {
                    case -100:
                        errMsg = "起止时间设置有误";
                        break;

                    case -1:
                        errMsg = "添加申请单失败";
                        break;

                    case -2:
                        errMsg = "添加申请单履历失败";
                        break;

                    case -3:
                        errMsg = "更新车辆信息失败";
                        break;

                    default:
                        errMsg = "异常错误";
                        break;
                    }
                    ErrorLog e = new ErrorLog();
                    e.TargetIds = model.Car.ToString();
                    e.CodeTag   = "AddInstance";
                    e.LogName   = "新建申请单";
                    e.ErrorMsg  = errMsg;
                    ErrorLogService.AddErrorLog <Model.Instancenew>(e, model);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                ErrorLog e = new ErrorLog();
                e.TargetIds = "0";
                e.CodeTag   = "AddInstance";
                e.LogName   = "新建申请单";
                e.ErrorMsg  = ex.Message.ToString();
                ErrorLogService.AddErrorLog <Model.Instancenew>(e, model);
                return(false);
            }
        }
Exemple #23
0
        /// <summary>
        /// 一键优化
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool OneTouchOptimize(ref Model.Optimizer model, out string errMsg)
        {
            errMsg = "";
            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@Creater", model.Creater),
                    new SqlParameter("@CreatedDate", model.CreatedDate),
                    new SqlParameter("@OutAllCarsCount", SqlDbType.Int),
                    new SqlParameter("@OutArchivedCarsCount", SqlDbType.Int),
                    new SqlParameter("@OutArchivedInstancesCount", SqlDbType.Int),
                    new SqlParameter("@OutState", SqlDbType.Int),
                    new SqlParameter("@return", SqlDbType.Int)
                };
                para[2].Direction = ParameterDirection.Output;
                para[3].Direction = ParameterDirection.Output;
                para[4].Direction = ParameterDirection.Output;
                para[5].Direction = ParameterDirection.Output;
                para[6].Direction = ParameterDirection.ReturnValue;
                DBHelper.ExecuteNonQuery(CommandType.StoredProcedure, "proc_OneTouchOptimize", para);
                int outAllCarsCount           = int.Parse(para[2].Value.ToString());
                int outArchivedCarsCount      = int.Parse(para[3].Value.ToString());
                int outArchivedInstancesCount = int.Parse(para[4].Value.ToString());
                int outState    = int.Parse(para[5].Value.ToString());
                int returnValue = int.Parse(para[6].Value.ToString());
                if (returnValue > 0)
                {
                    model.AllCarsCount           = outAllCarsCount;
                    model.ArchivedCarsCount      = outArchivedCarsCount;
                    model.ArchivedInstancesCount = outArchivedInstancesCount;
                    EventLog e = new EventLog();
                    e.TargetIds = returnValue.ToString();
                    e.CodeTag   = "OneTouchOptimize";
                    e.LogName   = "一键优化";
                    EventLogService.AddEventLog <Model.Optimizer>(e, model);
                    return(true);
                }
                else
                {
                    switch (outState)
                    {
                    case -1:
                        errMsg = "更新申请单履历归档状态失败";
                        break;

                    case -2:
                        errMsg = "更新申请单归档状态失败";
                        break;

                    case -3:
                        errMsg = "更新申请单关联车辆信息失败";
                        break;

                    case -11:
                        errMsg = "归档车辆失败";
                        break;

                    default:
                        errMsg = "异常错误";
                        break;
                    }
                    ErrorLog e = new ErrorLog();
                    e.TargetIds = "0";
                    e.CodeTag   = "OneTouchOptimize";
                    e.LogName   = "一键优化";
                    e.ErrorMsg  = errMsg;
                    ErrorLogService.AddErrorLog <Model.Optimizer>(e, model);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                ErrorLog e = new ErrorLog();
                e.TargetIds = "0";
                e.CodeTag   = "OneTouchOptimize";
                e.LogName   = "一键优化";
                e.ErrorMsg  = ex.Message.ToString();
                ErrorLogService.AddErrorLog <Model.Optimizer>(e, model);
                return(false);
            }
        }