예제 #1
0
    /// <summary>
    /// 数据保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        LCustData model = new LCustData();
        LCustBB custBB = new LCustBB();
        try
        {
            if (this.State == "1")
            {
                this.SetModel(ref model);
                model.isrtDt = DateTime.Now.ToString();
                model.isrtEmpId = this.currentUser.empId;
                this.IdValue = custBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                model = custBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                model.updtDt = DateTime.Now.ToString();
                model.updtEmpId = this.currentUser.empId;
                custBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            custBB.Dispose();
        }

        Response.Redirect("LCustList.aspx?&itemno=" + this.itemNo + "&pTypeNo=main", false);
    }
예제 #2
0
    /// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        LCustBB custBB = new LCustBB();
        DataSet ds = new DataSet();

        try
        {
            string strWhere = this.StrWhere;

            //客户编码
            if (this.tbCustNo.Text.Trim() != "")
            {
                strWhere += " and custNo like '%" + this.tbCustNo.Text.Trim().Replace("'", "''") + "%'";
            }

            //客户名称
            if (this.tbCustNm.Text.Trim() != "")
            {
                strWhere += " and custNm like '%" + this.tbCustNm.Text.Trim().Replace("'", "''") + "%'";
            }

            //客户分类
            if (this.ddlCustSort.SelectedValue != "")
            {
                strWhere += " and custSort='" + this.ddlCustSort.SelectedValue + "'";
            }

            ds = custBB.GetVList(strWhere);
            this.grid.DataSource = ds.Tables[0];
            this.grid.DataBind();

            //赋值记录条数、页面总数
            this.Label3.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();
        }
        finally
        {
            custBB.Dispose();
        }
    }
예제 #3
0
 /// <summary>
 /// 展示数据
 /// </summary>
 /// <param name="id">记录Id</param>
 private void ShowInfo(int id)
 {
     LCustBB custBB = new LCustBB();
     LCustData model = new LCustData();
     try
     {
         model = custBB.GetModel(id);
         this.custNo.Text = model.custNo;
         this.custNm.Text = model.custNm;
         this.custSort.Text = model.custSort;
         this.shippingMark.Text = model.shippingMark;
         this.TradTerm.Text = model.TradTerm;
         this.BLReleTerm.Text = model.BLReleTerm;
         this.traySort.Text = model.traySort;
         this.area.Text = model.area;
         this.receiveAddress.Text = model.receiveAddress;
         this.factAddress.Text = model.factAddress;
         this.requestBill.Text = model.requestBill;
     }
     finally
     {
         custBB.Dispose();
     }
 }
예제 #4
0
    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDel_Click(object sender, EventArgs e)
    {
        bool retChecked = false;
        LCustBB custBB = new LCustBB();
        try
        {
            //获取选中的数据Id
            foreach (GridViewRow gvrow in this.grid.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
                if (chkId.Checked == true)
                {
                    retChecked = true;
                    int id = int.Parse(chkId.ValidationGroup);
                    custBB.DeleteRecord(id);
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            custBB.Dispose();
        }

        if (retChecked)
        {
            this.BindGrid();
        }
    }
    /// <summary>
    /// 显示备货单信息
    /// </summary>
    private void ShowInfo()
    {
        CStockUpBillBB stockUpBillBB = new CStockUpBillBB();
        LCustBB custBB = new LCustBB();
        CSaleDetailBB saleDetailBB = new CSaleDetailBB();

        try
        {
            string strCustNo = Request.QueryString["custNo"];
            string strSaleBillNos = Request.QueryString["saleBillNos"];//销售订单号
            string strAbsEntrys = Request.QueryString["absEntrys"];//提货单号
            string strFinanceBillNos = Request.QueryString["financeBillNos"];//采购合同号组合
            string strLineNums = Request.QueryString["lineNums"];//行号组合
            string strWhere = "1=1";
            DataSet ds = new DataSet();

            if (Request.Params["id"] != null && Request.Params["id"] != "")
            {
                this.IdValue = Convert.ToInt32(Request.Params["id"]);
                vCStockUpBillData stockUpBillModel = stockUpBillBB.GetVModel(this.IdValue);

                this.StockBillNo = stockUpBillModel.stockUpBillNo;
                this.stockUpBillNo.Text = stockUpBillModel.stockUpBillNo;
                this.shippingMarkNo.Text = stockUpBillModel.shippingMarkNo;
                this.lblCustNm.Text = stockUpBillModel.custNm;
                this.invoiceNo.Text = stockUpBillModel.invoiceNo;
                this.txtstockEmpNm.Text = stockUpBillModel.stockUpEmpNm;
                this.empId.Value = stockUpBillModel.stockUpEmpId.ToString();

                strSaleBillNos = "'" + stockUpBillModel.saleBillNos.Replace(",", "','") + "'";//销售订单编号组合
                strAbsEntrys = "'" + stockUpBillModel.absEntrys.Replace(",", "','") + "'";//提货单编号组合
                strLineNums = "'" + stockUpBillModel.lineNums.Replace(",", "','") + "'";//行号组合

                if (stockUpBillModel.financeBillNos != "")//采购合同号组合
                {
                    strFinanceBillNos = "'" + stockUpBillModel.financeBillNos.Replace(",", "','") + "'";
                }

                this.mark.Text = stockUpBillModel.mark;
                this.outStockDt.Text = Convert.ToDateTime(stockUpBillModel.outStockDt).ToString("yyyy-MM-dd");
            }
            else
            {
                if (strCustNo == null || strCustNo == "")
                {
                    return;
                }

                DataSet dsCust = custBB.GetList(" custNo ='" + strCustNo.Trim() + "'");

                if (dsCust != null && dsCust.Tables[0] != null && dsCust.Tables[0].Rows.Count > 0)
                {
                    this.stockUpBillNo.Text = stockUpBillBB.GetCurrentInBillNoByStockUpBillNo();
                    this.StockBillNo = this.stockUpBillNo.Text;
                    this.CustomNo = strCustNo;
                    this.shippingMarkNo.Text = dsCust.Tables[0].Rows[0]["shippingMark"].ToString();
                    this.lblCustNm.Text = dsCust.Tables[0].Rows[0]["custNm"].ToString();
                }
            }

            //绑定销售订单明细列表
            string[] saleBillNoArray = strSaleBillNos.Split(',');
            string[] absEntryArray = strAbsEntrys.Split(',');
            string[] lineNumArray = strLineNums.Split(',');

            strWhere += " and (";

            for (int i = 0; i < saleBillNoArray.Length; i++)
            {
                if (i == 0)
                {
                    strWhere += " (absEntry=" + absEntryArray[i] + " and saleBillNo=" + saleBillNoArray[i]
                        + " and lineNum=" + lineNumArray[i] + ")";
                }
                else
                {
                    strWhere += " or (absEntry=" + absEntryArray[i] + " and saleBillNo=" + saleBillNoArray[i]
                        + " and lineNum=" + lineNumArray[i] + ")";
                }
            }

            strWhere += ")";

            ds = saleDetailBB.GetVList(strWhere);

            //ds = saleDetailBB.GetVList(" saleBillNo in (" + strSaleBillNos
            //    + ") and absEntry in (" + strAbsEntrys + ") and lineNum in (" + strLineNums + ")");

            this.DtSaleList = ds.Tables[0];
        }
        finally
        {
            stockUpBillBB.Dispose();
            custBB.Dispose();
            saleDetailBB.Dispose();
        }
    }