Пример #1
0
        private void GetData()
        {
            ClearRecord();

            dbo_FactProductInventoryClass clsdbo_FactProductInventory = new dbo_FactProductInventoryClass();

            clsdbo_FactProductInventory.ProductKey = System.Convert.ToInt32(Session["ProductKey"]);
            clsdbo_FactProductInventory.DateKey    = System.Convert.ToInt32(Session["DateKey"]);
            clsdbo_FactProductInventory            = dbo_FactProductInventoryDataClass.Select_Record(clsdbo_FactProductInventory);

            if ((clsdbo_FactProductInventory != null))
            {
                try {
                    txtProductKey.SelectedValue = System.Convert.ToString(clsdbo_FactProductInventory.ProductKey);
                    txtDateKey.SelectedValue    = System.Convert.ToString(clsdbo_FactProductInventory.DateKey);
                    txtMovementDate.Text        = System.Convert.ToDateTime(clsdbo_FactProductInventory.MovementDate).ToShortDateString();
                    txtUnitCost.Text            = System.Convert.ToString(clsdbo_FactProductInventory.UnitCost);
                    txtUnitsIn.Text             = System.Convert.ToString(clsdbo_FactProductInventory.UnitsIn);
                    txtUnitsOut.Text            = System.Convert.ToString(clsdbo_FactProductInventory.UnitsOut);
                    txtUnitsBalance.Text        = System.Convert.ToString(clsdbo_FactProductInventory.UnitsBalance);
                }
                catch (Exception ex)
                {
                    ec.ShowMessage(ex.Message, " Dbo. Fact Product Inventory ");
                }
            }
        }
Пример #2
0
        private void DeleteRecord()
        {
            dbo_FactProductInventoryClass clsdbo_FactProductInventory = new dbo_FactProductInventoryClass();

            clsdbo_FactProductInventory.ProductKey = System.Convert.ToInt32(Session["ProductKey"]);
            clsdbo_FactProductInventory.DateKey    = System.Convert.ToInt32(Session["DateKey"]);
            SetData(clsdbo_FactProductInventory);
            bool bSucess = false;

            bSucess = dbo_FactProductInventoryDataClass.Delete(clsdbo_FactProductInventory);
            if (bSucess == true)
            {
                pnlForm.Visible   = false;
                pnlSave.Visible   = false;
                pnlGrid.Visible   = true;
                pnlDelete.Visible = false;
                lblMode.InnerText = "";
                Session.Remove("dvdbo_FactProductInventory");
                LoadGriddbo_FactProductInventory();
            }
            else
            {
                ec.ShowMessage(" Delete failed. ", " Dbo. Fact Product Inventory ");
            }
        }
    public static bool Add(dbo_FactProductInventoryClass clsdbo_FactProductInventory)
    {
        SqlConnection connection = AdventureWorksDW2012DataClass.GetConnection();
        string        insertStatement
            = "INSERT "
              + "     [dbo].[FactProductInventory] "
              + "     ( "
              + "     [ProductKey] "
              + "    ,[DateKey] "
              + "    ,[MovementDate] "
              + "    ,[UnitCost] "
              + "    ,[UnitsIn] "
              + "    ,[UnitsOut] "
              + "    ,[UnitsBalance] "
              + "     ) "
              + "VALUES "
              + "     ( "
              + "     @ProductKey "
              + "    ,@DateKey "
              + "    ,@MovementDate "
              + "    ,@UnitCost "
              + "    ,@UnitsIn "
              + "    ,@UnitsOut "
              + "    ,@UnitsBalance "
              + "     ) "
              + "";
        SqlCommand insertCommand = new SqlCommand(insertStatement, connection);

        insertCommand.CommandType = CommandType.Text;
        insertCommand.Parameters.AddWithValue("@ProductKey", clsdbo_FactProductInventory.ProductKey);
        insertCommand.Parameters.AddWithValue("@DateKey", clsdbo_FactProductInventory.DateKey);
        insertCommand.Parameters.AddWithValue("@MovementDate", clsdbo_FactProductInventory.MovementDate);
        insertCommand.Parameters.AddWithValue("@UnitCost", clsdbo_FactProductInventory.UnitCost);
        insertCommand.Parameters.AddWithValue("@UnitsIn", clsdbo_FactProductInventory.UnitsIn);
        insertCommand.Parameters.AddWithValue("@UnitsOut", clsdbo_FactProductInventory.UnitsOut);
        insertCommand.Parameters.AddWithValue("@UnitsBalance", clsdbo_FactProductInventory.UnitsBalance);
        try
        {
            connection.Open();
            int count = insertCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException)
        {
            return(false);
        }
        finally
        {
            connection.Close();
        }
    }
