Esempio n. 1
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public bool Add(DepartmentInfo model, out int DeptID)
        {
            string     procName = "OA_SP_SM_Department_ADD";
            LogBuilder log      = new LogBuilder();

            #region 日志信息
            log.Desc = "添加部门";

            log.Method          = MethodBase.GetCurrentMethod().Name;
            log.Path            = MethodBase.GetCurrentMethod().DeclaringType.FullName;
            log.StroreProcedure = procName;

            log.Append("DepartmentInfo", model);
            #endregion
            DeptID = 0;
            try
            {
                int            rowsAffected;
                SqlParameter[] parameters =
                {
                    new SqlParameter("@DepID",    SqlDbType.Int,       4),
                    new SqlParameter("@DepName",  SqlDbType.VarChar,  50),
                    new SqlParameter("@ParentID", SqlDbType.Int,       4),
                    new SqlParameter("@Remark",   SqlDbType.VarChar, 200),
                    new SqlParameter("@State",    SqlDbType.Int,       4),
                    new SqlParameter("@Creator",  SqlDbType.Int, 4)
                };
                parameters[0].Direction = ParameterDirection.Output;
                parameters[1].Value     = model.DepName;
                parameters[2].Value     = model.ParentID;
                parameters[3].Value     = model.Remark;
                parameters[4].Value     = model.State;
                parameters[5].Value     = model.Creator;


                Mssql.ExecuteProc(procName, parameters, out rowsAffected);
                if (rowsAffected > 0)
                {
                    if (parameters[0] != null)
                    {
                        DeptID = (int)parameters[0].Value;
                        log.Append("DeptID", DeptID, ParamDirection.OUT);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Exception = ex.ToString();
                log.Error();
            }
            finally
            {
                log.Debug();
            }
            return(DeptID > 0);
        }
Esempio n. 2
0
        public void UpdateLog(object obj)
        {
            FtpLogEntry entry = obj as FtpLogEntry;

            if (entry == null)
            {
                return;
            }
            _entryBuilder.Append(entry.Date.ToLongTimeString()).Append("\t")
            .Append(entry.CIP ?? "-").Append("\t")
            .Append(entry.CSUsername ?? "-").Append("\t")
            .Append(entry.CSMethod ?? "-").Append(" ")
            .Append(entry.CSArgs ?? "-").Append("\t")
            .Append(entry.CSBytes ?? "-").Append("\t")
            .Append(entry.SCStatus ?? "-").Append("\t")
            .Append(entry.SCBytes ?? "-").Append("\t")
            .Append(entry.Info ?? "");
            if (Active)
            {
                Core.LogTextBox.Invoke(new MethodInvoker(() =>
                {
                    Core.LogTextBox.AppendText(_entryBuilder.ToString());
                    Core.LogTextBox.AppendText(Environment.NewLine);
                }));
            }
            else
            {
                LogBuilder.Append(_entryBuilder.ToString()).AppendLine();
            }
            _entryBuilder.Clear();
        }
Esempio n. 3
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int DutyID, string DutyName)
        {
            string        procName = "OA_SP_SM_Duty_Exists";
            LogBuilder    log      = new LogBuilder();
            MssqlDatabase Mssql    = null;

            #region 日志信息
            log.Desc = "检查职位是否已经存在";

            log.Method          = MethodBase.GetCurrentMethod().Name;
            log.Path            = MethodBase.GetCurrentMethod().DeclaringType.FullName;
            log.StroreProcedure = procName;
            log.Append("DutyID", DutyID);
            log.Append("DutyName", DutyName);
            #endregion

            try
            {
                Mssql = new MssqlDatabase();
                int            rowsAffected;
                SqlParameter[] parameters =
                {
                    new SqlParameter("@DutyID", SqlDbType.Int, 4)
                };
                parameters[0].Value = DutyID;

                Mssql.ExecuteProc(procName, parameters, out rowsAffected);
                if (rowsAffected > 0)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                log.Exception = ex.ToString();
                log.Error();
            }
            finally
            {
                log.Debug();
                if (Mssql != null)
                {
                    Mssql.Close();
                }
            }
            return(false);
        }
Esempio n. 4
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(DutyInfo model)
        {
            string        procName = "OA_SP_SM_Duty_Update";
            LogBuilder    log      = new LogBuilder();
            MssqlDatabase Mssql    = null;

            #region 日志信息
            log.Desc = "更新职位";

            log.Method          = MethodBase.GetCurrentMethod().Name;
            log.Path            = MethodBase.GetCurrentMethod().DeclaringType.FullName;
            log.StroreProcedure = procName;

            log.Append("DutyInfo", model);
            #endregion

            try
            {
                Mssql = new MssqlDatabase();
                int            rowsAffected = 0;
                SqlParameter[] parameters   =
                {
                    new SqlParameter("@DutyID",   SqlDbType.Int,         4),
                    new SqlParameter("@DutyName", SqlDbType.VarChar,    50),
                    new SqlParameter("@DepID",    SqlDbType.Int,         4),
                    new SqlParameter("@Remark",   SqlDbType.VarChar,   200),
                    new SqlParameter("@State",    SqlDbType.Int,         4),
                    new SqlParameter("@Created",  SqlDbType.DateTime),
                    new SqlParameter("@Creator",  SqlDbType.Int, 4)
                };
                parameters[0].Value = model.DutyID;
                parameters[1].Value = model.DutyName;
                parameters[2].Value = model.DepID;
                parameters[3].Value = model.Remark;
                parameters[4].Value = model.State;
                parameters[5].Value = model.Created;
                parameters[6].Value = model.Creator;

                Mssql.ExecuteProc(procName, parameters, out rowsAffected);
                if (rowsAffected > 0)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                log.Exception = ex.ToString();
                log.Error();
            }
            finally
            {
                log.Debug();
                if (Mssql != null)
                {
                    Mssql.Close();
                }
            }
            return(false);
        }
Esempio n. 5
0
        /// <summary>
        /// 检查部门是否已经存在
        /// </summary>
        /// <param name="DepID">新增时传0 </param>
        /// <param name="DepName"></param>
        /// <returns></returns>
        public bool Exists(int DepID, string DepName)
        {
            string     procName = "OA_SP_SM_Department_Exists";
            LogBuilder log      = new LogBuilder();

            #region 日志信息
            log.Desc = "检查部门是否已经存在";

            log.Method          = MethodBase.GetCurrentMethod().Name;
            log.Path            = MethodBase.GetCurrentMethod().DeclaringType.FullName;
            log.StroreProcedure = procName;
            log.Append("DepID", DepID);
            log.Append("DeptName", DepName);
            #endregion

            try
            {
                int            rowsAffected = 0;
                SqlParameter[] parameters   =
                {
                    new SqlParameter("@DepID",   SqlDbType.Int,     4),
                    new SqlParameter("@DepName", SqlDbType.VarChar, 50)
                };

                parameters[0].Value = DepID;
                parameters[1].Value = DepName;


                Mssql.ExecuteProc(procName, parameters, out rowsAffected);
                if (rowsAffected > 0)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                log.Exception = ex.ToString();
                log.Error();
            }
            finally
            {
                log.Debug();
            }
            return(false);
        }
Esempio n. 6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DutyInfo GetDutyInfo(int DutyID)
        {
            DutyInfo      model    = null;
            string        procName = "OA_SP_SM_Duty_GetModel";
            LogBuilder    log      = new LogBuilder();
            MssqlDatabase Mssql    = null;

            #region 日志信息
            log.Desc = "获取职位信息";

            log.Method          = MethodBase.GetCurrentMethod().Name;
            log.Path            = MethodBase.GetCurrentMethod().DeclaringType.FullName;
            log.StroreProcedure = procName;

            log.Append("DutyID", DutyID);
            #endregion

            try
            {
                Mssql = new MssqlDatabase();
                SqlParameter[] parameters =
                {
                    new SqlParameter("@DutyID", SqlDbType.Int, 4)
                };
                parameters[0].Value = DutyID;

                DataTable dt = Mssql.ExecuteProcDt(procName, parameters);
                if (dt != null && dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    model          = new DutyInfo();
                    model.DutyID   = DutyID;
                    model.DutyName = SqlComponents.ReaderGetString(dr["DutyName"]);
                    model.DepID    = SqlComponents.ReaderGetInt32(dr["DepID"]);
                    model.Remark   = SqlComponents.ReaderGetString(dr["Remark"]);
                    model.State    = SqlComponents.ReaderGetInt32(dr["State"]);
                    return(model);
                }
            }
            catch (Exception ex)
            {
                log.Exception = ex.ToString();
                log.Error();
            }
            finally
            {
                log.Debug();
                if (Mssql != null)
                {
                    Mssql.Close();
                }
            }
            return(null);
        }
Esempio n. 7
0
        /// <summary>
        /// 编辑用户信息
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool UpdateUser(UserInfo user)
        {
            string     procName = "OA_SP_SM_User_Update";
            LogBuilder log      = new LogBuilder();

            #region 日志信息
            log.Desc = "更新职位";

            log.Method          = MethodBase.GetCurrentMethod().Name;
            log.Path            = MethodBase.GetCurrentMethod().DeclaringType.FullName;
            log.StroreProcedure = procName;

            log.Append("UserInfo", user);
            #endregion

            try
            {
                int            rowsAffected = 0;
                SqlParameter[] parameters   =
                {
                    new SqlParameter("@UserID",   SqlDbType.Int,      10),
                    new SqlParameter("@UserName", SqlDbType.VarChar,  50),
                    new SqlParameter("@DepID",    SqlDbType.Int,      10),
                    new SqlParameter("@DutyID",   SqlDbType.Int,      10),
                    new SqlParameter("@Email",    SqlDbType.VarChar, 100),
                    new SqlParameter("@Remark",   SqlDbType.VarChar, 200),
                    new SqlParameter("@Modifier", SqlDbType.Int, 10)
                };
                parameters[0].Value = user.UserID;
                parameters[1].Value = user.UserName;
                parameters[2].Value = user.DepID;
                parameters[3].Value = user.DutyID;
                parameters[4].Value = user.Email;
                parameters[5].Value = user.Remark;
                parameters[6].Value = user.Creator;

                Mssql.ExecuteProc(procName, parameters, out rowsAffected);
                if (rowsAffected > 0)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                log.Exception = ex.ToString();
                log.Error();
            }
            finally
            {
                log.Debug();
            }
            return(false);
        }
Esempio n. 8
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public bool DeleteUser(int UserID)
        {
            string     procName = "OA_SP_SM_User_Delete";
            LogBuilder log      = new LogBuilder();

            #region 日志信息
            log.Desc = "删除用户";

            log.Method          = MethodBase.GetCurrentMethod().Name;
            log.Path            = MethodBase.GetCurrentMethod().DeclaringType.FullName;
            log.StroreProcedure = procName;

            log.Append("UserID", UserID);
            #endregion

            try
            {
                int            rowsAffected = 0;
                SqlParameter[] parameters   =
                {
                    new SqlParameter("@UserID", SqlDbType.Int, 10)
                };
                parameters[0].Value = UserID;

                Mssql.ExecuteProc(procName, parameters, out rowsAffected);
                if (rowsAffected > 0)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                log.Exception = ex.ToString();
                log.Error();
            }
            finally
            {
                log.Debug();
            }
            return(false);
        }
 public IntermediateService(Component1 component1)
 {
     this.component1 = component1;
     LogBuilder.Append("IntermediateService.ctor ");
 }
 public Component2(IntermediateService intermediateService)
 {
     this.intermediateService = intermediateService;
     LogBuilder.Append("Component2.ctor ");
 }
Esempio n. 11
0
        /// <summary>
        /// 查询职位列表
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="totalRows"></param>
        /// <param name="ParentID">上级ID</param>
        /// <returns></returns>
        public IList <DutyInfo> GetList(int pageSize, int pageIndex, out int totalRows)
        {
            List <DutyInfo> DutyList = null;
            DutyInfo        ui       = null;

            totalRows = 0;
            string        procName = "OA_SP_SM_Duty_GetList";
            MssqlDatabase Mssql    = null;
            LogBuilder    log      = new LogBuilder();

            try
            {
                Mssql = new MssqlDatabase();
                #region 日志信息
                log.Desc = "查询职位列表";

                log.Method          = MethodBase.GetCurrentMethod().Name;
                log.Path            = MethodBase.GetCurrentMethod().DeclaringType.FullName;
                log.StroreProcedure = procName;

                log.Append("PageSize", pageSize.ToString());
                log.Append("PageIndex", pageIndex.ToString());

                #endregion

                SqlParameter[] param =
                {
                    Mssql.MakeInParam("@PageSize",   SqlDbType.Int, 4, pageSize),
                    Mssql.MakeInParam("@PageIndex",  SqlDbType.Int, 4, pageIndex),

                    Mssql.MakeOutParam("@TotalRows", SqlDbType.Int, 4)
                };
                DataTable dt = null;
                Mssql.ExecuteProc(procName, param, out dt);
                totalRows = SqlComponents.ReaderGetInt32(param[3].Value);

                log.Append("TotalRows", totalRows.ToString(), ParamDirection.INOUT);

                if (dt != null && dt.Rows.Count > 0)
                {
                    DutyList = new List <DutyInfo>();
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        ui          = new DutyInfo();
                        ui.RowId    = SqlComponents.ReaderGetInt32(dt.Rows[i]["rowid"]);
                        ui.DepID    = SqlComponents.ReaderGetInt32(dt.Rows[i]["DepID"]);
                        ui.DutyID   = SqlComponents.ReaderGetInt32(dt.Rows[i]["DutyID"]);
                        ui.State    = SqlComponents.ReaderGetInt32(dt.Rows[i]["State"]);
                        ui.DutyName = SqlComponents.ReaderGetString(dt.Rows[i]["DutyName"]);
                        ui.Remark   = SqlComponents.ReaderGetString(dt.Rows[i]["Remark"]);
                        DutyList.Add(ui);
                    }
                }
                return(DutyList);
            }
            catch (Exception ex)
            {
                log.Exception = ex.ToString();
                log.Error();
            }
            finally
            {
                log.Debug();
                if (Mssql != null)
                {
                    Mssql.Close();
                }
            }
            return(null);
        }
 public void Initialize()
 {
     LogBuilder.Append("Component0.Initialize ");
 }
 public void Dispose()
 {
     LogBuilder.Append("Component" + myCounter + ".Dispose ");
 }
 public Component()
 {
     LogBuilder.Append("Component" + myCounter + ".ctor ");
 }
 public ComponentWrap(Component component)
 {
     this.component = component;
     LogBuilder.Append("ComponentWrap" + myCounter + ".ctor ");
 }
