Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = "";

            //CheckBoxList_Reciever初始化
            if (!IsPostBack)
            {
                try
                {
                    id = Request.QueryString[0].ToString();
                    this.Label1.Text = id;
                }
                catch { }

                if (id == "")
                {
                    this.begindate.Text = DateTime.Now.ToShortDateString();
                    this.enddate.Text   = DateTime.Now.AddDays(7).ToShortDateString();
                }

                else
                {
                    //绑定CheckBoxList前面的部分
                    Maticsoft.BLL.W_Material   bll2  = new Maticsoft.BLL.W_Material();
                    Maticsoft.Model.W_Material model = new Maticsoft.Model.W_Material();
                    model               = bll2.GetModel(int.Parse(id));
                    this.Name.Text      = model.Name;
                    this.begindate.Text = (Convert.ToDateTime(model.Begindate)).ToShortDateString();
                    this.enddate.Text   = (Convert.ToDateTime(model.Enddate)).ToShortDateString();
                    //绑定是否显示过期
                    if (model.Outdisplay == "是")
                    {
                        this.CheckBox1.Checked = true;
                    }
                    //绑定CheckBoxList
                    DataSet ds = new DataSet();
                    Maticsoft.BLL.W_Receiver bll = new Maticsoft.BLL.W_Receiver();
                    ds = bll.W_Receiver_Mid(id);
                    this.CheckBoxList_Reciever.DataSource = ds;
                    CheckBoxList_Reciever.DataTextField   = "Receiver";
                    CheckBoxList_Reciever.DataValueField  = "Id";
                    CheckBoxList_Reciever.DataBind();

                    //添加选定内容 陈湘军 
                    //修改存储过程 W_Receiver_Mid,添加dormacy字段

                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            try
                            {
                                CheckBoxList_Reciever.Items[i].Selected = (ds.Tables[0].Rows[i]["dormacy"].ToString() == "提交");
                            }
                            catch { }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            string btn = e.CommandName;

            switch (btn)
            {
            case "BtnEdit":
                int Id1 = int.Parse(e.Item.Cells[8].Text.Trim());
                Response.Redirect("AddMaterial.aspx?Id=" + Id1);
                break;

            case "BtnDel":
                int Id2 = int.Parse(e.Item.Cells[8].Text.Trim());
                Maticsoft.BLL.W_Material bll2 = new Maticsoft.BLL.W_Material();
                bll2.Delete(Id2);
                Maticsoft.BLL.W_Receivestate bll3 = new Maticsoft.BLL.W_Receivestate();
                bll3.Delete(Id2);
                break;

            case "BtnManager":
                int Id3 = int.Parse(e.Item.Cells[8].Text.Trim());
                Response.Redirect("Manager.aspx?Id=" + Id3);
                break;
            }
            dataBind();
        }
Exemplo n.º 3
0
        //进行数据绑定的方法
        protected void dataBind()
        {
            this.DataGrid1.AllowPaging = true;
            this.DataGrid1.PageSize    = 11;
            DataSet ds = new DataSet();

            Maticsoft.BLL.W_Material bll = new Maticsoft.BLL.W_Material();
            string key = this.TextBox1.Text.Trim();

            Session["AccountsAdminKey"] = key;
            if (key == "")
            {
                ds = bll.GetAllList();
            }
            else
            {
                ds = bll.GetMaterialByType(key);
            }
            int pageIndex = this.DataGrid1.CurrentPageIndex;

            Session["AccountsAdminPage"] = pageIndex;
            DataGrid1.DataSource         = ds.Tables[0].DefaultView;
            int record_Count = ds.Tables[0].Rows.Count;
            int page_Size    = DataGrid1.PageSize;
            int totalPages   = int.Parse(Math.Ceiling((double)record_Count / page_Size).ToString());

            if (totalPages > 0)
            {
                if (pageIndex > totalPages - 1)
                {
                    pageIndex = totalPages - 1;
                }
            }
            else
            {
                pageIndex = 0;
            }
            DataGrid1.CurrentPageIndex = pageIndex;
            DataGrid1.DataBind();

            //显示数量
            if (this.DataGrid1.CurrentPageIndex == 0)
            {
                btnFirst.Enabled = false;
                btnPrev.Enabled  = false;
                if (this.DataGrid1.PageCount == 1)
                {
                    btnLast.Enabled = false;
                    btnNext.Enabled = false;
                }
            }
            else if (this.DataGrid1.CurrentPageIndex == this.DataGrid1.PageCount - 1)
            {
                btnLast.Enabled = false;
                btnNext.Enabled = false;
            }
            this.lblpagesum.Text   = totalPages.ToString();
            this.lblpage.Text      = (pageIndex + 1).ToString();
            this.lblrowscount.Text = record_Count.ToString();
        }
Exemplo n.º 4
0
        private void ShowNews()
        {
            Maticsoft.BLL.W_Material bll = new Maticsoft.BLL.W_Material();
            string strWhrere = "";
            //显示没有过期的和允许过期显示的:修改人学生
            strWhrere = "EndDate>'" + DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd")+"'or Outdisplay='是'" ;
            //DataSet Ds = bll.GetList(MyintTop, strWhrere, "enddate desc");
            //写入了全局变量:修改人学生
            ds1=bll.GetList(MyintTop, strWhrere, "enddate desc");
            this.GridView1.DataSource = ds1;
            this.GridView1.DataBind();

            //处理记录信息 
            try
            {
                this.lblRowsCount.Text = ds1.Tables[0].Rows.Count.ToString();
            }
            catch { };

            this.PageDrop.Items.Clear();
            for (int i = 0; i < this.GridView1.PageCount; i++) 
            {
                ListItem dropitem = new ListItem();
                dropitem.Value = i.ToString();
                dropitem.Text = (i + 1).ToString();
                this.PageDrop.Items.Add(dropitem);
            }
            if(this.PageDrop.Items.Count>0)
            this.PageDrop.SelectedIndex = this.GridView1.PageIndex;
        }
Exemplo n.º 5
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.Name.Text == "")
            {
                this.Label2.Text = "请输入材料名";
                return;
            }


            //对Material表的输入
            DateTime begindate = Convert.ToDateTime(this.begindate.Text);
            DateTime enddate   = Convert.ToDateTime(this.enddate.Text);
            string   name      = this.Name.Text.Trim();
            string   address   = this.TextBox_Address.Text.Trim();
            string   number    = this.TextBox_Number.Text.Trim();

            // Maticsoft.Model.W_Material material = new Maticsoft.Model.W_Material();
            Maticsoft.BLL.W_Material bll = new Maticsoft.BLL.W_Material();
            model.Name      = name;
            model.Begindate = begindate;
            model.Enddate   = enddate;
            model.Address   = address;
            model.Number    = number;

            int id;

            Maticsoft.Model.W_Receivestate receivestate = new Maticsoft.Model.W_Receivestate();
            Maticsoft.BLL.W_Receivestate   bllstate     = new Maticsoft.BLL.W_Receivestate();

            if (this.Label_materialId.Text == "")
            {
                                                  //添加
                    id = bll.Add(model);
            }
            else //修改
            {
                id       = int.Parse(this.Label_materialId.Text.Trim());
                model.Id = int.Parse(this.Label_materialId.Text.Trim());
                bll.Update(model);

                //对W_Receivestate表的操作 添加时是否需要 bllstate.delete??
                bllstate.Delete(id);
            }


            receivestate.MaterialId = id;
            for (int i = 0; i < this.CheckBoxList_Reciever.Items.Count; i++)
            {
                if (this.CheckBoxList_Reciever.Items[i].Selected)
                {
                    receivestate.ReceiverId = this.CheckBoxList_Reciever.Items[i].Value;
                    bllstate.Add(receivestate);
                }
            }
            if (id > 1)
            {
                //this.Label_Msg.Text = "提交成功!";
            }
            Response.Redirect("ManagerMaterial.aspx");
        }