Пример #4
0
        private Boolean VerifyData()
        {
            if (txtProductKey.Text == "")
            {
                ec.ShowMessage(" Product Key is Required. ", " Dbo. Fact Product Inventory ");
                txtProductKey.Focus();
                return(false);
            }
            if (txtDateKey.Text == "")
            {
                ec.ShowMessage(" Date Key is Required. ", " Dbo. Fact Product Inventory ");
                txtDateKey.Focus();
                return(false);
            }

            if (txtUnitCost.Text == "")
            {
                ec.ShowMessage(" Unit Cost is Required. ", " Dbo. Fact Product Inventory ");
                txtUnitCost.Focus();
                return(false);
            }
            if (txtUnitsIn.Text == "")
            {
                ec.ShowMessage(" Units In is Required. ", " Dbo. Fact Product Inventory ");
                txtUnitsIn.Focus();
                return(false);
            }
            if (txtUnitsOut.Text == "")
            {
                ec.ShowMessage(" Units Out is Required. ", " Dbo. Fact Product Inventory ");
                txtUnitsOut.Focus();
                return(false);
            }
            if (txtUnitsBalance.Text == "")
            {
                ec.ShowMessage(" Units Balance is Required. ", " Dbo. Fact Product Inventory ");
                txtUnitsBalance.Focus();
                return(false);
            }
            if (
                txtProductKey.SelectedIndex != -1 &&
                txtDateKey.SelectedIndex != -1
                )
            {
                dbo_FactProductInventoryClass clsdbo_FactProductInventory = new dbo_FactProductInventoryClass();
                clsdbo_FactProductInventory.ProductKey = System.Convert.ToInt32(txtProductKey.SelectedValue);
                clsdbo_FactProductInventory.DateKey    = System.Convert.ToInt32(txtDateKey.SelectedValue);
                clsdbo_FactProductInventory            = dbo_FactProductInventoryDataClass.Select_Record(clsdbo_FactProductInventory);
                if (clsdbo_FactProductInventory != null && (String)Session["Mode"] == "Add")
                {
                    ec.ShowMessage(" Record already exists. ", " Dbo. Fact Product Inventory ");
                    txtProductKey.Focus();
                    return(false);
                }
            }
            return(true);
        }
