Exemple #1
0
        private void LoadData()
        {
            var    cookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
            var    ticket = FormsAuthentication.Decrypt(cookie.Value);
            string uid    = ticket.UserData;

            //// 默认的排序列和排序方向
            //Grid1.SortColumnIndex = 0;
            //Grid1.SortDirection = "DESC";

            // 每页记录数
            Grid1.PageSize = 15;

            //// 点击删除按钮时,至少选中一项
            //ResolveDeleteGridItem(btnDeleteSelected, Grid1);

            int id = GetQueryIntValue("id");

            TSM.Model.pms_Quotation_Info modelpms_Quotation_Info = m_bllpms_Quotation_Info.GetModel(id);
            modelpms_Quotation_Info = m_bllpms_Quotation_Info.GetModel2(id);


            if (modelpms_Quotation_Info == null)
            {
                // 参数错误,首先弹出Alert对话框然后关闭弹出窗口
                Alert.Show("参数错误!", String.Empty, ActiveWindow.GetHideReference());
                return;
            }

            //给控件赋初值,显示
            lbBatchID.Text = modelpms_Quotation_Info.QuotationInfoID.ToString().Trim();

            lbChar0.Text = modelpms_Quotation_Info.加工费用.ToString().Trim();
            if (uid == "4")
            {
                lbPack0.Text = Convert.ToInt64(Convert.ToDecimal(modelpms_Quotation_Info.包装费用) + Convert.ToDecimal(modelpms_Quotation_Info.喷涂费用)).ToString();
                tbxPack.Text = Convert.ToInt64(Convert.ToDecimal(modelpms_Quotation_Info.包装费用) + Convert.ToDecimal(modelpms_Quotation_Info.喷涂费用)).ToString();
            }
            else
            {
                lbPack0.Text = Convert.ToInt64(Convert.ToDecimal(modelpms_Quotation_Info.包装费用)).ToString();
                tbxPack.Text = Convert.ToInt64(Convert.ToDecimal(modelpms_Quotation_Info.包装费用)).ToString();
            }

            lbTest0.Text  = modelpms_Quotation_Info.检测费用.ToString().Trim();
            lbTrans0.Text = modelpms_Quotation_Info.运输费用.ToString().Trim();
            lbKnife0.Text = modelpms_Quotation_Info.刀具费用.ToString().Trim();
            lbTool0.Text  = modelpms_Quotation_Info.工装费用.ToString().Trim();
            lbPrice0.Text = (Convert.ToDecimal(lbChar0.Text) + Convert.ToDecimal(lbPack0.Text) + Convert.ToDecimal(lbTest0.Text) + Convert.ToDecimal(lbTrans0.Text)).ToString();

            lbChar2.Text  = modelpms_Quotation_Info.加工信息.ToString().Trim();
            lbPack2.Text  = modelpms_Quotation_Info.包装信息 + ";喷涂:" + modelpms_Quotation_Info.喷涂信息;
            lbTest2.Text  = modelpms_Quotation_Info.检测信息.ToString().Trim();
            lbTrans2.Text = modelpms_Quotation_Info.运费信息.ToString().Trim();
            lbKnife2.Text = modelpms_Quotation_Info.刀具信息.ToString().Trim();
            lbTool2.Text  = modelpms_Quotation_Info.工装信息.ToString().Trim();

            tbxChar.Text = modelpms_Quotation_Info.加工费用.ToString().Trim();

            tbxTest.Text  = modelpms_Quotation_Info.检测费用.ToString().Trim();
            tbxTrans.Text = modelpms_Quotation_Info.运输费用.ToString().Trim();
            tbxKnife.Text = modelpms_Quotation_Info.刀具费用.ToString().Trim();
            tbxTool.Text  = modelpms_Quotation_Info.工装费用.ToString().Trim();

            lbPrice1.Text = (Convert.ToDecimal(tbxChar.Text) + Convert.ToDecimal(tbxPack.Text) + Convert.ToDecimal(tbxTest.Text) +
                             Convert.ToDecimal(tbxTrans.Text)).ToString();
            tbxPrice.Text     = Math.Round((Convert.ToDecimal(lbPrice1.Text) / Convert.ToDecimal(lbPrice0.Text) - 1) * 100, 0).ToString();
            lbPriceOnce0.Text = (Convert.ToDecimal(lbTool0.Text) + Convert.ToDecimal(lbKnife0.Text)).ToString();
            lbPriceOnce1.Text = (Convert.ToDecimal(tbxKnife.Text) + Convert.ToDecimal(tbxTool.Text)).ToString();
            lbUPrice0.Text    = Math.Round(Convert.ToDecimal(lbPrice1.Text) / modelpms_Quotation_Info.净重, 0).ToString();

            //绑定表格
            BindGrid();

            //父窗口向子窗口传值
            string BatchId = lbBatchID.Text.ToString().Trim();
            //  btnNew.OnClientClick = Window1.GetSaveStateReference(tbxCharge.ClientID) + Window1.GetShowReference("~/pms_Quotation_Info_new.aspx?id=" + BatchId, "添加机床");
        }
        private void LoadData()
        {
            //绑定报价单位下拉列表控件
            DataSet dsCom = m_bllpms_Company_Info.GetList("");

            ddlCom.DataValueField = "CompanyInfoID";
            ddlCom.DataTextField  = "CompanyName";
            ddlCom.DataSource     = dsCom.Tables[0];
            ddlCom.DataBind();

            //// 默认的排序列和排序方向
            //Grid1.SortColumnIndex = 0;
            //Grid1.SortDirection = "DESC";

            // 每页记录数
            Grid1.PageSize = 15;

            //// 点击删除按钮时,至少选中一项
            //ResolveDeleteGridItem(btnDeleteSelected, Grid1);

            int    id     = GetQueryIntValue("id");
            string weight = GetQueryValue("id1");

            TSM.Model.pms_Quotation_Info modelpms_Quotation_Info = m_bllpms_Quotation_Info.GetModel(id);
            if (modelpms_Quotation_Info == null)
            {
                // 参数错误,首先弹出Alert对话框然后关闭弹出窗口
                Alert.Show("参数错误!", String.Empty, ActiveWindow.GetHideReference());
                return;
            }
            else
            {
                //给控件赋初值,显示
                lbBatchID.Text       = modelpms_Quotation_Info.QuotationInfoID.ToString().Trim();
                ddlCom.SelectedValue = modelpms_Quotation_Info.QuotationDepart.ToString().Trim();
                tbxKnife.Text        = modelpms_Quotation_Info.KnifeCharges.ToString().Trim();
                tbxTool.Text         = modelpms_Quotation_Info.ToolCharges.ToString().Trim();
                tbxSpray.Text        = modelpms_Quotation_Info.SprayingCharges.ToString().Trim();
                tbxPack.Text         = modelpms_Quotation_Info.PackingCharges.ToString().Trim();
                tbxTest.Text         = modelpms_Quotation_Info.TestingCharges.ToString().Trim();
                tbxTrans.Text        = modelpms_Quotation_Info.TransportCharges.ToString().Trim();
                tbxCharge.Text       = modelpms_Quotation_Info.Charge.ToString().Trim();
                lbProID.Text         = modelpms_Quotation_Info.ProductInfoID.ToString().Trim();
                if (modelpms_Quotation_Info.ChargeDescrib != null)
                {
                    tbxChargeDesc.Text = modelpms_Quotation_Info.ChargeDescrib;
                }
                if (modelpms_Quotation_Info.KinfeDescrib != null)
                {
                    tbxKnifeDesc.Text = modelpms_Quotation_Info.KinfeDescrib;
                }
                if (modelpms_Quotation_Info.PackingDescrib != null)
                {
                    tbxPackDesc.Text = modelpms_Quotation_Info.PackingDescrib;
                }
                if (modelpms_Quotation_Info.SprayingDescrib != null)
                {
                    tbxSprayDesc.Text = modelpms_Quotation_Info.SprayingDescrib;
                }
                if (modelpms_Quotation_Info.TestingDescrib != null)
                {
                    tbxTestDesc.Text = modelpms_Quotation_Info.TestingDescrib;
                }
                if (modelpms_Quotation_Info.ToolsDescrib != null)
                {
                    tbxToolDesc.Text = modelpms_Quotation_Info.ToolsDescrib;
                }
                if (modelpms_Quotation_Info.TransportDescrib != null)
                {
                    tbxTransDesc.Text = modelpms_Quotation_Info.TransportDescrib;
                }
                if (modelpms_Quotation_Info.Charge.ToString().Trim() != null)
                {
                    decimal Price = Convert.ToDecimal(modelpms_Quotation_Info.Charge) + Convert.ToDecimal(tbxPack.Text)
                                    + Convert.ToDecimal(tbxTrans.Text) + Convert.ToDecimal(tbxTest.Text)
                                    + Convert.ToDecimal(tbxSpray.Text);
                    lbUnitPrice.Text = Math.Round((Price / Convert.ToDecimal(weight)), 0).ToString();
                }
            }
            //绑定表格
            BindGrid();

            //父窗口向子窗口传值
            string BatchId = lbBatchID.Text.ToString().Trim();

            btnNew.OnClientClick = Window1.GetSaveStateReference(tbxCharge.ClientID) + Window1.GetShowReference("~/pms_Quotation_Info_new.aspx?id=" + BatchId, "添加机床");
        }