Exemplo n.º 6
0
        private void ShowNews()
        {
            Maticsoft.BLL.W_Material bll = new Maticsoft.BLL.W_Material();
            string strWhrere             = "";

            //显示没有过期的和允许过期显示的:修改人学生
            strWhrere = "EndDate>'" + DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd") + "'or Outdisplay='是'";
            //DataSet Ds = bll.GetList(MyintTop, strWhrere, "enddate desc");
            //写入了全局变量:修改人学生
            ds1 = bll.GetList(MyintTop, strWhrere, "enddate desc");
            this.GridView1.DataSource = ds1;
            this.GridView1.DataBind();

            //处理记录信息
            try
            {
                this.lblRowsCount.Text = ds1.Tables[0].Rows.Count.ToString();
            }
            catch { };

            this.PageDrop.Items.Clear();
            for (int i = 0; i < this.GridView1.PageCount; i++)
            {
                ListItem dropitem = new ListItem();
                dropitem.Value = i.ToString();
                dropitem.Text  = (i + 1).ToString();
                this.PageDrop.Items.Add(dropitem);
            }
            if (this.PageDrop.Items.Count > 0)
            {
                this.PageDrop.SelectedIndex = this.GridView1.PageIndex;
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = "";
            //CheckBoxList_Reciever初始化
            if (!IsPostBack)
            {
                try
                {
                    id = Request.QueryString[0].ToString();
                    this.Label1.Text  = id;
                }
                catch { }
                DataSet ds = new DataSet();
                Maticsoft.BLL.W_Receiver bll = new Maticsoft.BLL.W_Receiver();
                ds = bll.GetAllList();
                this.CheckBoxList_Reciever.DataSource = ds;
                CheckBoxList_Reciever.DataTextField = "Receiver";
                CheckBoxList_Reciever.DataValueField = "Id";
                CheckBoxList_Reciever.DataBind();
                 if (id == "")
                {
                    this.TextBox_Address.Text = "http://kjc.jstu.edu.cn/news.aspx?id=205";
                    this.TextBox_Number.Text = "申报书一式三份,活页7份";
                    this.begindate.Text = DateTime.Now.ToShortDateString();
                    this.enddate.Text = DateTime.Now.AddDays(7).ToShortDateString();
                }

                else
                {
                    Maticsoft.BLL.W_Material bll2 = new Maticsoft.BLL.W_Material();
                    Maticsoft.Model.W_Material model = new Maticsoft.Model.W_Material();
                    model = bll2.GetModel(int.Parse( id));
                    this.Name.Text = model.Name;
                    this.begindate.Text = (Convert.ToDateTime( model.Begindate)).ToShortDateString();
                    this.enddate.Text = (Convert.ToDateTime(model.Enddate)).ToShortDateString();
                    this.TextBox_Address.Text = model.Address;
                    this.TextBox_Number.Text = model.Number;

                    DataSet ds2 = new DataSet();
                    Maticsoft.BLL.W_Receivestate bll3 = new Maticsoft.BLL.W_Receivestate();
                    ds2 = bll3.GetList("MaterialId=" + id);
                    for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
                    {
                       int j = int.Parse(ds2.Tables[0].Rows[i][2].ToString());
                       this.CheckBoxList_Reciever.Items[j-1].Selected=true ;
                        
                    
                     }
                
                }
            }
            
        }
Exemplo n.º 8
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.Name.Text == "")
            {
                this.Label2.Text = "请输入材料名";
                return;
            }


            //过期是否显示的判断
            Maticsoft.BLL.W_Material bllmaterial = new Maticsoft.BLL.W_Material();


            if (this.CheckBox1.Checked)
            {
                bllmaterial.ReleaseList(int.Parse(this.Label1.Text));
            }
            else
            {
                bllmaterial.NoReleaseList((int.Parse(this.Label1.Text)));
            }



            Maticsoft.Model.W_Receivestate receivestate = new Maticsoft.Model.W_Receivestate();
            Maticsoft.BLL.W_Receivestate   bllstate     = new Maticsoft.BLL.W_Receivestate();


            //4-3修改by 陈湘军
            for (int i = 0; i < this.CheckBoxList_Reciever.Items.Count; i++)
            {
                receivestate.ReceiverId = this.CheckBoxList_Reciever.Items[i].Value;
                receivestate.MaterialId = int.Parse(this.Label1.Text.Trim());

                if (this.CheckBoxList_Reciever.Items[i].Selected)
                {
                    receivestate.Dormacy    = "提交";
                    receivestate.IssureTime = Convert.ToDateTime(DateTime.Now.ToShortTimeString());
                }
                else
                {
                    receivestate.Dormacy = "";
                }

                bllstate.Update(receivestate);
            }
            if (int.Parse(this.Label1.Text) > 1)
            {
                //this.Label_Msg.Text = "提交成功!";
            }
            Response.Redirect("AllList.aspx");
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = "";

            //CheckBoxList_Reciever初始化
            if (!IsPostBack)
            {
                try
                {
                    id = Request.QueryString[0].ToString();
                    this.Label1.Text = id;
                }
                catch { }
                DataSet ds = new DataSet();
                Maticsoft.BLL.W_Receiver bll = new Maticsoft.BLL.W_Receiver();
                ds = bll.GetAllList();
                this.CheckBoxList_Reciever.DataSource = ds;
                CheckBoxList_Reciever.DataTextField   = "Receiver";
                CheckBoxList_Reciever.DataValueField  = "Id";
                CheckBoxList_Reciever.DataBind();
                if (id == "")
                {
                    this.TextBox_Address.Text = "http://kjc.jstu.edu.cn/news.aspx?id=205";
                    this.TextBox_Number.Text  = "申报书一式三份,活页7份";
                    this.begindate.Text       = DateTime.Now.ToShortDateString();
                    this.enddate.Text         = DateTime.Now.AddDays(7).ToShortDateString();
                }

                else
                {
                    Maticsoft.BLL.W_Material   bll2  = new Maticsoft.BLL.W_Material();
                    Maticsoft.Model.W_Material model = new Maticsoft.Model.W_Material();
                    model                     = bll2.GetModel(int.Parse(id));
                    this.Name.Text            = model.Name;
                    this.begindate.Text       = (Convert.ToDateTime(model.Begindate)).ToShortDateString();
                    this.enddate.Text         = (Convert.ToDateTime(model.Enddate)).ToShortDateString();
                    this.TextBox_Address.Text = model.Address;
                    this.TextBox_Number.Text  = model.Number;

                    DataSet ds2 = new DataSet();
                    Maticsoft.BLL.W_Receivestate bll3 = new Maticsoft.BLL.W_Receivestate();
                    ds2 = bll3.GetList("MaterialId=" + id);
                    for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
                    {
                        int j = int.Parse(ds2.Tables[0].Rows[i][2].ToString());
                        this.CheckBoxList_Reciever.Items[j - 1].Selected = true;
                    }
                }
            }
        }