Пример #5
0
 private void SetData(dbo_FactProductInventoryClass clsdbo_FactProductInventory)
 {
     clsdbo_FactProductInventory.ProductKey   = System.Convert.ToInt32(txtProductKey.SelectedValue);
     clsdbo_FactProductInventory.DateKey      = System.Convert.ToInt32(txtDateKey.SelectedValue);
     clsdbo_FactProductInventory.MovementDate = System.Convert.ToDateTime(txtMovementDate.Text);
     clsdbo_FactProductInventory.UnitCost     = System.Convert.ToDecimal(txtUnitCost.Text);
     clsdbo_FactProductInventory.UnitsIn      = System.Convert.ToInt32(txtUnitsIn.Text);
     clsdbo_FactProductInventory.UnitsOut     = System.Convert.ToInt32(txtUnitsOut.Text);
     clsdbo_FactProductInventory.UnitsBalance = System.Convert.ToInt32(txtUnitsBalance.Text);
 }
    public static dbo_FactProductInventoryClass Select_Record(dbo_FactProductInventoryClass clsdbo_FactProductInventoryPara)
    {
        dbo_FactProductInventoryClass clsdbo_FactProductInventory = new dbo_FactProductInventoryClass();
        SqlConnection connection = AdventureWorksDW2012DataClass.GetConnection();
        string        selectStatement
            = "SELECT "
              + "     [ProductKey] "
              + "    ,[DateKey] "
              + "    ,[MovementDate] "
              + "    ,[UnitCost] "
              + "    ,[UnitsIn] "
              + "    ,[UnitsOut] "
              + "    ,[UnitsBalance] "
              + "FROM "
              + "     [dbo].[FactProductInventory] "
              + "WHERE "
              + "     [ProductKey] = @ProductKey "
              + " AND [DateKey] = @DateKey "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        selectCommand.CommandType = CommandType.Text;
        selectCommand.Parameters.AddWithValue("@ProductKey", clsdbo_FactProductInventoryPara.ProductKey);
        selectCommand.Parameters.AddWithValue("@DateKey", clsdbo_FactProductInventoryPara.DateKey);
        try
        {
            connection.Open();
            SqlDataReader reader
                = selectCommand.ExecuteReader(CommandBehavior.SingleRow);
            if (reader.Read())
            {
                clsdbo_FactProductInventory.ProductKey   = System.Convert.ToInt32(reader["ProductKey"]);
                clsdbo_FactProductInventory.DateKey      = System.Convert.ToInt32(reader["DateKey"]);
                clsdbo_FactProductInventory.MovementDate = System.Convert.ToDateTime(reader["MovementDate"]);
                clsdbo_FactProductInventory.UnitCost     = System.Convert.ToDecimal(reader["UnitCost"]);
                clsdbo_FactProductInventory.UnitsIn      = System.Convert.ToInt32(reader["UnitsIn"]);
                clsdbo_FactProductInventory.UnitsOut     = System.Convert.ToInt32(reader["UnitsOut"]);
                clsdbo_FactProductInventory.UnitsBalance = System.Convert.ToInt32(reader["UnitsBalance"]);
            }
            else
            {
                clsdbo_FactProductInventory = null;
            }
            reader.Close();
        }
        catch (SqlException)
        {
            return(clsdbo_FactProductInventory);
        }
        finally
        {
            connection.Close();
        }
        return(clsdbo_FactProductInventory);
    }
    public static bool Delete(dbo_FactProductInventoryClass clsdbo_FactProductInventory)
    {
        SqlConnection connection = AdventureWorksDW2012DataClass.GetConnection();
        string        deleteStatement
            = "DELETE FROM "
              + "     [dbo].[FactProductInventory] "
              + "WHERE "
              + "     [ProductKey] = @OldProductKey "
              + " AND [DateKey] = @OldDateKey "
              + " AND [MovementDate] = @OldMovementDate "
              + " AND [UnitCost] = @OldUnitCost "
              + " AND [UnitsIn] = @OldUnitsIn "
              + " AND [UnitsOut] = @OldUnitsOut "
              + " AND [UnitsBalance] = @OldUnitsBalance "
              + "";
        SqlCommand deleteCommand = new SqlCommand(deleteStatement, connection);

        deleteCommand.CommandType = CommandType.Text;
        deleteCommand.Parameters.AddWithValue("@OldProductKey", clsdbo_FactProductInventory.ProductKey);
        deleteCommand.Parameters.AddWithValue("@OldDateKey", clsdbo_FactProductInventory.DateKey);
        deleteCommand.Parameters.AddWithValue("@OldMovementDate", clsdbo_FactProductInventory.MovementDate);
        deleteCommand.Parameters.AddWithValue("@OldUnitCost", clsdbo_FactProductInventory.UnitCost);
        deleteCommand.Parameters.AddWithValue("@OldUnitsIn", clsdbo_FactProductInventory.UnitsIn);
        deleteCommand.Parameters.AddWithValue("@OldUnitsOut", clsdbo_FactProductInventory.UnitsOut);
        deleteCommand.Parameters.AddWithValue("@OldUnitsBalance", clsdbo_FactProductInventory.UnitsBalance);
        try
        {
            connection.Open();
            int count = deleteCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException)
        {
            return(false);
        }
        finally
        {
            connection.Close();
        }
    }
        private void Edit()
        {
            try {
                dbo_FactProductInventoryClass clsdbo_FactProductInventory = new dbo_FactProductInventoryClass();
                Label lblProductKey = (Label)grddbo_FactProductInventory.Rows[grddbo_FactProductInventory.EditIndex].FindControl("lblProductKey");
                clsdbo_FactProductInventory.ProductKey = System.Convert.ToInt32(lblProductKey.Text);
                Label lblDateKey = (Label)grddbo_FactProductInventory.Rows[grddbo_FactProductInventory.EditIndex].FindControl("lblDateKey");
                clsdbo_FactProductInventory.DateKey = System.Convert.ToInt32(lblDateKey.Text);
                clsdbo_FactProductInventory         = dbo_FactProductInventoryDataClass.Select_Record(clsdbo_FactProductInventory);

                Session["ProductKey_SelectedValue"] = clsdbo_FactProductInventory.ProductKey;
                Session["DateKey_SelectedValue"]    = clsdbo_FactProductInventory.DateKey;

                LoadGriddbo_FactProductInventory();
            } catch {
            }
        }
        private void UpdateRecord()
        {
            try {
                DropDownList txtProductKey   = (DropDownList)grddbo_FactProductInventory.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtProductKey");
                DropDownList txtDateKey      = (DropDownList)grddbo_FactProductInventory.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtDateKey");
                TextBox      txtMovementDate = (TextBox)grddbo_FactProductInventory.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtMovementDate");
                TextBox      txtUnitCost     = (TextBox)grddbo_FactProductInventory.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtUnitCost");
                TextBox      txtUnitsIn      = (TextBox)grddbo_FactProductInventory.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtUnitsIn");
                TextBox      txtUnitsOut     = (TextBox)grddbo_FactProductInventory.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtUnitsOut");
                TextBox      txtUnitsBalance = (TextBox)grddbo_FactProductInventory.Rows[Convert.ToInt32(Session["Row"])].FindControl("txtUnitsBalance");

                dbo_FactProductInventoryClass oclsdbo_FactProductInventory = new dbo_FactProductInventoryClass();
                dbo_FactProductInventoryClass clsdbo_FactProductInventory  = new dbo_FactProductInventoryClass();
                oclsdbo_FactProductInventory.ProductKey = System.Convert.ToInt32(txtProductKey.Text);
                oclsdbo_FactProductInventory.DateKey    = System.Convert.ToInt32(txtDateKey.Text);
                oclsdbo_FactProductInventory            = dbo_FactProductInventoryDataClass.Select_Record(oclsdbo_FactProductInventory);

                if (VerifyData() == true)
                {
                    clsdbo_FactProductInventory.ProductKey   = System.Convert.ToInt32(txtProductKey.SelectedValue);
                    clsdbo_FactProductInventory.DateKey      = System.Convert.ToInt32(txtDateKey.SelectedValue);
                    clsdbo_FactProductInventory.MovementDate = System.Convert.ToDateTime(txtMovementDate.Text);
                    clsdbo_FactProductInventory.UnitCost     = System.Convert.ToDecimal(txtUnitCost.Text);
                    clsdbo_FactProductInventory.UnitsIn      = System.Convert.ToInt32(txtUnitsIn.Text);
                    clsdbo_FactProductInventory.UnitsOut     = System.Convert.ToInt32(txtUnitsOut.Text);
                    clsdbo_FactProductInventory.UnitsBalance = System.Convert.ToInt32(txtUnitsBalance.Text);
                    bool bSucess = false;
                    bSucess = dbo_FactProductInventoryDataClass.Update(oclsdbo_FactProductInventory, clsdbo_FactProductInventory);
                    if (bSucess == true)
                    {
                        Session.Remove("dvdbo_FactProductInventory");
                        grddbo_FactProductInventory.EditIndex = -1;
                        LoadGriddbo_FactProductInventory();
                    }
                    else
                    {
                        ec.ShowMessage(" Update failed. ", " Dbo. Fact Product Inventory ");
                    }
                }
            } catch {
            }
        }
        private void DeleteRecord()
        {
            dbo_FactProductInventoryClass clsdbo_FactProductInventory = new dbo_FactProductInventoryClass();
            Label lblProductKey = (Label)grddbo_FactProductInventory.Rows[Convert.ToInt32(Session["Row"])].FindControl("lblProductKey");

            clsdbo_FactProductInventory.ProductKey = System.Convert.ToInt32(lblProductKey.Text);
            Label lblDateKey = (Label)grddbo_FactProductInventory.Rows[Convert.ToInt32(Session["Row"])].FindControl("lblDateKey");

            clsdbo_FactProductInventory.DateKey = System.Convert.ToInt32(lblDateKey.Text);
            clsdbo_FactProductInventory         = dbo_FactProductInventoryDataClass.Select_Record(clsdbo_FactProductInventory);
            bool bSucess = false;

            bSucess = dbo_FactProductInventoryDataClass.Delete(clsdbo_FactProductInventory);
            if (bSucess == true)
            {
                Session.Remove("dvdbo_FactProductInventory");
                LoadGriddbo_FactProductInventory();
            }
            else
            {
                ec.ShowMessage(" Delete failed. ", " Dbo. Fact Product Inventory ");
            }
        }