Esempio n. 16
0
        /// <summary>
        /// 添加用用户信息
        /// </summary>
        /// <param name="user"></param>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public bool AddUser(UserInfo user, out int UserID)
        {
            UserID = 0;
            string     procName = "OA_SP_SM_User_Add";
            LogBuilder log      = new LogBuilder();

            #region 日志信息
            log.Desc = "添加用用户信息";

            log.Method          = MethodBase.GetCurrentMethod().Name;
            log.Path            = MethodBase.GetCurrentMethod().DeclaringType.FullName;
            log.StroreProcedure = procName;
            log.Append("UserInfo", user);

            #endregion

            try
            {
                int            rowsAffected;
                SqlParameter[] parameters =
                {
                    new SqlParameter("@UserAccount", SqlDbType.VarChar,  50),
                    new SqlParameter("@Pwd",         SqlDbType.VarChar,  50),
                    new SqlParameter("@UserName",    SqlDbType.VarChar,  50),
                    new SqlParameter("@DepID",       SqlDbType.Int,      10),
                    new SqlParameter("@DutyID",      SqlDbType.Int,      10),
                    new SqlParameter("@Email",       SqlDbType.VarChar, 100),
                    new SqlParameter("@Remark",      SqlDbType.VarChar, 200),
                    new SqlParameter("@Creator",     SqlDbType.Int,      10),
                    new SqlParameter("@UserID",      SqlDbType.Int, 10)
                };
                parameters[0].Value     = user.UserAccount;
                parameters[1].Value     = user.Pwd;
                parameters[2].Value     = user.UserName;
                parameters[3].Value     = user.DepID;
                parameters[4].Value     = user.DutyID;
                parameters[5].Value     = user.Email;
                parameters[6].Value     = user.Remark;
                parameters[7].Value     = user.Creator;
                parameters[8].Direction = ParameterDirection.Output;

                Mssql.ExecuteProc(procName, parameters, out rowsAffected);
                if (rowsAffected > 0)
                {
                    if (parameters[0] != null)
                    {
                        UserID = (int)parameters[8].Value;
                        log.Append("UserID", UserID, ParamDirection.OUT);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Exception = ex.ToString();
                log.Error();
            }
            finally
            {
                log.Debug();
            }
            return(UserID > 0);
        }
 public Component1(Component0 component0)
 {
     this.component0 = component0;
     LogBuilder.Append("Component1.ctor ");
 }
 public Component0()
 {
     LogBuilder.Append("Component0.ctor ");
 }
Esempio n. 19
0
 public void Dispose()
 {
     LogBuilder.Append("MyImpl.Dispose ");
 }
Esempio n. 20
0
        /// <summary>
        /// Logs information about the specified proxy object to the global logger
        /// </summary>
        /// <param name="proxyObject">Proxy object to log information about</param>
        /// <param name="name">Optional name for proxy object, in form Proxy {0} Details.  If not specified, heading is Proxy Details.</param>
        public void LogProxyInfo(IWebProxy proxyObject, string name = null)
        {
            var logLines = new LogBuilder();

            if (proxyObject != null)
            {
                var proxyActual = proxyObject as System.Net.WebProxy;
                if (proxyActual == null)
                {
                    var webProxyField = proxyObject.GetType().GetField("webProxy", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public);
                    if (webProxyField != null)
                    {
                        proxyActual = webProxyField.GetValue(proxyObject) as System.Net.WebProxy;
                    }
                }
                if (proxyActual != null)
                {
                    if (proxyActual.Address != null)
                    {
                        if (name == null)
                        {
                            logLines.AppendLine("Proxy Details");
                        }
                        else
                        {
                            logLines.Append(String.Format("Proxy {0} Details", name));
                        }
                        logLines.Append(String.Format("   Address = {0}", proxyActual.Address));
                        if (proxyActual.Address.IsDefaultPort)
                        {
                            logLines.Append(String.Format("   using Default port"));
                        }
                        else
                        {
                            logLines.Append(String.Format("   using port {0}", proxyActual.Address.Port));
                        }
                        if (proxyActual.BypassProxyOnLocal)
                        {
                            logLines.Append(String.Format("   Local bypass ON"));
                        }
                        if ((proxyActual.BypassList != null) && (proxyActual.BypassList.Length > 0))
                        {
                            logLines.Append(String.Format("   Bypass ({0} entries)", proxyActual.BypassList));
                            foreach (var currBypassEntry in proxyActual.BypassList)
                            {
                                logLines.Append(String.Format("   {0}", currBypassEntry));
                            }
                        }
                        if (proxyActual.UseDefaultCredentials)
                        {
                            logLines.Append(String.Format("   Using default credentials"));
                        }
                    }
                    else
                    {
                        if (name == null)
                        {
                            logLines.Append(String.Format("Proxy:  Not Configured"));
                        }
                        else
                        {
                            logLines.Append(String.Format("Proxy {0}:  Not Configured", name));
                        }
                    }
                }
                else
                {
                    if (name == null)
                    {
                        logLines.Append(String.Format("Proxy:  Unrecognized type {0}, cannot describe", proxyActual.GetType().Name));
                    }
                    else
                    {
                        logLines.Append(String.Format("Proxy {0}:  Unrecognized type {1}, cannot describe", name, proxyActual.GetType().Name));
                    }
                }
            }
            else
            {
                if (name == null)
                {
                    logLines.Append(String.Format("Proxy:  Not Configured", name));
                }
                else
                {
                    logLines.Append(String.Format("Proxy {0}:  Not Configured", name));
                }
            }
            DuoBaseHttpMod.LogEvent(logLines, System.Diagnostics.EventLogEntryType.Information);
        }
Esempio n. 21
0
 public void Dispose()
 {
     LogBuilder.Append("Disposable3.Dispose ");
 }