Exemplo n.º 10
0
        //进行数据绑定的方法
        protected void dataBind()
        {
            this.DataGrid1.AllowPaging = true;
            this.DataGrid1.PageSize = 11;
            DataSet ds = new DataSet();
            Maticsoft.BLL.W_Material bll = new Maticsoft.BLL.W_Material();
            string key = this.TextBox1.Text.Trim();
            Session["AccountsAdminKey"] = key;
            if (key == "")
                ds = bll.GetAllList();
            else
                ds = bll.GetMaterialByType(key);
            int pageIndex = this.DataGrid1.CurrentPageIndex;
            Session["AccountsAdminPage"] = pageIndex;
            DataGrid1.DataSource = ds.Tables[0].DefaultView;
            int record_Count = ds.Tables[0].Rows.Count;
            int page_Size = DataGrid1.PageSize;
            int totalPages = int.Parse(Math.Ceiling((double)record_Count / page_Size).ToString());
            if (totalPages > 0)
            {
                if (pageIndex > totalPages - 1)
                    pageIndex = totalPages - 1;
            }
            else
            {
                pageIndex = 0;
            }
            DataGrid1.CurrentPageIndex = pageIndex;
            DataGrid1.DataBind();

            //显示数量
            if (this.DataGrid1.CurrentPageIndex == 0)
            {
                btnFirst.Enabled = false;
                btnPrev.Enabled = false;
                if (this.DataGrid1.PageCount == 1)
                {
                    btnLast.Enabled = false;
                    btnNext.Enabled = false;
                }
            }
            else if (this.DataGrid1.CurrentPageIndex == this.DataGrid1.PageCount - 1)
            {
                btnLast.Enabled = false;
                btnNext.Enabled = false;
            }
            this.lblpagesum.Text = totalPages.ToString();
            this.lblpage.Text = (pageIndex + 1).ToString();
            this.lblrowscount.Text = record_Count.ToString();
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {


            string id = "";
            //CheckBoxList_Reciever初始化
            if (!IsPostBack)
            {
                try
                {
                    id = Request.QueryString[0].ToString();
                    this.Label1.Text = id;
                }
                catch { }

                if (id == "")
                {
                    this.begindate.Text = DateTime.Now.ToShortDateString();
                    this.enddate.Text = DateTime.Now.AddDays(7).ToShortDateString();
                }

                else
                {
                    //绑定CheckBoxList前面的部分
                    Maticsoft.BLL.W_Material bll2 = new Maticsoft.BLL.W_Material();
                    Maticsoft.Model.W_Material model = new Maticsoft.Model.W_Material();
                    model = bll2.GetModel(int.Parse(id));
                    this.Name.Text = model.Name;
                    this.begindate.Text = (Convert.ToDateTime(model.Begindate)).ToShortDateString();
                    this.enddate.Text = (Convert.ToDateTime(model.Enddate)).ToShortDateString();
                    //绑定CheckBoxList
                    DataSet ds = new DataSet();
                    Maticsoft.BLL.W_Receiver bll = new Maticsoft.BLL.W_Receiver();
                    ds = bll.W_Receiver_Mid(id);
                    this.CheckBoxList_Reciever.DataSource = ds;
                    CheckBoxList_Reciever.DataTextField = "Receiver";
                    CheckBoxList_Reciever.DataValueField = "Id";
                    CheckBoxList_Reciever.DataBind();




                }
            }
            
        }
Exemplo n.º 12
0
        protected void Bind(int Id)
        {
            Maticsoft.BLL.W_Material bll = new Maticsoft.BLL.W_Material();
            Maticsoft.Model.W_Material model = new Maticsoft.Model.W_Material();
            model = bll.GetModel(Id);
            this.lblId.Text = model.Id.ToString();
            this.lblName.Text = model.Name;
            this.lblBeginDate.Text = (Convert.ToDateTime(model.Begindate)).ToShortDateString();
            this.lblEnddate.Text = (Convert.ToDateTime(model.Enddate)).ToShortDateString();
            this.Label_Address.Text = model.Address;
            this.Label_Number.Text = model.Number;


            DataSet ds2 = new DataSet();
            Maticsoft.BLL.W_Receivestate bll3 = new Maticsoft.BLL.W_Receivestate();
            ds2 = bll3.GetList("MaterialId=" + Id);
            for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
            {
                int j = int.Parse(ds2.Tables[0].Rows[i][2].ToString());
                Maticsoft.BLL.W_Receiver bll4 = new Maticsoft.BLL.W_Receiver();
                Maticsoft.Model.W_Receiver model4 = new Maticsoft.Model.W_Receiver();
                model4 = bll4.GetModel(j);
                this.lblReceiver.Text += model4.Receiver + "  ";

            }

            DataSet ds5 = new DataSet();
            Maticsoft.BLL.W_Receivestate bll5 = new Maticsoft.BLL.W_Receivestate();
            ds5 = bll5.GetList("MaterialId=" + Id + "and Dormacy = '提交'");
            for (int i = 0; i < ds5.Tables[0].Rows.Count; i++)
            {
                int j = int.Parse(ds5.Tables[0].Rows[i][2].ToString());
                Maticsoft.BLL.W_Receiver bll4 = new Maticsoft.BLL.W_Receiver();
                Maticsoft.Model.W_Receiver model4 = new Maticsoft.Model.W_Receiver();
                model4 = bll4.GetModel(j);
                this.Label_IsHanded.Text += model4.Receiver + "  ";

            }

        }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = "";

            //CheckBoxList_Reciever初始化
            if (!IsPostBack)
            {
                try
                {
                    id = Request.QueryString[0].ToString();
                    this.Label1.Text = id;
                }
                catch { }

                if (id == "")
                {
                    this.begindate.Text = DateTime.Now.ToShortDateString();
                    this.enddate.Text   = DateTime.Now.AddDays(7).ToShortDateString();
                }

                else
                {
                    //绑定CheckBoxList前面的部分
                    Maticsoft.BLL.W_Material   bll2  = new Maticsoft.BLL.W_Material();
                    Maticsoft.Model.W_Material model = new Maticsoft.Model.W_Material();
                    model               = bll2.GetModel(int.Parse(id));
                    this.Name.Text      = model.Name;
                    this.begindate.Text = (Convert.ToDateTime(model.Begindate)).ToShortDateString();
                    this.enddate.Text   = (Convert.ToDateTime(model.Enddate)).ToShortDateString();
                    //绑定CheckBoxList
                    DataSet ds = new DataSet();
                    Maticsoft.BLL.W_Receiver bll = new Maticsoft.BLL.W_Receiver();
                    ds = bll.W_Receiver_Mid(id);
                    this.CheckBoxList_Reciever.DataSource = ds;
                    CheckBoxList_Reciever.DataTextField   = "Receiver";
                    CheckBoxList_Reciever.DataValueField  = "Id";
                    CheckBoxList_Reciever.DataBind();
                }
            }
        }
