Beispiel #1
0
    string UserName = ""; //用户名

    #endregion Fields

    #region Methods

    protected void btn_Sub_Click(object sender, EventArgs e)
    {
        ZWL.BLL.ERPGongGao MyModel = new ZWL.BLL.ERPGongGao();
        MyModel.GetModel(int.Parse(Request.QueryString["ID"].ToString()));
        if(MyModel.ZT == "已发送") {
            Response.Write("<script>alert('修改失败,已发送状态的公告无法进行修改')</script>");
            return;
        }
        ZWL.BLL.ERPGongGao Model = new ZWL.BLL.ERPGongGao();
        Model.TitleStr = this.TextBox1.Text;
        Model.NoticeType = this.DropDownList1.SelectedValue;
        Model.ZT = this.ZT.SelectedValue;
        Model.FuJian = ZWL.Common.PublicMethod.GetSessionValue("WenJianList");
        Model.TypeStr = this.TextBox3.Text;
        Model.ContentStr = this.TxtContent.Text;
        Model.ID = int.Parse(Request.QueryString["ID"].ToString());
        Model.UserBuMen = this.Send_Person.Value;
        Model.Update();

        //写系统日志
        ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi();
        MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyRiZhi.DoSomething = "用户修改通知公告信息(" + this.TextBox1.Text + ")";
        MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
        MyRiZhi.Add();

        Response.Write("<script>alert('通知公告信息修改成功!');window.location.href='GongGao.aspx'</script>");
    }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ZWL.Common.PublicMethod.CheckSession();

            ZWL.BLL.ERPGongGao MyModel = new ZWL.BLL.ERPGongGao();
            MyModel.GetModel(int.Parse(Request.QueryString["ID"].ToString()));
            this.Label1.Text = MyModel.TitleStr;
            this.Label2.Text = ZWL.Common.PublicMethod.GetWenJian(MyModel.FuJian, "../UploadFile/");
            this.Label4.Text = MyModel.ContentStr;
            this.Label5.Text = MyModel.TimeStr;
            this.Label3.Text = ZWL.DBUtility.DbHelperSQL.GetSHSL("select TrueName from ERPUser where UserName ='******'");
            string UserNames = "'"+MyModel.UserBuMen.Replace(",","','")+"'";

            DataTable dt = ZWL.DBUtility.DbHelperSQL.GetDataTable("select TrueName from ERPUser where UserName in (" + UserNames + ")");
            string TrueName = "";
            foreach(DataRow R in dt.Rows)
            {
                TrueName += TrueName == "" ?  R["TrueName"].ToString() : "," + R["TrueName"].ToString();
            }
            this.Label6.Text = TrueName;

            this.Label7.Text = MyModel.Num.ToString();
            this.Label8.Text = MyModel.NoticeType.ToString();
            this.Label9.Text = MyModel.TypeStr.ToString();
            ZWL.DBUtility.DbHelperSQL.ExecuteSQL("update ERPGongGao set num= num+1 where ID=" + Request.QueryString["ID"].ToString());
            DataEntityDataContext context = new DataEntityDataContext();
            ERPGongGaoYD model = context.ERPGongGaoYD.SingleOrDefault(p => p.FID == int.Parse(Request.QueryString["ID"].ToString()) && p.XM == ZWL.Common.PublicMethod.GetSessionValue("UserName"));
            if(model!=null)
            {
                model.SFYY = "是";
                model.YDSJ = DateTime.Now;
                context.SubmitChanges();
            }

            //var T = context.ERPGongGaoYD.Where(p => p.FID == int.Parse(Request.QueryString["ID"].ToString()));
            DataTable Gdt = ZWL.DBUtility.DbHelperSQL.GetDataTable("SELECT G.[ID],G.[FID],G.[SSBM] ,G.[XM] ,G.[SFYY] ,G.[YDSJ],G.[BZ1],G.[BZ2],U.[TrueName] "+
                                                                   "FROM [ERPGongGaoYD] as G left join [ERPUser] as U on G.XM=U.UserName "+
                                                                   "where G.[FID]='"+Request.QueryString["ID"].ToString()+"'");
            foreach(DataRow R in Gdt.Rows){
                if(string.IsNullOrEmpty(R["TrueName"].ToString())) {
                    R["TrueName"] = R["XM"];
                }
            }
            this.GVData.DataSource = Gdt;
            GVData.DataBind();
            ReturnInput.Value = Request.UrlReferrer.ToString() == null ? "../GongGao/GongGao.aspx" : Request.UrlReferrer.ToString();
        }
    }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ZWL.Common.PublicMethod.CheckSession();

            ZWL.BLL.ERPGongGao MyModel = new ZWL.BLL.ERPGongGao();
            MyModel.GetModel(int.Parse(Request.QueryString["ID"].ToString()));
            this.TextBox1.Text = MyModel.TitleStr;
            this.TxtContent.Text = MyModel.ContentStr;
            ZWL.Common.PublicMethod.SetSessionValue("WenJianList", MyModel.FuJian);
            ZWL.Common.PublicMethod.BindDDL(this.CheckBoxList1, ZWL.Common.PublicMethod.GetSessionValue("WenJianList"));
        }
    }
