private void GetAllStorageInstIds()
 {
     try
     {
         clsStorageInst objStor     = new clsStorageInst();
         DataSet        dsSStorData = objStor.GetAllStorageInstsData();
         if (dsSStorData.Tables[0].Rows.Count != 0)
         {
             ddlStorageInst.DataSource     = dsSStorData.Tables[0];
             ddlStorageInst.DataTextField  = "StorageInstName";
             ddlStorageInst.DataValueField = "StorageInstId";
             ddlStorageInst.DataBind();
             ddlStorageInst.Items.Insert(0, "--Select One--");
         }
         else
         {
             ddlStorageInst.Items.Insert(0, "--Select One--");
             ddlStorageInst.Items.Insert(1, "No Products");
         }
     }
     catch (Exception ex)
     {
         lblMsg.Text = ex.Message;
     }
 }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            ObjStorageInst = new clsStorageInst();
            ObjStorageInst.strStorageInstName = Convert.ToString(txtName.Text);

            ObjStorageInst.strDesc = Convert.ToString(txtDesc.Text);
            int i = ObjStorageInst.InsertStorageInstMasterData();
            if (i == 1)
            {
                lblMsg.Text = "Record inserted";

                txtDesc.Text = "";
                txtName.Text = "";
            }
            else
            {
                lblMsg.Text = "Record not inserted";
            }
        }
        catch (Exception ex)
        {
            lblMsg.Text = ex.Message;
        }
    }
 protected void btnShowAll_Click(object sender, EventArgs e)
 {
     try
     {
         if (btnShowAll.Text == "Show All")
         {
             ObjStorageInst = new clsStorageInst();
             DataSet ds = ObjStorageInst.GetAllStorageInstsData();
             if (ds.Tables[0].Rows.Count != 0)
             {
                 grdStorageInst.DataSource = ds.Tables[0];
                 grdStorageInst.DataBind();
             }
             else
             {
                 grdStorageInst.EmptyDataText = "No Records Found to display.";
                 grdStorageInst.DataBind();
             }
             divStorageInst.Visible = true;
             btnShowAll.Text        = "Close";
         }
         else if (btnShowAll.Text == "Close")
         {
             divStorageInst.Visible = false;
             btnShowAll.Text        = "Show All";
         }
     }
     catch (Exception ex)
     {
         lblMsg.Text = ex.Message;
     }
 }
Exemplo n.º 4
0
 private void GetStorageInstrId()
 {
     try
     {
         ddlStorageinstId.Items.Clear();
         clsStorageInst objStorageInst = new clsStorageInst();
         DataSet        ds             = objStorageInst.GetAllStorageInstsData();
         if (ds.Tables[0].Rows.Count != 0)
         {
             ddlStorageinstId.DataSource     = ds.Tables[0];
             ddlStorageinstId.DataTextField  = "StorageInstName";
             ddlStorageinstId.DataValueField = "StorageInstId";
             ddlStorageinstId.DataBind();
         }
         ddlStorageinstId.Items.Insert(0, "--Select One--");
     }
     catch (Exception ex)
     {
         lblMsg.Text = ex.Message;
     }
 }