protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string strErr = "";

                int number = int.Parse(txt_number.Value);
                int addressID;
                if (number <= 0 && number > int.Parse(lblcom_number.Text))
                {
                    strErr = "回收的数量不符合要求";
                }
                if (strErr != "")
                {
                    MessageBox.Show(this, strErr);
                    return;
                }

                if (r6.Checked)
                {
                    addressID = int.Parse(lb_address.SelectedValue);
                }
                else
                {
                    Model.t_address address = new Model.t_address();
                    address.add_province     = ddl_p.Items[ddl_p.SelectedIndex].Text;
                    address.add_city         = ddl_c.Items[ddl_c.SelectedIndex].Text;
                    address.add_counties     = ddl_d.Items[ddl_d.SelectedIndex].Text;
                    address.add_address      = input_Address.Text;
                    address.add_date         = DateTime.Now;
                    address.add_default      = "0";
                    address.add_u_ID         = int.Parse(userid.Text);
                    address.add_postcode     = 000000;
                    address.add_contactName  = input_userName.Text;
                    address.add_contactPhone = input_phone.Text;
                    address.add_ID           = new BLL.t_address().GetMaxId();
                    bool istrue = new BLL.t_address().Add(address);
                    addressID = address.add_ID;
                }
                user = new BLL.t_user().GetModel(int.Parse(userid.Text));
                int      tra_U_ID = int.Parse(userid.Text);
                decimal  tra_transactionAmount = decimal.Parse(this.lblcom_conversionInt.Text);
                DateTime tra_transactionDate   = DateTime.Now;
                string   tra_accomplish        = "发布";
                int      tra_staff_id          = 0;
                int      sta_comwas_id         = int.Parse(this.lblcom_id.Text);
                int      tra_number            = int.Parse(this.txt_number.Value);
                if (user.u_integral < tra_number * tra_transactionAmount)
                {
                    strErr += "你的积分不够哦!\\n";
                    MessageBox.Show(this, strErr);
                    return;
                }
                user.u_integral = Convert.ToInt32(user.u_integral - tra_number * tra_transactionAmount);
                bool isuser = new BLL.t_user().Update(user);
                // int tra_addressID = int.Parse(this.rad_address.SelectedValue);
                string tra_type  = "商品";
                string tra_vaild = "是";
                int    tra_sort  = 1;

                WalleProject.Model.t_tradingrecord model = new WalleProject.Model.t_tradingrecord();
                model.tra_addressID         = addressID;
                model.tra_U_ID              = tra_U_ID;
                model.tra_transactionAmount = tra_transactionAmount;
                model.tra_transactionDate   = tra_transactionDate;
                model.tra_accomplish        = tra_accomplish;
                model.tra_staff_id          = tra_staff_id;
                model.sta_comwas_id         = sta_comwas_id;
                model.tra_number            = tra_number;
                model.tra_type              = tra_type;
                model.tra_vaild             = tra_vaild;
                model.tra_sort              = tra_sort;

                WalleProject.BLL.t_tradingrecord bll = new WalleProject.BLL.t_tradingrecord();
                bll.Add(model);
                Maticsoft.Common.MessageBox.ShowAndRedirect(this, "发布成功,等待回收员接单", "CommodityView.aspx?id=9");
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message);
            }
        }
Exemple #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (int.Parse(txt_number.Value) <= 0)
            {
                strErr = "回收的数量不符合要求";
            }
            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }

            int number = int.Parse(txt_number.Value);
            int addressID;

            if (r6.Checked)
            {
                addressID = int.Parse(ListBox1.SelectedValue);
            }
            else
            {
                Model.t_address address = new Model.t_address();

                address.add_province     = ddl_p.Items[ddl_p.SelectedIndex].Text;
                address.add_city         = ddl_c.Items[ddl_c.SelectedIndex].Text;
                address.add_counties     = ddl_d.Items[ddl_d.SelectedIndex].Text;
                address.add_address      = input_Address.Text;
                address.add_date         = DateTime.Now;
                address.add_default      = "0";
                address.add_u_ID         = int.Parse(userid.Text);
                address.add_postcode     = 000000;
                address.add_contactName  = input_userName.Text;
                address.add_contactPhone = input_phone.Text;
                address.add_ID           = new BLL.t_address().GetMaxId();
                bool istrue = new BLL.t_address().Add(address);
                addressID = address.add_ID;
            }

            int      tra_U_ID = int.Parse(userid.Text);
            decimal  tra_transactionAmount = decimal.Parse(this.lblwas_price2.Text);
            DateTime tra_transactionDate   = DateTime.Now;
            string   tra_accomplish        = "发布";
            int      tra_staff_id          = 0;
            int      sta_comwas_id         = int.Parse(this.lblwas_ID.Text);
            int      tra_number            = int.Parse(txt_number.Value);
            // int tra_addressID = int.Parse(this.rad_address.SelectedValue);
            string tra_type  = "废品";
            string tra_vaild = "是";
            int    tra_sort  = 1;

            WalleProject.Model.t_tradingrecord model = new WalleProject.Model.t_tradingrecord();
            model.tra_addressID         = addressID;
            model.tra_U_ID              = tra_U_ID;
            model.tra_transactionAmount = tra_transactionAmount;
            model.tra_transactionDate   = tra_transactionDate;
            model.tra_accomplish        = tra_accomplish;
            model.tra_staff_id          = tra_staff_id;
            model.sta_comwas_id         = sta_comwas_id;
            model.tra_number            = tra_number;
            // model.tra_addressID = tra_addressID;
            model.tra_type  = tra_type;
            model.tra_vaild = tra_vaild;
            model.tra_sort  = tra_sort;

            WalleProject.BLL.t_tradingrecord bll = new WalleProject.BLL.t_tradingrecord();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "发布成功,等待回收员上门!", "WasteView.aspx?id=5");
        }