Exemplo n.º 14
0
        protected void Bind(int Id)
        {
            Maticsoft.BLL.W_Material   bll   = new Maticsoft.BLL.W_Material();
            Maticsoft.Model.W_Material model = new Maticsoft.Model.W_Material();
            model                   = bll.GetModel(Id);
            this.lblId.Text         = model.Id.ToString();
            this.lblName.Text       = model.Name;
            this.lblBeginDate.Text  = (Convert.ToDateTime(model.Begindate)).ToShortDateString();
            this.lblEnddate.Text    = (Convert.ToDateTime(model.Enddate)).ToShortDateString();
            this.Label_Address.Text = model.Address;
            this.Label_Number.Text  = model.Number;


            DataSet ds2 = new DataSet();

            Maticsoft.BLL.W_Receivestate bll3 = new Maticsoft.BLL.W_Receivestate();
            ds2 = bll3.GetList("MaterialId=" + Id);
            for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
            {
                int j = int.Parse(ds2.Tables[0].Rows[i][2].ToString());
                Maticsoft.BLL.W_Receiver   bll4   = new Maticsoft.BLL.W_Receiver();
                Maticsoft.Model.W_Receiver model4 = new Maticsoft.Model.W_Receiver();
                model4 = bll4.GetModel(j);
                this.lblReceiver.Text += model4.Receiver + "  ";
            }

            DataSet ds5 = new DataSet();

            Maticsoft.BLL.W_Receivestate bll5 = new Maticsoft.BLL.W_Receivestate();
            ds5 = bll5.GetList("MaterialId=" + Id + "and Dormacy = '提交'");
            for (int i = 0; i < ds5.Tables[0].Rows.Count; i++)
            {
                int j = int.Parse(ds5.Tables[0].Rows[i][2].ToString());
                Maticsoft.BLL.W_Receiver   bll4   = new Maticsoft.BLL.W_Receiver();
                Maticsoft.Model.W_Receiver model4 = new Maticsoft.Model.W_Receiver();
                model4 = bll4.GetModel(j);
                this.Label_IsHanded.Text += model4.Receiver + "  ";
            }
        }
