Beispiel #1
0
        public List <Chain.Model.SysLog> DataTableToList(DataTable dt)
        {
            List <Chain.Model.SysLog> modelList = new List <Chain.Model.SysLog>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                for (int i = 0; i < rowsCount; i++)
                {
                    Chain.Model.SysLog model = new Chain.Model.SysLog();
                    if (dt.Rows[i]["LogID"] != null && dt.Rows[i]["LogID"].ToString() != "")
                    {
                        model.LogID = int.Parse(dt.Rows[i]["LogID"].ToString());
                    }
                    if (dt.Rows[i]["LogUserID"] != null && dt.Rows[i]["LogUserID"].ToString() != "")
                    {
                        model.LogUserID = int.Parse(dt.Rows[i]["LogUserID"].ToString());
                    }
                    if (dt.Rows[i]["LogActionID"] != null && dt.Rows[i]["LogActionID"].ToString() != "")
                    {
                        model.LogActionID = int.Parse(dt.Rows[i]["LogActionID"].ToString());
                    }
                    if (dt.Rows[i]["LogType"] != null && dt.Rows[i]["LogType"].ToString() != "")
                    {
                        model.LogType = dt.Rows[i]["LogType"].ToString();
                    }
                    if (dt.Rows[i]["LogDetail"] != null && dt.Rows[i]["LogDetail"].ToString() != "")
                    {
                        model.LogDetail = dt.Rows[i]["LogDetail"].ToString();
                    }
                    if (dt.Rows[i]["LogShopID"] != null && dt.Rows[i]["LogShopID"].ToString() != "")
                    {
                        model.LogShopID = int.Parse(dt.Rows[i]["LogShopID"].ToString());
                    }
                    if (dt.Rows[i]["LogCreateTime"] != null && dt.Rows[i]["LogCreateTime"].ToString() != "")
                    {
                        model.LogCreateTime = DateTime.Parse(dt.Rows[i]["LogCreateTime"].ToString());
                    }
                    if (dt.Rows[i]["LogIPAdress"] != null && dt.Rows[i]["LogIPAdress"].ToString() != "")
                    {
                        model.LogIPAdress = dt.Rows[i]["LogIPAdress"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #2
0
 public int Add(Chain.Model.SysLog model)
 {
     return(this.dal.Add(model));
 }
Beispiel #3
0
 public bool Update(Chain.Model.SysLog model)
 {
     return(this.dal.Update(model));
 }
Beispiel #4
0
        protected void btnAuthority_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtGroupName.Value.Trim() != "" & this.txtGroupRemark.Value.Trim() != "")
                {
                    Chain.Model.SysLog modelLog = new Chain.Model.SysLog();
                    modelLog.LogShopID       = this._UserShopID;
                    modelLog.LogUserID       = this._UserID;
                    modelLog.LogCreateTime   = DateTime.Now;
                    modelLog.LogActionID     = 11;
                    modelLog.LogType         = "系统角色";
                    this.group.GroupType     = Convert.ToInt32(this.txtGroupType.Value);
                    this.group.GroupName     = this.txtGroupName.Value.Trim();
                    this.group.ParentGroupID = int.Parse(this.sltParentGroup.Value);
                    this.group.IsPublic      = this.chkIsPublic.Checked;
                    if (this.group.ParentGroupID == 0)
                    {
                        this.group.ParentGroupID = 0;
                        this.group.ParentIDStr   = "";
                    }
                    else
                    {
                        Chain.Model.SysGroup parentGroup = this.bllGroup.GetModel(this.group.ParentGroupID);
                        if (parentGroup != null)
                        {
                            if (string.IsNullOrEmpty(parentGroup.ParentIDStr))
                            {
                                parentGroup.ParentIDStr = "/";
                            }
                            this.group.ParentIDStr = parentGroup.ParentIDStr + parentGroup.GroupID + "/";
                        }
                    }
                    this.group.GroupRemark = this.txtGroupRemark.Value.Trim();
                    if (int.Parse(this.HidGid.Value) > 0)
                    {
                        switch (PubFunction.curParameter.istry)
                        {
                        case 0:
                            if (int.Parse(this.txtGroupID.Value) != 1)
                            {
                                this.group.GroupID      = int.Parse(this.txtGroupID.Value);
                                this.group.CreateUserID = this._UserID;
                                modelLog.LogDetail      = "修改角色成功,角色名称:" + this.group.GroupName + ",说明:" + this.group.GroupRemark;
                                this.bllGroup.Update(this.group);
                                this.add = int.Parse(this.HidGid.Value);
                                new Chain.BLL.SysLog().Add(modelLog);
                            }
                            break;

                        case 1:
                            this.group.GroupID      = int.Parse(this.txtGroupID.Value);
                            this.group.CreateUserID = this._UserID;
                            modelLog.LogDetail      = "修改角色成功,角色名称:" + this.group.GroupName + ",说明:" + this.group.GroupRemark;
                            this.bllGroup.Update(this.group);
                            this.add = int.Parse(this.HidGid.Value);
                            new Chain.BLL.SysLog().Add(modelLog);
                            break;

                        case 2:
                            if (int.Parse(this.txtGroupID.Value) != 1)
                            {
                                this.group.GroupID      = int.Parse(this.txtGroupID.Value);
                                this.group.CreateUserID = this._UserID;
                                modelLog.LogDetail      = "修改角色成功,角色名称:" + this.group.GroupName + ",说明:" + this.group.GroupRemark;
                                this.bllGroup.Update(this.group);
                                this.add = int.Parse(this.HidGid.Value);
                                new Chain.BLL.SysLog().Add(modelLog);
                            }
                            break;
                        }
                    }
                    else if (this.txtGroupID.Value == "")
                    {
                        this.group.CreateUserID = this._UserID;
                        modelLog.LogDetail      = "新增角色成功,角色名称:" + this.group.GroupName + ",说明:" + this.group.GroupRemark;
                        this.add = this.bllGroup.Add(this.group);
                        new Chain.BLL.SysLog().Add(modelLog);
                    }
                    switch (PubFunction.curParameter.istry)
                    {
                    case 0:
                        if (this.txtGroupID.Value == "1")
                        {
                            base.OutputWarn("此版本为试用版,不可更改超级管理员。");
                        }
                        else if (this.SetGroupAuthority(this.add))
                        {
                            base.OutputWarn("保存成功!");
                        }
                        break;

                    case 1:
                        if (this.SetGroupAuthority(this.add))
                        {
                            base.OutputWarn("保存成功!");
                        }
                        break;

                    case 2:
                        if (this.txtGroupID.Value == "1")
                        {
                            base.OutputWarn("此版本为试用版,不可更改超级管理员。");
                        }
                        else if (this.SetGroupAuthority(this.add))
                        {
                            base.OutputWarn("保存成功!");
                        }
                        break;
                    }
                    List <Chain.Model.SysGroup> list = new Chain.BLL.SysGroup().GetModelList("");
                    foreach (Chain.Model.SysGroup item in list)
                    {
                        PubFunction.UpdateGroupAuthority(item.GroupID);
                    }
                }
                else
                {
                    base.OutputWarn("数据不完整,请重新输入!");
                }
            }
            catch
            {
                base.OutputWarn("系统错误,请与系统管理员联系!");
            }
        }