Beispiel #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ZWL.Common.PublicMethod.CheckSession();

            ZWL.BLL.ERPGongGao MyModel = new ZWL.BLL.ERPGongGao();
            MyModel.GetModel(int.Parse(Request.QueryString["ID"].ToString()));
            this.Label1.Text = MyModel.TitleStr;
            this.Label2.Text = ZWL.Common.PublicMethod.GetWenJian(MyModel.FuJian, "../UploadFile/");
            this.Label4.Text = MyModel.ContentStr;
            this.Label5.Text = MyModel.TimeStr;
            this.Label3.Text = MyModel.UserName;
        }
    }
Beispiel #5
0
 public void DataBindToGridview()
 {
     DataEntityDataContext context = new DataEntityDataContext();
     ZWL.BLL.ERPGongGao MyLanEmail = new ZWL.BLL.ERPGongGao();
     type = Request.QueryString["Type"].ToString().Trim();
     if (Request.QueryString["Type"].ToString().Trim() == "单位")
     {
         var T = context.ERPGongGao.Where(p => p.TypeStr == "单位").OrderByDescending(p => p.ID);
         EmailList = T.ToList();
     }
     else
     {
         var T = context.ERPGongGao.Where(p => p.TypeStr == "单位").OrderByDescending(p => p.ID);
         EmailList = T.ToList();
     }
 }
Beispiel #6
0
    protected void ImageButton1_Click(object sender, EventArgs e)
    {
        ZWL.BLL.ERPGongGao Model = new ZWL.BLL.ERPGongGao();
        Model.TitleStr = this.TextBox1.Text;
        Model.FuJian = ZWL.Common.PublicMethod.GetSessionValue("WenJianList");
        Model.TypeStr = Request.QueryString["Type"].ToString();
        Model.ContentStr = this.TxtContent.Text;
        Model.ID = int.Parse(Request.QueryString["ID"].ToString());
        Model.Update();

        //写系统日志
        ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi();
        MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyRiZhi.DoSomething = "用户修改公告通知信息(" + this.TextBox1.Text + ")";
        MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
        MyRiZhi.Add();

        ZWL.Common.MessageBox.ShowAndRedirect(this, "公告通知信息修改成功!", "GongGao.aspx?Type=" + Request.QueryString["Type"].ToString());
    }
Beispiel #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ZWL.Common.PublicMethod.CheckSession();

            ZWL.BLL.ERPGongGao MyModel = new ZWL.BLL.ERPGongGao();
            MyModel.GetModel(int.Parse(Request.QueryString["ID"].ToString()));
            this.Label1.Text = MyModel.TitleStr;
            this.Label2.Text = ZWL.Common.PublicMethod.GetWenJian(MyModel.FuJian, "../UploadFile/");
            this.Label4.Text = MyModel.ContentStr;
            this.Label5.Text = MyModel.TimeStr;
            this.Label3.Text = MyModel.UserName;
            this.Label6.Text = MyModel.UserBuMen.ToString();
            this.Label7.Text = MyModel.Num.ToString();

            ZWL.DBUtility.DbHelperSQL.ExecuteSQL("update ERPGongGao set num= num+1 where ID=" + Request.QueryString["ID"].ToString());

        }
    }
Beispiel #8
0
    protected void ImageButton1_Click(object sender, EventArgs e)
    {
        ZWL.BLL.ERPGongGao Model = new ZWL.BLL.ERPGongGao();
        Model.TitleStr = this.TextBox1.Text;
        Model.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        Model.UserBuMen = ZWL.Common.PublicMethod.GetSessionValue("Department");
        Model.FuJian = ZWL.Common.PublicMethod.GetSessionValue("WenJianList");
        Model.TypeStr = "单位";
        Model.ContentStr = this.TxtContent.Text;
        Model.Add();

        //写系统日志
        ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi();
        MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyRiZhi.DoSomething = "用户添加公告通知信息(" + this.TextBox1.Text + ")";
        MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
        MyRiZhi.Add();

        ZWL.Common.MessageBox.ShowAndRedirect(this, "公告通知信息添加成功!", "GongGao.aspx?Type=%B5%A5%CE%BB");
    }
