예제 #1
0
 /// <summary>
 /// 数据绑定
 /// </summary>
 protected virtual void BindData()
 {
     if (strQuerySQL.Length == 0)
     {
         return;
     }
     BaseClass.frmFlag myFlag = new BaseClass.frmFlag();
     myFlag.Show();
     myFlag.Update();
     try
     {
         DataLib.DataHelper myHelper = new DataLib.DataHelper();
         DataSet            ds       = myHelper.GetOtherDs(strQuerySQL, GetParm());
         if (ds == null)
         {
             return;
         }
         int intRow = gvBase.FocusedRowHandle;
         gcBase.DataSource = ds.Tables[0].DefaultView;
         DataLib.SysVar.TestColumnRight(gvBase, this.Name);
         if (intRow <= gvBase.RowCount)
         {
             gvBase.FocusedRowHandle = intRow;
         }
     }
     finally
     {
         myFlag.Dispose();
     }
 }
예제 #2
0
        /// <summary>
        /// 数据绑定
        /// </summary>
        protected virtual int BindData()
        {
            if (strQuerySQL.Length == 0)
            {
                return(-1);
            }

            BaseClass.frmFlag myFlag = new BaseClass.frmFlag();
            myFlag.Show();
            myFlag.Update();

            try
            {
                try
                {
                    DataLib.DataHelper myHelper = new DataLib.DataHelper();
                    DataSet            ds;

                    if (ucDate.Visible == true)
                    {
                        ds = myHelper.GetOtherDs(strQuerySQL, GetParm());
                    }
                    else
                    {
                        ds = myHelper.GetDs(strQuerySQL);
                    }
                    //if (rgOption.Visible == false)
                    //{
                    //    ds = myHelper.GetOtherDs(strQuerySQL, GetParm());
                    //}
                    //else
                    //{
                    //    ds = myHelper.GetOtherDs(strQuerySQL, GetParm1());
                    //}

                    if (ds == null)
                    {
                        return(-1);
                    }
                    //gvReport.Columns.Clear();
                    gcList.DataSource = ds.Tables[0].DefaultView;
                    //AssignField();
                    DataLib.sysClass.LoadFormatFromDB(gvList, ReportTag, 0);
                    DataLib.SysVar.TestColumnRight(gvList, this.Name);
                    return(0);
                }
                catch (Exception E)
                {
                    MessageBox.Show(E.Message, "错误");
                    return(-1);
                }
            }
            finally
            {
                myFlag.Dispose();
            }
        }