Exemplo n.º 15
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.Name.Text == "")
            {
                this.Label2.Text = "请输入材料名";
                return;

            }


            //过期是否显示的判断
            Maticsoft.BLL.W_Material bllmaterial = new Maticsoft.BLL.W_Material();
           
        
            if (this.CheckBox1.Checked)
            {
                bllmaterial.ReleaseList(int.Parse(this.Label1.Text)); 
            }
            else
            {
                bllmaterial.NoReleaseList((int.Parse(this.Label1.Text)));
            }
         




            Maticsoft.Model.W_Receivestate receivestate = new Maticsoft.Model.W_Receivestate();
            Maticsoft.BLL.W_Receivestate bllstate = new Maticsoft.BLL.W_Receivestate();


            //4-3修改by 陈湘军
            for (int i = 0; i < this.CheckBoxList_Reciever.Items.Count; i++)
            {
                receivestate.ReceiverId = this.CheckBoxList_Reciever.Items[i].Value;
                receivestate.MaterialId = int.Parse(this.Label1.Text.Trim());

                if (this.CheckBoxList_Reciever.Items[i].Selected)
                {
                  
                    receivestate.Dormacy = "提交";
                    receivestate.IssureTime = Convert.ToDateTime(DateTime.Now.ToShortTimeString());
                }
                else
                    receivestate.Dormacy = "";

                bllstate.Update(receivestate);

            }
            if (int.Parse(this.Label1.Text) > 1)
            {
                //this.Label_Msg.Text = "提交成功!";
            }
            Response.Redirect("AllList.aspx");
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {


            string id = "";
            //CheckBoxList_Reciever初始化
            if (!IsPostBack)
            {
                try
                {
                    id = Request.QueryString[0].ToString();
                    this.Label1.Text = id;
                }
                catch { }

                if (id == "")
                {
                    this.begindate.Text = DateTime.Now.ToShortDateString();
                    this.enddate.Text = DateTime.Now.AddDays(7).ToShortDateString();
                }

                else
                {
                    //绑定CheckBoxList前面的部分
                    Maticsoft.BLL.W_Material bll2 = new Maticsoft.BLL.W_Material();
                    Maticsoft.Model.W_Material model = new Maticsoft.Model.W_Material();
                    model = bll2.GetModel(int.Parse(id));
                    this.Name.Text = model.Name;
                    this.begindate.Text = (Convert.ToDateTime(model.Begindate)).ToShortDateString();
                    this.enddate.Text = (Convert.ToDateTime(model.Enddate)).ToShortDateString();
                    //绑定是否显示过期
                    if (model.Outdisplay == "是")
                        this.CheckBox1.Checked = true;
                    //绑定CheckBoxList
                    DataSet ds = new DataSet();
                    Maticsoft.BLL.W_Receiver bll = new Maticsoft.BLL.W_Receiver();
                    ds = bll.W_Receiver_Mid(id);
                    this.CheckBoxList_Reciever.DataSource = ds;
                    CheckBoxList_Reciever.DataTextField = "Receiver";
                    CheckBoxList_Reciever.DataValueField = "Id";
                    CheckBoxList_Reciever.DataBind();

                    //添加选定内容 陈湘军 
                    //修改存储过程 W_Receiver_Mid,添加dormacy字段

                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            try
                            {
                                CheckBoxList_Reciever.Items[i].Selected = (ds.Tables[0].Rows[i]["dormacy"].ToString() == "提交");
                            }
                            catch { }
                        }
                    }
                    
                }
            }
            
        }