Beispiel #9
0
    string UserName = ""; //用户名

    #endregion Fields

    #region Methods

    protected void btn_Sub_Click(object sender, EventArgs e)
    {
        ZWL.BLL.ERPGongGao Model = new ZWL.BLL.ERPGongGao();
        Model.TitleStr = this.TextBox1.Text;
        Model.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        Model.UserBuMen = this.Send_Person.Value;
        Model.NoticeType = this.DropDownList1.SelectedValue;
        Model.ZT = this.ZT.SelectedValue;
        Model.FuJian = ZWL.Common.PublicMethod.GetSessionValue("WenJianList");
        Model.TypeStr = this.TextBox3.Text;
        Model.ContentStr = this.TxtContent.Text;
        Model.Num = 0;
        int id = Model.Add();

        DataEntityDataContext context = new DataEntityDataContext();
        if(!string.IsNullOrEmpty(this.Send_Person.Value)) {
            string[] ss =this.Send_Person.Value.Split(',');
            for(int i = 0; i < ss.Length; i++) {
                ERPGongGaoYD model = new ERPGongGaoYD();
                model.FID = id;
                model.SSBM = context.ERPUser.SingleOrDefault(p => p.UserName == ZWL.Common.PublicMethod.GetSessionValue("UserName")).Department;
                model.XM = ss[i];
                model.SFYY = "否";
                model.BZ1 = "";
                model.BZ2 = "";
                context.ERPGongGaoYD.InsertOnSubmit(model);
                context.SubmitChanges();
            }
        }

        //写系统日志
        ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi();
        MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName");
        MyRiZhi.DoSomething = "用户添加通知公告信息(" + this.TextBox1.Text + ")";
        MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString();
        MyRiZhi.Add();
        Response.Write("<script>alert('通知公告信息添加成功!');window.location.href='GongGao.aspx'</script>");
    }
Beispiel #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ZWL.Common.PublicMethod.CheckSession();

            ZWL.BLL.ERPGongGao MyModel = new ZWL.BLL.ERPGongGao();
            MyModel.GetModel(int.Parse(Request.QueryString["ID"].ToString()));
            this.TextBox1.Text = MyModel.TitleStr;
            this.TxtContent.Text = MyModel.ContentStr;
            ZWL.Common.PublicMethod.SetSessionValue("WenJianList", MyModel.FuJian);
            ZWL.Common.PublicMethod.BindDDL(this.CheckBoxList1, ZWL.Common.PublicMethod.GetSessionValue("WenJianList"));
            DataEntityDataContext context = new DataEntityDataContext();
            var T = context.ERPCommon.Where(p => p.Code == "TZWJLX").OrderBy(p => p.CSort);

            foreach (var item in T)
            {
                this.DropDownList1.Items.Add(new ListItem(item.CName, item.CName));
            }
            Status = MyModel.ZT;
            this.ZT.SelectedValue = MyModel.ZT;
            Persons = MyModel.UserBuMen.ToString();
            this.Send_Person.Value = Persons;
            this.TextBox3.Text = MyModel.TypeStr;
            this.DropDownList1.Text = MyModel.NoticeType;
            ReturnInput.Value = Request.UrlReferrer.ToString() == null ? "../GongGao/GongGao.aspx" : Request.UrlReferrer.ToString();

            #region  //树状图
            UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName");
            string Condition = "";
            if(UserName != "") {
                Condition = " where [UserName]='" + UserName + "'";
            }
            string Departments = "";
            DataTable Udt = ZWL.DBUtility.DbHelperSQL.GetDataTable("select [Department] from [ERPUser] " + Condition);
            if(Udt.Rows.Count != 0) {
                Departments = Udt.Rows[0][0].ToString();
            }
            else {
                Departments = "";
            }
            Departments = "'" + Departments.Replace(",", "','") + "'";//拼装IDS,用于SQL语句
            //获取角色的部门
            DataTable BMdt = ZWL.DBUtility.DbHelperSQL.GetDataTable("select [ID],[DirID] from ERPBuMen where [BuMenName] in (" + Departments + ")");

            //foreach(DataRow BMR in BMdt.Rows) {
            //    QIDS += QIDS == "" ? BMR[0].ToString() : "," + BMR[0].ToString(); //获取用户拥有的权限
            //    DataTable Ddt = ZWL.DBUtility.DbHelperSQL.GetDataTable("select [ID] from ERPBuMen where [DirID] in (" + BMR[0].ToString() + ") or  [ID] in (" + BMR[0].ToString() + ") order by [DirID]");
            //    //判断是否有存在下级ID,若存在,则保存在IDS
            //    if(Ddt.Rows.Count > 0) { //若数量大于0.则存在上级菜单
            //        foreach(DataRow DR in Ddt.Rows) {
            //            IDS += IDS == "" ? DR[0].ToString() : "," + DR[0].ToString();
            //        }
            //    }
            //}
            string dirid = "0";
            dirid = ZWL.DBUtility.DbHelperSQL.GetSHSL("select top 1 DirID from ERPBuMen where ID='" + ZWL.Common.PublicMethod.GetSessionValue("DepartmentID") + "'");
            BindTree(this.ListTreeView.Nodes, Convert.ToInt32(dirid));
            this.ListTreeView.Attributes.Add("onclick", "CheckEvent(event)");

            #endregion
        }
    }