Exemplo n.º 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;
        }
Exemplo n.º 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     dtgridList = (DataTable)ViewState["dtgridList"];
     string users = Session["id"].ToString();
     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;
     drsi.OrderBy = users;
     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);
     }
 }
Exemplo n.º 3
0
        public FrameWork.DRSISub[] allDrSIFormSub(string ID)
        {
            string query = "SELECT [ID] ,[DRSiformID],[BatchNo],[ModuleNo],[CageNo],[Weight],[UnitOfMeasure]  FROM [inventory].[dbo].[DRSISub] where DRSiformID='"+ ID +"'";
            DataTable table = new DataTable();

            table = DataAccess.DBAdapter.GetRecordSet(query);
            FrameWork.DRSISub[] dec = new FrameWork.DRSISub[table.Rows.Count];

            for (int i = 0; i < table.Rows.Count; i++)
            {
                dec[i] = new FrameWork.DRSISub(table.Rows[i]);
            }

            return dec;
        }