Esempio n. 1
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int rowIndex = e.RowIndex;

            Freight freight = new Freight();

            freight.Freight_id = Convert.ToInt32(this.GridView1.DataKeys[rowIndex].Value);

            FreightProvider provider = new FreightProvider();

            if (provider.Delete(freight))
            {
                this.Alert("删除成功!!!");

                if (this.txt_Name.Text == "")
                {
                    this.ListPager1.RecordCount = this.ListPager1.RecordCount - 1;
                    this.BindSource(null);
                }
                else
                {
                    this.ListPager1.RecordCount = this.ListPager1.RecordCount - 1;
                    this.BindSource("%" + this.txt_Name.Text + "%");
                }
            }
        }
Esempio n. 2
0
        protected void btn_sure_Click(object sender, EventArgs e)
        {
            Freight         freight  = this.AddFreight();
            FreightProvider provider = new FreightProvider();

            switch (this.OperationFlag)
            {
            case Operation.Add:
                if (this.IsSame() == 1)
                {
                    break;
                }
                if (provider.Insert(freight))
                {
                    this.Alert("添加成功!!!");
                    this.TextCancel();
                }
                break;

            case Operation.Update:
                if (provider.Update(freight))
                {
                    this.Alert("修改成功!!!");
                    this.BindText();
                }
                break;
            }
        }
Esempio n. 3
0
        protected void btn_Result_Click(object sender, EventArgs e)
        {
            Freight freight = new Freight();

            freight.Freight_name = "%" + this.txt_Name.Text + "%";
            FreightProvider provider = new FreightProvider();

            this.ListPager1.RecordCount = provider.GetSize(freight);
            this.BindSource(0, "%" + this.txt_Name.Text + "%");
            this.ListPager1.PageChange += new PagerEventHandler(ListPager1_PageChange);
        }
Esempio n. 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         FreightProvider provider = new FreightProvider();
         this.ListPager1.RecordCount = provider.GetSize();
         this.BindSource(0, null);
     }
     this.account.Text           = Session["LOGINED"].ToString();
     this.datetime.Text          = this.BindDayWeek();
     this.ListPager1.PageChange += new PagerEventHandler(ListPager1_PageChange);
 }
Esempio n. 5
0
        private void BindText()
        {
            Freight freight = new Freight();

            freight.Freight_id = Convert.ToInt32(id);
            FreightProvider provider = new FreightProvider();
            DataTable       table    = new DataTable();

            table = provider.Select(freight);

            this.txt_name.Text = table.Rows[0]["freight_name"].ToString();
        }
Esempio n. 6
0
        private void BindSource()
        {
            FreightProvider freight = new FreightProvider();

            this.ddl_freight.DataSource = freight.GetAll();
            this.ddl_freight.DataBind();
            SendProvider send = new SendProvider();

            this.ddl_send.DataSource = send.GetAll();
            this.ddl_send.DataBind();
            CustomersProvider customers = new CustomersProvider();

            this.ddl_customers.DataSource = customers.GetAll();
            this.ddl_customers.DataBind();
        }
Esempio n. 7
0
 /// <summary>
 ///  绑定Freight信息的数据源
 /// </summary>
 private void BindSource(int start, string name)
 {
     if (name != null)
     {
         Freight freight = new Freight();
         freight.Freight_name = name;
         FreightProvider provider = new FreightProvider();
         DataTable       table    = provider.Select(freight, start, this.ListPager1.PageSize);
         this.GridView1.DataSource = table.DefaultView;
         this.GridView1.DataBind();
     }
     else
     {
         FreightProvider provider = new FreightProvider();
         DataTable       table    = provider.GetAll(start, this.ListPager1.PageSize);
         this.GridView1.DataSource = table.DefaultView;
         this.GridView1.DataBind();
     }
 }
Esempio n. 8
0
        private int IsSame()
        {
            Freight         freight  = new Freight();
            FreightProvider provider = new FreightProvider();

            freight.Freight_name = this.txt_name.Text;
            DataTable table = new DataTable();

            table = provider.Select(freight);
            if (table.Rows.Count != 0)
            {
                this.Alert("该方式已经存在,请重新输入!!!");
                return(1);
            }
            else
            {
                return(0);
            }
        }