Пример #11
0
        private void InsertRecord()
        {
            dbo_FactProductInventoryClass clsdbo_FactProductInventory = new dbo_FactProductInventoryClass();

            if (VerifyData() == true)
            {
                SetData(clsdbo_FactProductInventory);
                bool bSucess = false;
                bSucess = dbo_FactProductInventoryDataClass.Add(clsdbo_FactProductInventory);
                if (bSucess == true)
                {
                    pnlForm.Visible   = false;
                    pnlSave.Visible   = false;
                    pnlGrid.Visible   = true;
                    lblMode.InnerText = "";
                    Session.Remove("dvdbo_FactProductInventory");
                    LoadGriddbo_FactProductInventory();
                }
                else
                {
                    ec.ShowMessage(" Insert failed. ", " Dbo. Fact Product Inventory ");
                }
            }
        }
        private void InsertRecord()
        {
            try {
                DropDownList txtNewProductKey   = (DropDownList)grddbo_FactProductInventory.FooterRow.FindControl("txtNewProductKey");
                DropDownList txtNewDateKey      = (DropDownList)grddbo_FactProductInventory.FooterRow.FindControl("txtNewDateKey");
                TextBox      txtNewMovementDate = (TextBox)grddbo_FactProductInventory.FooterRow.FindControl("txtNewMovementDate");
                TextBox      txtNewUnitCost     = (TextBox)grddbo_FactProductInventory.FooterRow.FindControl("txtNewUnitCost");
                TextBox      txtNewUnitsIn      = (TextBox)grddbo_FactProductInventory.FooterRow.FindControl("txtNewUnitsIn");
                TextBox      txtNewUnitsOut     = (TextBox)grddbo_FactProductInventory.FooterRow.FindControl("txtNewUnitsOut");
                TextBox      txtNewUnitsBalance = (TextBox)grddbo_FactProductInventory.FooterRow.FindControl("txtNewUnitsBalance");

                dbo_FactProductInventoryClass clsdbo_FactProductInventory = new dbo_FactProductInventoryClass();
                if (VerifyDataNew() == true)
                {
                    clsdbo_FactProductInventory.ProductKey   = System.Convert.ToInt32(txtNewProductKey.SelectedValue);
                    clsdbo_FactProductInventory.DateKey      = System.Convert.ToInt32(txtNewDateKey.SelectedValue);
                    clsdbo_FactProductInventory.MovementDate = System.Convert.ToDateTime(txtNewMovementDate.Text);
                    clsdbo_FactProductInventory.UnitCost     = System.Convert.ToDecimal(txtNewUnitCost.Text);
                    clsdbo_FactProductInventory.UnitsIn      = System.Convert.ToInt32(txtNewUnitsIn.Text);
                    clsdbo_FactProductInventory.UnitsOut     = System.Convert.ToInt32(txtNewUnitsOut.Text);
                    clsdbo_FactProductInventory.UnitsBalance = System.Convert.ToInt32(txtNewUnitsBalance.Text);
                    bool bSucess = false;
                    bSucess = dbo_FactProductInventoryDataClass.Add(clsdbo_FactProductInventory);
                    if (bSucess == true)
                    {
                        Session.Remove("dvdbo_FactProductInventory");
                        LoadGriddbo_FactProductInventory();
                    }
                    else
                    {
                        ec.ShowMessage(" Insert failed. ", " Dbo. Fact Product Inventory ");
                    }
                }
            } catch {
            }
        }
    public static bool Update(dbo_FactProductInventoryClass olddbo_FactProductInventoryClass,
                              dbo_FactProductInventoryClass newdbo_FactProductInventoryClass)
    {
        SqlConnection connection = AdventureWorksDW2012DataClass.GetConnection();
        string        updateStatement
            = "UPDATE "
              + "     [dbo].[FactProductInventory] "
              + "SET "
              + "     [ProductKey] = @NewProductKey "
              + "    ,[DateKey] = @NewDateKey "
              + "    ,[MovementDate] = @NewMovementDate "
              + "    ,[UnitCost] = @NewUnitCost "
              + "    ,[UnitsIn] = @NewUnitsIn "
              + "    ,[UnitsOut] = @NewUnitsOut "
              + "    ,[UnitsBalance] = @NewUnitsBalance "
              + "WHERE "
              + "     [ProductKey] = @OldProductKey "
              + " AND [DateKey] = @OldDateKey "
              + " AND [MovementDate] = @OldMovementDate "
              + " AND [UnitCost] = @OldUnitCost "
              + " AND [UnitsIn] = @OldUnitsIn "
              + " AND [UnitsOut] = @OldUnitsOut "
              + " AND [UnitsBalance] = @OldUnitsBalance "
              + "";
        SqlCommand updateCommand = new SqlCommand(updateStatement, connection);

        updateCommand.CommandType = CommandType.Text;
        updateCommand.Parameters.AddWithValue("@NewProductKey", newdbo_FactProductInventoryClass.ProductKey);
        updateCommand.Parameters.AddWithValue("@NewDateKey", newdbo_FactProductInventoryClass.DateKey);
        updateCommand.Parameters.AddWithValue("@NewMovementDate", newdbo_FactProductInventoryClass.MovementDate);
        updateCommand.Parameters.AddWithValue("@NewUnitCost", newdbo_FactProductInventoryClass.UnitCost);
        updateCommand.Parameters.AddWithValue("@NewUnitsIn", newdbo_FactProductInventoryClass.UnitsIn);
        updateCommand.Parameters.AddWithValue("@NewUnitsOut", newdbo_FactProductInventoryClass.UnitsOut);
        updateCommand.Parameters.AddWithValue("@NewUnitsBalance", newdbo_FactProductInventoryClass.UnitsBalance);
        updateCommand.Parameters.AddWithValue("@OldProductKey", olddbo_FactProductInventoryClass.ProductKey);
        updateCommand.Parameters.AddWithValue("@OldDateKey", olddbo_FactProductInventoryClass.DateKey);
        updateCommand.Parameters.AddWithValue("@OldMovementDate", olddbo_FactProductInventoryClass.MovementDate);
        updateCommand.Parameters.AddWithValue("@OldUnitCost", olddbo_FactProductInventoryClass.UnitCost);
        updateCommand.Parameters.AddWithValue("@OldUnitsIn", olddbo_FactProductInventoryClass.UnitsIn);
        updateCommand.Parameters.AddWithValue("@OldUnitsOut", olddbo_FactProductInventoryClass.UnitsOut);
        updateCommand.Parameters.AddWithValue("@OldUnitsBalance", olddbo_FactProductInventoryClass.UnitsBalance);
        try
        {
            connection.Open();
            int count = updateCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException)
        {
            return(false);
        }
        finally
        {
            connection.Close();
        }
    }
        private Boolean VerifyDataNew()
        {
            DropDownList txtNewProductKey   = (DropDownList)grddbo_FactProductInventory.FooterRow.FindControl("txtNewProductKey");
            DropDownList txtNewDateKey      = (DropDownList)grddbo_FactProductInventory.FooterRow.FindControl("txtNewDateKey");
            TextBox      txtNewMovementDate = (TextBox)grddbo_FactProductInventory.FooterRow.FindControl("txtNewMovementDate");
            TextBox      txtNewUnitCost     = (TextBox)grddbo_FactProductInventory.FooterRow.FindControl("txtNewUnitCost");
            TextBox      txtNewUnitsIn      = (TextBox)grddbo_FactProductInventory.FooterRow.FindControl("txtNewUnitsIn");
            TextBox      txtNewUnitsOut     = (TextBox)grddbo_FactProductInventory.FooterRow.FindControl("txtNewUnitsOut");
            TextBox      txtNewUnitsBalance = (TextBox)grddbo_FactProductInventory.FooterRow.FindControl("txtNewUnitsBalance");

            if (txtNewProductKey.Text == "")
            {
                ec.ShowMessage(" Product Key is Required. ", " Dbo. Fact Product Inventory ");
                txtNewProductKey.Focus();
                return(false);
            }
            if (txtNewDateKey.Text == "")
            {
                ec.ShowMessage(" Date Key is Required. ", " Dbo. Fact Product Inventory ");
                txtNewDateKey.Focus();
                return(false);
            }

            if (txtNewUnitCost.Text == "")
            {
                ec.ShowMessage(" Unit Cost is Required. ", " Dbo. Fact Product Inventory ");
                txtNewUnitCost.Focus();
                return(false);
            }
            if (txtNewUnitsIn.Text == "")
            {
                ec.ShowMessage(" Units In is Required. ", " Dbo. Fact Product Inventory ");
                txtNewUnitsIn.Focus();
                return(false);
            }
            if (txtNewUnitsOut.Text == "")
            {
                ec.ShowMessage(" Units Out is Required. ", " Dbo. Fact Product Inventory ");
                txtNewUnitsOut.Focus();
                return(false);
            }
            if (txtNewUnitsBalance.Text == "")
            {
                ec.ShowMessage(" Units Balance is Required. ", " Dbo. Fact Product Inventory ");
                txtNewUnitsBalance.Focus();
                return(false);
            }
            if (
                txtNewProductKey.SelectedIndex != -1 &&
                txtNewDateKey.SelectedIndex != -1
                )
            {
                dbo_FactProductInventoryClass clsdbo_FactProductInventory = new dbo_FactProductInventoryClass();
                clsdbo_FactProductInventory.ProductKey = System.Convert.ToInt32(txtNewProductKey.SelectedValue);
                clsdbo_FactProductInventory.DateKey    = System.Convert.ToInt32(txtNewDateKey.SelectedValue);
                clsdbo_FactProductInventory            = dbo_FactProductInventoryDataClass.Select_Record(clsdbo_FactProductInventory);
                if (clsdbo_FactProductInventory != null)
                {
                    ec.ShowMessage(" Record already exists. ", " Dbo. Fact Product Inventory ");
                    txtNewProductKey.Focus();
                    return(false);
                }
            }
            return(true);
        }