예제 #3
0
        protected virtual void ImportExcel()
        {
            System.Data.DataTable dt = DataLib.sysClass.ImportExcel("Sheet1");
            if (dt == null)
            {
                return;
            }

            if (MessageBox.Show(this, "引入Excel资料需要一定时间,进行本操作吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            BaseClass.frmFlag myFlag = new BaseClass.frmFlag();
            myFlag.label1.Text = "正在引入数据,请稍待......";
            myFlag.Show();
            myFlag.Update();
            try
            {
                switch (intImport)
                {
                case 1:
                    ImportSupplier(dt);
                    break;

                case 2:
                    ImportClient(dt);
                    break;

                case 3:
                    ImportEmp(dt);
                    break;

                case 4:
                    ImportItem(dt);
                    break;

                case 5:
                    ImportProduct(dt);
                    break;

                case 6:
                    ImportOutSupplier(dt);
                    break;

                case 7:
                    //ImportBom(values);
                    //ImportBomDetail(values1);
                    break;
                }
            }
            finally
            {
                myFlag.Dispose();
            }
        }
예제 #4
0
        /// <summary>
        /// 数据绑定
        /// </summary>
        protected virtual int BindData()
        {
            if (strQuerySQL.Length == 0)
            {
                return(-1);
            }
            BaseClass.frmFlag myFlag = new BaseClass.frmFlag();
            myFlag.Show();
            myFlag.Update();
            try
            {
                try
                {
                    DataLib.DataHelper myHelper = new DataLib.DataHelper();
                    DataSet            ds;
                    if (cbCutOff.Visible == false)
                    {
                        ds = myHelper.GetOtherDs(strQuerySQL, GetParm3());
                    }
                    else
                    {
                        ds = myHelper.GetOtherDs(strQuerySQL, GetParm5());
                    }

                    if (ds == null)
                    {
                        return(-1);
                    }

                    int intRow = gvList.FocusedRowHandle;
                    gcList.DataSource = ds.Tables[0].DefaultView;
                    if (intRow <= gvList.RowCount)
                    {
                        gvList.FocusedRowHandle = intRow;
                    }
                    //AssignField();
                    DataLib.sysClass.LoadFormatFromDB(gvList, BillTag, cbType.SelectedIndex);

                    DataLib.SysVar.TestColumnRight(gvList, this.Name);
                    return(0);
                }
                catch (Exception E)
                {
                    MessageBox.Show(E.Message, "错误");
                    return(-1);
                }
            }
            finally
            {
                myFlag.Dispose();
            }
        }
예제 #5
0
        protected override int BindData()
        {
            if (edSubject.GetValue() == null)
            {
                return(-1);
            }
            if (strQuerySQL.Length == 0)
            {
                return(-1);
            }

            BaseClass.frmFlag myFlag = new BaseClass.frmFlag();
            myFlag.Show();
            myFlag.Update();

            try
            {
                try
                {
                    DataLib.DataHelper myHelper = new DataLib.DataHelper();
                    DataSet            ds;

                    ds = myHelper.GetOtherDs(strQuerySQL, GetParm());


                    if (ds == null)
                    {
                        return(-1);
                    }
                    gvReport.Columns.Clear();
                    gcReport.DataSource = ds.Tables[0].DefaultView;

                    gvReport.Columns["F_Date"].Caption  = "ÈÕÆÚ";
                    gvReport.Columns["F_Key"].Caption   = "ƾ֤×Ö";
                    gvReport.Columns["F_Tag"].Caption   = "ÕªÒª";
                    gvReport.Columns["F_Money"].Caption = "ºÏ¼Æ";
                    //gvReport.Columns["F_Rest"].Caption = "Óà¶î";
                    //AssignField();
                    return(0);
                }
                catch (Exception E)
                {
                    MessageBox.Show(E.Message, "´íÎó");
                    return(-1);
                }
            }
            finally
            {
                myFlag.Dispose();
            }
        }
예제 #6
0
 private void frmProductArrange_Shown(object sender, EventArgs e)
 {
     BaseClass.frmFlag myFlag = new BaseClass.frmFlag();
     myFlag.Show();
     myFlag.Update();
     try
     {
         DataBind();
         SetColumn();
         ShowHeader();
         FillDept();
     }
     finally
     {
         myFlag.Dispose();
     }
 }
예제 #7
0
파일: frmCheck.cs 프로젝트: 15831944/erp-1
        /// <summary>
        /// 从Excel导入数据
        /// </summary>
        protected void ImportExcel()
        {
            System.Data.DataTable dt = DataLib.sysClass.ImportExcel("Sheet1");
            if (dt == null)
            {
                return;
            }

            if (MessageBox.Show(this, "引入Excel资料需要一定时间,进行本操作吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            System.Data.DataTable dtSlaver = ((System.Data.DataView)binSlaver.DataSource).Table;

            if (MessageBox.Show(this, "是否清除盘点单现有数据?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                foreach (DataRow dr in dtSlaver.Rows)
                {
                    dr.Delete();
                }
            }

            BaseClass.frmFlag myFlag = new BaseClass.frmFlag();
            myFlag.label1.Text = "正在引入数据,请稍待......";
            myFlag.Show();
            myFlag.Update();
            try
            {
                string strID, strColor, strBatchNo, strUnit;

                decimal dQty = 0;

                try
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        strID      = dr["物料编码"] == DBNull.Value ? "" : dr["物料编码"].ToString();
                        strColor   = dr["颜色"] == DBNull.Value ? "" : dr["颜色"].ToString();
                        strBatchNo = dr["批号"] == DBNull.Value ? "" : dr["批号"].ToString();
                        strUnit    = dr["单位"] == DBNull.Value ? "" : dr["单位"].ToString();
                        dQty       = dr["实盘数"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["实盘数"]);

                        if (strID.Length == 0)
                        {
                            continue;
                        }
                        DataRow drItem = FindItemRow(strID, lupControl1.GetValue().ToString(), strColor, strBatchNo, strUnit);
                        if (drItem == null)
                        {
                            continue;
                        }
                        DataRow drNew = dtSlaver.NewRow();
                        drNew["F_ItemID"]      = strID;
                        drNew["F_ItemName"]    = dr["物料名称"];
                        drNew["F_Type"]        = dr["物料类别"];
                        drNew["F_Spec"]        = dr["规格"];
                        drNew["F_BatchNo"]     = strBatchNo;
                        drNew["F_Color"]       = strColor;
                        drNew["F_Unit"]        = strUnit;
                        drNew["F_CheckQty"]    = dr["实盘数"];
                        drNew["F_ComputerQty"] = drItem["F_Qty"];
                        drNew["F_Qty"]         = dQty - Convert.ToDecimal(drItem["F_Qty"]);
                        drNew["F_Price"]       = dr["成本价"];
                        drNew["F_Remark"]      = dr["备注"];

                        dtSlaver.Rows.Add(drNew);
                    }
                }
                catch (Exception E)
                {
                    MessageBox.Show(this, E.Message, "错误");
                }
            }

            finally
            {
                myFlag.Dispose();
            }
        }