Exemplo n.º 17
0
 protected void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     string btn = e.CommandName;
     switch (btn)
     {
         case "BtnEdit":
             int Id1 = int.Parse(e.Item.Cells[8].Text.Trim());
             Response.Redirect("AddMaterial.aspx?Id=" + Id1);
             break;
         case "BtnDel":
             int Id2 = int.Parse(e.Item.Cells[8].Text.Trim());
             Maticsoft.BLL.W_Material bll2 = new Maticsoft.BLL.W_Material();
             bll2.Delete(Id2);
             Maticsoft.BLL.W_Receivestate bll3 = new Maticsoft.BLL.W_Receivestate();
             bll3.Delete(Id2);
             break;
         case "BtnManager":
             int Id3 = int.Parse(e.Item.Cells[8].Text.Trim());
             Response.Redirect("Manager.aspx?Id=" + Id3);                  
             break;
     }
     dataBind();
 }
Exemplo n.º 18
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.Name.Text == "") 
            { 
                this.Label2.Text = "请输入材料名";
                return;    

            }


            //对Material表的输入
            DateTime begindate = Convert .ToDateTime (this .begindate .Text );
            DateTime enddate = Convert.ToDateTime(this.enddate .Text);
            string name = this.Name .Text.Trim();
            string address = this.TextBox_Address.Text.Trim();
            string number = this.TextBox_Number.Text.Trim();
           // Maticsoft.Model.W_Material material = new Maticsoft.Model.W_Material();
            Maticsoft.BLL.W_Material bll = new Maticsoft.BLL.W_Material();
            model.Name = name;
            model.Begindate = begindate;
            model.Enddate = enddate;
            model.Address = address;
            model.Number = number;

            int id;
            Maticsoft.Model.W_Receivestate receivestate = new Maticsoft.Model.W_Receivestate();
            Maticsoft.BLL.W_Receivestate bllstate = new Maticsoft.BLL.W_Receivestate();
   
            if (this.Label_materialId.Text == "") //添加
                id = bll.Add(model);
            else //修改
            {
                id = int.Parse( this.Label_materialId.Text.Trim());
                model.Id = int.Parse(this.Label_materialId.Text.Trim());
                bll.Update(model);

                //对W_Receivestate表的操作 添加时是否需要 bllstate.delete??
                bllstate.Delete(id);
  
            }

             
            receivestate.MaterialId = id;
            for (int i = 0; i < this.CheckBoxList_Reciever.Items.Count; i++)
            {
                if (this.CheckBoxList_Reciever.Items[i].Selected)
                {
                    receivestate.ReceiverId = this.CheckBoxList_Reciever.Items[i].Value;                    
                        bllstate.Add(receivestate);                   
                }
            }
            if (id > 1)
            {
                //this.Label_Msg.Text = "提交成功!";
            }
            Response.Redirect("ManagerMaterial.aspx");
        }