Beispiel #1
0
        protected void gvInvDetails_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            var json = "";

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#EAF1FD',this.style.fontWeight='';");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';");
                tb_QuotePrice_InvDetails model = e.Row.DataItem as tb_QuotePrice_InvDetails;
                //json = JsonConvert.SerializeObject(model);
            }
            ImageButton btnEdit = e.Row.FindControl("btnEdit") as ImageButton;

            if (btnEdit != null)
            {
                //json= Uri.EscapeUriString(json);
                //json = HttpUtility.UrlEncode(CommHelp.DES3Encrypt(json,"AAA"));


                //string val = string.Format("javascript:window.showModalDialog('QPInvDetails.aspx?index={0}',null,'dialogWidth:500px;dialogHeight:450px;help:no;status:no')", e.Row.DataItemIndex);
                //btnEdit.Attributes.Add("onclick", val);

                string val = string.Format("javascript:window.showModalDialog('QPInvDetails.aspx?index={0}',null,'dialogWidth:500px;dialogHeight:450px;help:no;status:no')", e.Row.DataItemIndex + "&m=" + json);
                btnEdit.Attributes.Add("onclick", val);
            }
        }
Beispiel #2
0
 private void setValue(tb_QuotePrice_InvDetails model)
 {
     txtCostPrice.Text      = Convert.ToDecimal(model.InvPrice).ToString();
     txtInvName.Text        = model.InvName;
     txtNum.Text            = model.InvNum.ToString();
     txtUnit.Text           = model.InvUnit;
     txtCostTotal.Text      = string.Format("{0:n2}", model.InvNum * model.InvPrice);
     lblSpec.Text           = model.InvModel;
     txtGoodNo.Text         = model.GoodNo;
     lblGoodSmTypeName.Text = model.GoodTypeSmName;
     txtProduct.Text        = model.Product;
     txtGoodBrand.Text      = model.GoodBrand;
     txtRemark.Text         = model.InvRemark;
 }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //var requestString = HttpUtility.UrlDecode(CommHelp.DES3DecryptUtf8(Request["m"],"123"), System.Text.Encoding.GetEncoding("utf-8"));

                //var requestString = CommHelp.DES3Decrypt(HttpUtility.UrlDecode(Request["m"]), "AAA");

                if (Request["index"] != null)
                {
                    int index = Convert.ToInt32(Request["index"]);
                    if (Session["DataInvDetails"] != null)
                    {
                        List <tb_QuotePrice_InvDetails> invDetails = Session["DataInvDetails"] as List <tb_QuotePrice_InvDetails>;
                        tb_QuotePrice_InvDetails        m          = invDetails[index];

                        //var m = JsonConvert.DeserializeObject<tb_QuotePrice_InvDetails>(requestString);
                        setValue(m);
                        ViewState["m"] = m;
                    }
                }
            }
        }
Beispiel #4
0
        protected void gvInvDetails_RowEditing(object sender, GridViewEditEventArgs e)
        {
            if (Session["m"] != null)
            {
                tb_QuotePrice_InvDetails        m          = Session["m"] as tb_QuotePrice_InvDetails;
                List <tb_QuotePrice_InvDetails> invDetails = Session["DataInvDetails"] as List <tb_QuotePrice_InvDetails>;
                invDetails[m.UpdateIndex] = m;
                Session["m"]            = null;
                gvInvDetails.DataSource = invDetails;
                gvInvDetails.DataBind();

                if (!string.IsNullOrEmpty(txtLaborCost.Text))
                {
                    //YY=设备材料价格+人工费
                    txtRenGJS.Text = (invDetails.Sum(t => t.Total) + Convert.ToDecimal(txtLaborCost.Text)).ToString();
                }
                else
                {
                    //YY=设备材料价格+人工费
                    txtRenGJS.Text = invDetails.Sum(t => t.Total).ToString();
                }
                GetALLTotal();
            }
        }
Beispiel #5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (txtNum.Text.Trim() != "")
            {
                if (CommHelp.VerifesToNum(txtNum.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('数量 格式错误!');</script>");
                    return;
                }
            }
            if (txtCostPrice.Text.Trim() != "")
            {
                if (CommHelp.VerifesToNum(txtCostPrice.Text) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('单价 格式错误!');</script>");
                    return;
                }
            }
            //int goodId = goodsSer.GetGoodId(txtInvName.Text, lblSpec.Text, txtModel.Text,lblGoodSmTypeName.Text,txtUnit.Text);
            //if (goodId == 0)
            //{
            //    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的商品不存在!');</script>");

            //    return;
            //}
            try
            {
                Convert.ToDecimal(txtCostPrice.Text);
            }
            catch (Exception)
            {
                base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('你填写的单价格式有误!');</script>");
                return;
            }
            //var good= goodsSer.GetModel(goodId);
            tb_QuotePrice_InvDetails s = new tb_QuotePrice_InvDetails();

            s.InvUnit        = txtUnit.Text;
            s.InvPrice       = Convert.ToDecimal(txtCostPrice.Text);
            s.InvGoodId      = 0;
            s.InvName        = txtInvName.Text;
            s.InvNum         = Convert.ToDecimal(txtNum.Text);
            s.InvModel       = lblSpec.Text;
            s.GoodBrand      = txtGoodBrand.Text;
            s.Total          = s.InvNum * s.InvPrice;
            s.Product        = txtProduct.Text;
            s.GoodNo         = txtGoodNo.Text;
            s.GoodTypeSmName = lblGoodSmTypeName.Text;
            s.InvRemark      = txtRemark.Text;
            //修改
            if (Request["index"] != null)
            {
                int index = Convert.ToInt32(Request["index"]);

                tb_QuotePrice_InvDetails model = ViewState["m"] as tb_QuotePrice_InvDetails;
                s.Id          = model.Id;
                s.IfUpdate    = true;
                s.UpdateIndex = Convert.ToInt32(Request["index"]);
                Session["m"]  = s;


                this.ClientScript.RegisterStartupScript(this.GetType(), null, "<script> window.close();</script>");
            }
            else
            {
                if (Session["InvDetails"] == null)
                {
                    List <tb_QuotePrice_InvDetails> invDetails = new List <tb_QuotePrice_InvDetails>();
                    invDetails.Insert(invDetails.Count, s);
                    Session["InvDetails"] = invDetails;
                }
                else
                {
                    List <tb_QuotePrice_InvDetails> invDetails = Session["InvDetails"] as List <tb_QuotePrice_InvDetails>;
                    invDetails.Insert(invDetails.Count, s);
                    Session["InvDetails"] = invDetails;
                }
                clear();
            }
            // this.ClientScript.RegisterStartupScript(this.GetType(), null, "<script> window.close();</script>");
        }