Ejemplo n.º 1
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (cbx_itemname.SelectedItem != null && cbx_itemcode.SelectedItem != null && txt_quantity.Text != "" &&
         quantityEntered != 0 && cbx_units.SelectedItem != null)
     {
         GridIndent gridIndent = new GridIndent();
         gridIndent.SlNo     = gridIndents.Count + 1;
         gridIndent.ItemCode = cbx_itemcode.SelectedItem.ToString();
         gridIndent.ItemName = cbx_itemname.SelectedItem.ToString();
         gridIndent.Quantity = quantityEntered;
         gridIndent.Technical_Specifications = txt_technical_description.Text.Trim();
         gridIndent.Units   = cbx_units.SelectedItem.ToString();
         gridIndent.Remarks = Txt_remarks.Text.Trim();
         gridIndents.Add(gridIndent);
         grid_indentdata.ItemsSource = null;
         grid_indentdata.ItemsSource = gridIndents;
     }
     else if (cbx_itemname.SelectedItem == null)
     {
         MessageBox.Show("Please Select ItemName");
     }
     else if (cbx_itemcode.SelectedItem == null)
     {
         MessageBox.Show("Please Select ItemCode");
     }
     else if (txt_quantity.Text == "")
     {
         MessageBox.Show("Please Enter Quantity");
     }
     else if (quantityEntered == 0)
     {
         MessageBox.Show("Please Enter Valid Quantity");
     }
     else if (cbx_units.SelectedItem == null)
     {
         MessageBox.Show("Please Select Units");
     }
 }
Ejemplo n.º 2
0
        private SaveIndent GetIndent(long Id)
        {
            SaveIndent saveIndent = new SaveIndent();
            long       ApprovalId = Convert.ToInt64(HttpContext.Session.GetString(SessionUserID));

            try
            {
                List <GridIndent> gridIndents = new List <GridIndent>();

                using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["SqlConnection"].ToString()))
                {
                    connection.Open();
                    SqlCommand testCMD = new SqlCommand("GetIndent", connection);
                    testCMD.CommandType = CommandType.StoredProcedure;
                    testCMD.Parameters.Add(new SqlParameter("@IndentID", System.Data.SqlDbType.BigInt, 50)
                    {
                        Value = Id
                    });
                    testCMD.Parameters.Add(new SqlParameter("@UserID", System.Data.SqlDbType.VarChar, 300)
                    {
                        Value = ApprovalId
                    });
                    SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(testCMD);

                    DataSet dataSet = new DataSet();
                    sqlDataAdapter.Fill(dataSet);
                    int counter = 0;
                    while (counter < dataSet.Tables[0].Rows.Count)
                    {
                        saveIndent.Date           = Convert.ToDateTime(dataSet.Tables[0].Rows[counter]["Date"]);
                        saveIndent.LocationCode   = Convert.ToInt64(dataSet.Tables[0].Rows[counter]["LocationCode"]);
                        saveIndent.IndentRemarks  = Convert.ToString(dataSet.Tables[0].Rows[counter]["Remarks"]);
                        saveIndent.ApproverName   = Convert.ToString(dataSet.Tables[0].Rows[counter]["Approver"]);
                        saveIndent.ApprovalID     = Convert.ToInt64(dataSet.Tables[0].Rows[counter]["Approver ID"]);
                        saveIndent.ApprovalStatus = Convert.ToString(dataSet.Tables[0].Rows[counter]["ApprovalStatus"]);

                        GridIndent gridIndent = new GridIndent();
                        gridIndent.SlNo                     = counter + 1;
                        gridIndent.ItemCategoryName         = Convert.ToString(dataSet.Tables[0].Rows[counter]["ItemCategoryName"]);
                        gridIndent.ItemName                 = Convert.ToString(dataSet.Tables[0].Rows[counter]["ItemName"]);
                        gridIndent.ItemCode                 = Convert.ToString(dataSet.Tables[0].Rows[counter]["ItemCode"]);
                        gridIndent.Units                    = Convert.ToString(dataSet.Tables[0].Rows[counter]["Unit"]);
                        gridIndent.Description              = Convert.ToString(dataSet.Tables[0].Rows[counter]["Description"]);
                        gridIndent.Technical_Specifications = Convert.ToString(dataSet.Tables[0].Rows[counter]["TechnicalSpecification"]);
                        gridIndent.Quantity                 = Convert.ToInt32(dataSet.Tables[0].Rows[counter]["Quantity"]);
                        gridIndent.Remarks                  = Convert.ToString(dataSet.Tables[0].Rows[counter]["Item Remarks"]);
                        gridIndents.Add(gridIndent);

                        saveIndent.Email = Convert.ToString(dataSet.Tables[0].Rows[counter]["Email"]);
                        counter++;
                    }
                    dataSet.Dispose();
                }
                saveIndent.GridIndents = gridIndents;
                return(saveIndent);
            }
            catch (Exception ex)
            {
                ////log.Error("Error while fetching Indent information: " + ex.StackTrace);
                return(saveIndent);
            }
        }