Esempio n. 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strBatch     = BatchIDDropDownList.SelectedValue;
            string strWarehouse = WarehouseIDDropDownList.SelectedValue;
            string strLocation  = LocationIDDropDownList.SelectedValue;

            SqlData.SelectCommand = "SELECT SUM(StockPile.Quantity) AS Quantity FROM StockPile INNER JOIN FinishedProduct ON FinishedProduct.Batch_ID = StockPile.Batch_ID AND StockPile.Batch_ID ='" + strBatch + "' AND StockPile.Warehouse_ID ='" + strWarehouse + "' AND StockPile.Location_ID ='" + strLocation + "' INNER JOIN Product ON FinishedProduct.Product_ID = Product.Product_ID INNER JOIN Location ON StockPile.Location_ID = Location.Location_ID";
            DataSourceSelectArguments dsArguments = new DataSourceSelectArguments();
            DataView dvView = new DataView();
            int      count  = dvView.Count;

            dvView = (DataView)SqlData.Select(dsArguments);
            string strQty = dvView[0].Row["Quantity"].ToString();

            SqlStockPile.InsertParameters["Batch_ID"].DefaultValue         = BatchIDDropDownList.SelectedValue;
            SqlStockPile.InsertParameters["Warehouse_ID"].DefaultValue     = WarehouseIDDropDownList.SelectedValue;
            SqlStockPile.InsertParameters["Location_ID"].DefaultValue      = LocationIDDropDownList.SelectedValue;
            SqlStockPile.InsertParameters["Quantity"].DefaultValue         = Convert.ToString(-Convert.ToInt32(QuantityTextBox1.Text));
            SqlStockPile.InsertParameters["Created_Date"].DefaultValue     = System.DateTime.Today.ToShortDateString();
            SqlStockPile.InsertParameters["Is_Product"].DefaultValue       = "True";
            SqlStockPile.InsertParameters["Quotation_Number"].DefaultValue = (string)Session["Quotation_number"];
            SqlStockPile.Insert();


            SqlData.SelectCommand = "SELECT Quotes_ID FROM Quotes where Quotes.product_id ='" + dropProductId.SelectedValue + "' and Quotes.Quotation_Number ='" + (string)Session["Quotation_number"] + "'";
            dsArguments           = new DataSourceSelectArguments();
            dvView = new DataView();
            count  = dvView.Count;
            dvView = (DataView)SqlData.Select(dsArguments);
            string strQuotesid = dvView[0].Row["Quotes_ID"].ToString();


            if (Convert.ToInt32(QuantityTextBox1.Text) <= Convert.ToInt32(strQty))
            {
                SqlContainsIsInventoryUpdated.UpdateParameters["Is_InventoryUpd"].DefaultValue  = "True";
                SqlContainsIsInventoryUpdated.UpdateParameters["Shipped_Quantity"].DefaultValue = QuantityTextBox1.Text;
                SqlContainsIsInventoryUpdated.UpdateParameters["Quotes_ID"].DefaultValue        = strQuotesid;
                SqlContainsIsInventoryUpdated.Update();
            }
            else
            {
                SqlContainsUpdate.UpdateParameters["Shipped_Quantity"].DefaultValue      = QuantityTextBox1.Text;
                SqlContainsIsInventoryUpdated.UpdateParameters["Quotes_ID"].DefaultValue = strQuotesid;
                SqlContainsUpdate.Update();
            }

            GridViewQuotation.DataBind();
            QuantityTextBox1.Text                 = string.Empty;
            QuantityTextBox.Text                  = string.Empty;
            BatchIDDropDownList.SelectedIndex     = -1;
            WarehouseIDDropDownList.SelectedIndex = -1;
            LocationIDDropDownList.SelectedIndex  = -1;
        }
Esempio n. 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     SqlQotes.InsertParameters["QOquantity"].DefaultValue       = Quantity.Text;
     SqlQotes.InsertParameters["Product_Id"].DefaultValue       = dropProductId.SelectedValue;
     SqlQotes.InsertParameters["Quotation_Number"].DefaultValue = (string)Session["Quotation_number"];
     SqlQotes.InsertParameters["SOquantity"].DefaultValue       = Quantity.Text;
     SqlQotes.Insert();
     GridViewQuotation.DataBind();
     panelAddQuotation.Visible  = false;
     panelSaveQuotation.Visible = true;
     Quantity.Text = string.Empty;
     dropProductId.SelectedIndex = -1;
 }
Esempio n. 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            SqlDataSourceQuotation.InsertParameters["Customer_Id"].DefaultValue    = dropCustomerId.SelectedValue;
            SqlDataSourceQuotation.InsertParameters["Quotation_Date"].DefaultValue = txtQuotation.Text.Trim();

            SqlDataSourceQuotation.Insert();
            GridViewQuotation.DataBind();
            panelAddQuotation.Visible    = false;
            panelSaveQuotation.Visible   = true;
            txtQuotation.Text            = string.Empty;
            txtQuotation.Text            = string.Empty;
            dropCustomerId.SelectedIndex = 0;
        }