Example #1
0
 /// <summary>
 /// 添加操作日志
 /// </summary>
 /// <param name="moduleName">模块名称</param>
 /// <param name="methodName">方法名称</param>
 /// <param name="operateType">操作类型</param>
 /// <param name="remark">备注</param>
 ///<param name="parkingId">车场编号</param>
 ///<param name="parkingName">车场名称</param>
 public static void AddOperateLog(string moduleName, string methodName, OperateType operateType, string remark)
 {
     try
     {
         OperateLog model = new OperateLog();
         model.OperateTime     = DateTime.Now;
         model.OperateType     = operateType;
         model.OperatorContent = SubString(remark, 4000);
         model.ModuleName      = moduleName;
         model.MethodName      = methodName;
         if (SystemDefaultConfig.IsCS)
         {
             model.Operator = SystemDefaultConfig.OperatorUserAccount;
             model.LogFrom  = LogFrom.OmnipotentCard;
         }
         else
         {
             model.LogFrom  = GeLogFrom();
             model.Operator = GetOprator();
         }
         ThreadPool.QueueUserWorkItem(new WaitCallback(AddOperateLog), model);
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "添加操作日志出错");
     }
 }
Example #2
0
 static void AddOperateLog(object obj)
 {
     try
     {
         OperateLog model = obj as OperateLog;
         if (model != null)
         {
             IOperateLog factory = OperateLogFactory.GetFactory();
             factory.Add(model);
         }
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "添加操作日志出错");
     }
 }
Example #3
0
 private static string GetOprator()
 {
     try
     {
         if (HttpContext.Current.Session["SmartSystem_OperatorUserAccount"] != null)
         {
             string operatorUserAccount = HttpContext.Current.Session["SmartSystem_OperatorUserAccount"].ToString();
             if (!string.IsNullOrWhiteSpace(operatorUserAccount))
             {
                 return(operatorUserAccount);
             }
         }
     }
     catch (Exception ex) {
         ExceptionsServices.AddExceptions(ex, "添加操作日志,获取日志来源失败");
     }
     return("未知");
 }
Example #4
0
        /// <summary>
        /// 系统初始化默认单位
        /// </summary>
        public static void InitSystemDefaultCompany()
        {
            try
            {
                ICompany factory    = CompanyFactory.GetFactory();
                bool     hasCompany = factory.SystemExistCompany();
                if (!hasCompany)
                {
                    using (DbOperator dbOperator = ConnectionManager.CreateConnection())
                    {
                        try
                        {
                            dbOperator.BeginTransaction();
                            BaseCompany compamy = GetCompanyModel();
                            bool        result  = factory.Add(compamy, dbOperator);
                            if (!result)
                            {
                                throw new MyException("添加默认单位失败");
                            }

                            result = SysUserServices.AddCompanyDefaultUser(compamy, dbOperator);

                            if (!result)
                            {
                                throw new MyException("添加默认用户失败");
                            }

                            dbOperator.CommitTransaction();
                        }
                        catch
                        {
                            dbOperator.RollbackTransaction();
                            throw;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "添加系统默认单用户失败");
            }
        }
Example #5
0
 public static LogFrom GeLogFrom()
 {
     try
     {
         if (SystemDefaultConfig.IsCS)
         {
             return(LogFrom.OmnipotentCard);
         }
         else
         if (HttpContext.Current.Session["SmartSystem_LogFrom"] != null)
         {
             return((LogFrom)((int)HttpContext.Current.Session["SmartSystem_LogFrom"]));
         }
     }
     catch (Exception ex)
     {
         ExceptionsServices.AddExceptions(ex, "添加操作日志,获取日志来源失败");
     }
     return(LogFrom.UnKnown);
 }
Example #6
0
        /// <summary>
        /// 系统初始化默认单位CS
        /// </summary>
        public static bool InitSystemDefaultCompanyCS(string VName, string CPName, string userno, string pwd, string systemmodelpath)
        {
            try
            {
                ICompany factory = CompanyFactory.GetFactory();
                using (DbOperator dbOperator = ConnectionManager.CreateConnection())
                {
                    try
                    {
                        dbOperator.BeginTransaction();
                        BaseCompany compamy = GetCompanyModel();
                        compamy.CPName       = CPName;
                        compamy.UserAccount  = userno;
                        compamy.UserPassword = pwd;
                        bool result = factory.Add(compamy, dbOperator);
                        if (!result)
                        {
                            throw new MyException("添加默认单位失败");
                        }
                        BaseVillage village = GetVillage(compamy.CPID);
                        village.VName = VName;
                        result        = VillageServices.AddVillageDefaultUser(village, dbOperator);
                        if (!result)
                        {
                            throw new MyException("添加默认小区失败");
                        }
                        result = SysUserServices.AddCompanyDefaultUserCS(compamy, village, dbOperator, systemmodelpath);
                        if (!result)
                        {
                            throw new MyException("添加默认用户失败");
                        }

                        BaseParkinfo parkinfo = GetParkinfo(village.VID);
                        result = ParkingServices.AddParkinfoDefault(parkinfo, dbOperator);
                        if (!result)
                        {
                            throw new MyException("添加默认车场失败");
                        }
                        dbOperator.CommitTransaction();

                        ParkArea area = GetParkArea(parkinfo.PKID);
                        result = ParkAreaServices.AddDefualt(area);
                        if (result)
                        {
                            ParkBox box = GetParkBox(area.AreaID);
                            result = ParkBoxServices.AddDefault(box);
                            if (result)
                            {
                                result = ParkGateServices.AddDefault(GetParkGate(box.BoxID, 1));
                                result = ParkGateServices.AddDefault(GetParkGate(box.BoxID, 2));
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        dbOperator.RollbackTransaction();
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "添加系统默认单用户失败");
                return(false);
            }
            return(true);
        }