Esempio n. 1
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtOrderID.Text.Trim().Length == 0)
            {
                strErr += "OrderID不能为空!\\n";
            }
            if (this.txtCommodityID.Text.Trim().Length == 0)
            {
                strErr += "CommodityID不能为空!\\n";
            }
            if (this.txtUserID.Text.Trim().Length == 0)
            {
                strErr += "UserID不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtOrderNumber.Text))
            {
                strErr += "OrderNumber格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtAppraiseGrade.Text))
            {
                strErr += "AppraiseGrade格式错误!\\n";
            }
            if (this.txtSubtotal.Text.Trim().Length == 0)
            {
                strErr += "Subtotal不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string OrderDetailID = this.lblOrderDetailID.Text;
            string OrderID       = this.txtOrderID.Text;
            string CommodityID   = this.txtCommodityID.Text;
            string UserID        = this.txtUserID.Text;
            int    OrderNumber   = int.Parse(this.txtOrderNumber.Text);
            int    AppraiseGrade = int.Parse(this.txtAppraiseGrade.Text);
            string Subtotal      = this.txtSubtotal.Text;


            Maticsoft.Model.OrderDetail model = new Maticsoft.Model.OrderDetail();
            model.OrderDetailID = OrderDetailID;
            model.OrderID       = OrderID;
            model.CommodityID   = CommodityID;
            model.UserID        = UserID;
            model.OrderNumber   = OrderNumber;
            model.AppraiseGrade = AppraiseGrade;
            model.Subtotal      = Subtotal;

            Maticsoft.BLL.OrderDetail bll = new Maticsoft.BLL.OrderDetail();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Esempio n. 2
0
 protected void Button2_Click1(object sender, EventArgs e)
 {
     if (UsersInfo.UserID == "")
     {
         Response.Write("<script> alert('请先登录!'); window.location.href='../Login.aspx' </script>");
         return;
     }
     if (OrderDetail_Bll.GetRecordCount(" CommodityID='" + Request.QueryString["ID"].ToString() + "' and UserID='" + UsersInfo.UserID + "' ") <= 0)
     {
         RadRating1.Visible = false;
         Button2.Visible    = false;
     }
     else
     {
         try
         {
             string OrdersDetailedid = OrderDetail_Bll.GetList(" CommodityID='" + Request.QueryString["ID"].ToString() + "' and UserID='" + UsersInfo.UserID + "'and AppraiseGrade is null ").Tables[0].Rows[0]["OrderDetailID"].ToString();
             Maticsoft.Model.OrderDetail molorderdetail = OrderDetail_Bll.GetModel(OrdersDetailedid);
         }
         catch (Exception)
         {
             Response.Write("<script>alert('已经评过分,请刷新后重试!')</script>");
             if (OrderDetail_Bll.GetRecordCount(" CommodityID='" + Request.QueryString["ID"].ToString() + "' and UserID='" + UsersInfo.UserID + "' ") > 0)
             {
                 RadRating1.Visible = false;
                 Button2.Visible    = false;
             }
             return;
         }
         string OrdersDetailedid1 = OrderDetail_Bll.GetList(" CommodityID='" + Request.QueryString["ID"].ToString() + "' and UserID='" + UsersInfo.UserID + "'and AppraiseGrade is null ").Tables[0].Rows[0]["OrderDetailID"].ToString();
         Maticsoft.Model.OrderDetail molorderdetail1 = OrderDetail_Bll.GetModel(OrdersDetailedid1);
         if (RadRating1.Value == 0)
         {
             Response.Write("<script>alert('请评分!')</script>");
             return;
         }
         if (RadRating1.Value == 1)
         {
             molorderdetail1.AppraiseGrade = 40;
         }
         if (RadRating1.Value == 2)
         {
             molorderdetail1.AppraiseGrade = 60;
         }
         if (RadRating1.Value == 3)
         {
             molorderdetail1.AppraiseGrade = 80;
         }
         if (RadRating1.Value == 4)
         {
             molorderdetail1.AppraiseGrade = 100;
         }
         OrderDetail_Bll.Update(molorderdetail1);
         pinfen();
         RadAjaxManager1.Alert("评分成功!");
         if (OrderDetail_Bll.GetRecordCount(" CommodityID='" + Request.QueryString["ID"].ToString() + "' and UserID='" + UsersInfo.UserID + "' ") > 0)
         {
             RadRating1.Visible = false;
             Button2.Visible    = false;
         }
     }
 }