예제 #1
0
        public string insertDRSIsub(DRSISub drsi)
        {
            string Message = string.Empty;
            int    result  = 0;

            con.Open();
            SqlCommand cmd = new SqlCommand("INSERT INTO [inventory].[dbo].DRSISub ([DRSiformID],[BatchNo],[ModuleNo],[CageNo],[Weight],[UnitOfMeasure]) VALUES (@DRSiformID,@BatchNo,@ModuleNo,@CageNo,@Weight,@UnitOfMeasure)", con);

            cmd.Parameters.AddWithValue("@DRSiformID", drsi.DRSiformID);
            cmd.Parameters.AddWithValue("@BatchNo", drsi.BatchNo);
            cmd.Parameters.AddWithValue("@ModuleNo", drsi.ModuleNo);
            cmd.Parameters.AddWithValue("@CageNo", drsi.CageNo);
            cmd.Parameters.AddWithValue("@Weight", drsi.Weight);
            cmd.Parameters.AddWithValue("@UnitOfMeasure", drsi.UnitOfMeasure);
            //cmd.Parameters.AddWithValue("@TotalCost", drsi.TotalCost);
            result = cmd.ExecuteNonQuery();
            con.Close();
            //string query = "select top 1 ID from [DRSIForm] order by id desc";
            //DataTable dt = new DataTable("Customer");
            //dt.Clear();
            //dt = DataAccess.DBAdapter.GetRecordSet(query);

            //if (dt.Rows.Count > 0)
            //{
            //    Message = dt.Rows[0]["ID"].ToString();
            //}
            return(Message);
        }
예제 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            dtgridList = (DataTable)ViewState["dtgridList"];
            FrameWork.DRSIForm drsi    = new FrameWork.DRSIForm();
            FrameWork.DRSISub  drsisub = new DRSISub();
            busDISRForm        busDISR = new busDISRForm();

            drsi.CustomerFKID  = int.Parse(this.drpCustomer.SelectedValue);
            drsi.ProductFKID   = int.Parse(this.drpProduct.SelectedValue);
            drsi.TotalPcs      = lblPcs.Text;
            drsi.TotalUOM      = lblUOM.Text;
            drsi.TotalWeight   = lblWeight.Text;
            drsi.TotalUnitCost = txtCost.Text;
            drsi.TotalCost     = lblTCost.Text;
            string x = busDISR.insertDRSI(drsi);

            foreach (DataRow dr in dtgridList.Rows)
            {
                drsisub.DRSiformID    = int.Parse(x);
                drsisub.BatchNo       = dr["BatchNo"].ToString();
                drsisub.ModuleNo      = dr["ModuleNo"].ToString();
                drsisub.CageNo        = dr["CageNo"].ToString();
                drsisub.Weight        = dr["Weight"].ToString();
                drsisub.UnitOfMeasure = dr["UnitOfMeasure"].ToString();
                busDISR.insertDRSIsub(drsisub);
            }
        }