예제 #1
0
        private void updateStock()
        {
            Dispatch dispatch = new Dispatch();

            dispatch.DispatchDate = (Convert.ToDateTime(txtOrderDate.Text)).ToString("dd-MM-yyyy");
            dispatch.RouteID      = Convert.ToInt32(dpagentRoute.SelectedItem.Value);
            DispatchData dispatchData = new DispatchData();
            DataSet      DsStock      = new DataSet();

            DsStock = dispatchData.GetStockFromDispatch(dispatch);

            if (!Comman.Comman.IsDataSetEmpty(DsStock))
            {
                string constr = ConfigurationManager.ConnectionStrings["projectConnection"].ConnectionString;
                using (SqlConnection con = new SqlConnection(constr))
                {
                    using (SqlCommand cmd = new SqlCommand("sp_StockUpdateReturn"))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Connection  = con;
                        cmd.Parameters.AddWithValue("@tblStock", DsStock.Tables[0]);
                        con.Open();
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }
            }
        }
예제 #2
0
        private void updateStock()
        {
            Dispatch dispatch = new Dispatch();

            //dispatch.DispatchDate = (Convert.ToDateTime(txtOrderDate.Text)).ToString("dd-MM-yyyy");
            dispatch.DispatchId = Convert.ToInt32(txtDispatchId.Text);
            DispatchData dispatchData = new DispatchData();
            DataSet      DsStock      = new DataSet();

            DsStock = dispatchData.GetStockFromDispatch(dispatch);



            if (!Comman.Comman.IsDataSetEmpty(DsStock))
            {
                DsStock.Tables[0].Columns.Add("UserID", typeof(int));

                for (int i = 0; i <= DsStock.Tables[0].Rows.Count - 1; i++)
                {
                    DsStock.Tables[0].Rows[i]["UserID"] = GlobalInfo.Userid;
                }
                DsStock.Tables[0].Columns.Add("ShiftDate", typeof(string));

                for (int i = 0; i <= DsStock.Tables[0].Rows.Count - 1; i++)
                {
                    DsStock.Tables[0].Rows[i]["ShiftDate"] = Convert.ToString(DateTime.Now.ToString("yyyy-MM-dd"));
                }

                string constr = ConfigurationManager.ConnectionStrings["projectConnection"].ConnectionString;
                using (SqlConnection con = new SqlConnection(constr))
                {
                    using (SqlCommand cmd = new SqlCommand("sp_StockUpdateReturn"))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Connection  = con;
                        cmd.Parameters.AddWithValue("@tblStock", DsStock.Tables[0]);
                        con.Open();
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }
            }
        }