Пример #1
0
    public void Bind()
    {
        string strwhere = string.Empty;

        if (LogClass.Equals("paymentbank"))
        {
            strwhere += " isnull(dr,0)=0 and CompId=" + CompId + " and LogClass='" + LogClass + "'";
        }
        else
        {
            strwhere += " isnull(dr,0)=0 and CompId=" + CompId + " and LogClass='" + LogClass + "' and ApplicationId= " + ApplicationId;
        }

        List <Hi.Model.SYS_SysBusinessLog> l = new Hi.BLL.SYS_SysBusinessLog().GetList("", strwhere, " LogTime asc");

        if (l != null)
        {
            if (l.Count > 0)
            {
                this.rptLog.DataSource = l;
                this.rptLog.DataBind();
            }
        }
    }
Пример #2
0
    /// <summary>
    /// 新增业务日志
    /// </summary>
    /// <param name="LogClass">单据名称</param>
    /// <param name="ApplicationId">业务ID</param>
    /// <param name="LogType">业务名称 新增、审核、退回、提交...</param>
    /// <param name="LogRemark">备注</param>
    public static void AddSysBusinessLog(int CompId, string LogClass, string ApplicationId, string LogType, string LogRemark)
    {
        try
        {
            LoginModel AdminUserModel = null;
            if (HttpContext.Current.Session != null)
            {
                AdminUserModel = HttpContext.Current.Session["UserModel"] as LoginModel;//得到登录LoginId
            }

            if (LogType.Equals("订单物流"))
            {
                string strwhere = "CompID=" + CompId + " and ApplicationId=" + ApplicationId + " and LogType='" + LogType + "'";
                List <Hi.Model.SYS_SysBusinessLog> l = new Hi.BLL.SYS_SysBusinessLog().GetList("", strwhere, "");

                if (l != null)
                {
                    if (l.Count > 0)
                    {
                        foreach (Hi.Model.SYS_SysBusinessLog item in l)
                        {
                            item.LogRemark       = LogRemark;
                            item.LogTime         = DateTime.Now;
                            item.OperatePersonId = AdminUserModel.UserID;
                            item.OperatePerson   = AdminUserModel.TrueName == "" ? AdminUserModel.UserName : AdminUserModel.TrueName;
                            item.modifyuser      = AdminUserModel.UserID;
                            new Hi.BLL.SYS_SysBusinessLog().Update(item);
                        }
                    }
                    else
                    {
                        Hi.Model.SYS_SysBusinessLog SysBusinessLogModel = new Hi.Model.SYS_SysBusinessLog();
                        SysBusinessLogModel.CompID          = CompId;
                        SysBusinessLogModel.LogClass        = LogClass;
                        SysBusinessLogModel.ApplicationId   = Convert.ToInt32(ApplicationId);
                        SysBusinessLogModel.LogType         = LogType;
                        SysBusinessLogModel.OperatePersonId = AdminUserModel.UserID;
                        SysBusinessLogModel.OperatePerson   = AdminUserModel.TrueName == "" ? AdminUserModel.UserName : AdminUserModel.TrueName;
                        SysBusinessLogModel.LogRemark       = LogRemark;
                        SysBusinessLogModel.LogTime         = DateTime.Now;
                        SysBusinessLogModel.ts = DateTime.Now;

                        new Hi.BLL.SYS_SysBusinessLog().Add(SysBusinessLogModel);
                    }
                }
            }
            else
            {
                Hi.Model.SYS_SysBusinessLog SysBusinessLogModel = new Hi.Model.SYS_SysBusinessLog();
                SysBusinessLogModel.CompID          = CompId;
                SysBusinessLogModel.LogClass        = LogClass;
                SysBusinessLogModel.ApplicationId   = Convert.ToInt32(ApplicationId);
                SysBusinessLogModel.LogType         = LogType;
                SysBusinessLogModel.OperatePersonId = AdminUserModel.UserID;
                SysBusinessLogModel.OperatePerson   = AdminUserModel.TrueName == "" ? AdminUserModel.UserName : AdminUserModel.TrueName;
                SysBusinessLogModel.LogRemark       = LogRemark;
                SysBusinessLogModel.LogTime         = DateTime.Now;
                SysBusinessLogModel.ts = DateTime.Now;

                new Hi.BLL.SYS_SysBusinessLog().Add(SysBusinessLogModel);
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }