//This is to save the GRN cheque details together //START public void SaveGRNChequeeDetails() { try { int rows = ChequeGRN.GRNChequeDataGridView.Count; for (int i = 0; rows - 1 > i; i++) { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "GRN.Save_GRN_Bank_Cheque_Details"; string[] StringArrayData = new string[4]; StringArrayData = ((IEnumerable)ChequeGRN.GRNChequeDataGridView[i]).Cast <object>().Select(X => X == null ? null : X.ToString()).ToArray(); comm.Parameters.AddWithValue("@Doc_No", Documentid.ToString()); comm.Parameters.AddWithValue("@Cheque_No", (StringArrayData[0]).ToString()); comm.Parameters.AddWithValue("@Amount", Convert.ToDecimal((StringArrayData[1]).ToString())); comm.Parameters.AddWithValue("@Bank_Ac_Name", ((StringArrayData[2]).ToString())); comm.Parameters.AddWithValue("@Note", ((StringArrayData[3]).ToString())); comm.ExecuteNonQuery(); } } catch (Exception ex) { MessageBox.Show("Error Code GRN-01 \nTry Again with Correct Inputs \n" + ex.Message); } }
public void BankAccountGrid() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Finance.Load_bank_acount_details"; comm.Parameters.AddWithValue("@Search_Condition", textBoxSearch.Text); SqlDataAdapter da = new SqlDataAdapter(comm); DataTable dt = new DataTable(); da.Fill(dt); dataGridViewBankAccount.DataSource = dt; dataGridViewBankAccount.Columns[0].Visible = false; dataGridViewBankAccount.Columns[2].Visible = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } DataGridViewColumn column = dataGridViewBankAccount.Columns[1]; column.Width = 150; }
//------------------------Other FN END-------------------// public void SaveInvoiceDetails() { try { int rows = dataGridView1.Rows.Count; for (int i = 0; rows - 1 > i; i++) { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "dbo.SRN_Save_Srn_Details"; comm.Parameters.AddWithValue("@ID", Documentid.ToString()); comm.Parameters.AddWithValue("@Item_Code", (dataGridView1.Rows[i].Cells["ItemCode"].Value).ToString()); comm.Parameters.AddWithValue("@Selling_Price", Convert.ToDecimal((dataGridView1.Rows[i].Cells["ItemCost"].Value).ToString())); comm.Parameters.AddWithValue("@Quentity", Convert.ToDecimal((dataGridView1.Rows[i].Cells["ItemQuentity"].Value).ToString())); comm.Parameters.AddWithValue("@Amount", Convert.ToDecimal((dataGridView1.Rows[i].Cells["Amount"].Value).ToString())); comm.ExecuteNonQuery(); } SaveInvoice(); } catch (Exception ex) { MessageBox.Show("SRN DETAILS ERROR \nTry Again with Correct Inputs \n" + ex.Message); } }
public void SaveDelete() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "dbo.Create_User"; comm.Parameters.AddWithValue("@Save_type", SaveType); comm.Parameters.AddWithValue("@Name", textBoxUserFullName.Text); comm.Parameters.AddWithValue("@Nic", textBoxNic.Text); comm.Parameters.AddWithValue("@User_name", textBoxUserName.Text); comm.Parameters.AddWithValue("@Password", textBoxConformPassword.Text); comm.Parameters.AddWithValue("@Type", comboBox1.Text); comm.ExecuteNonQuery(); if (SaveType == 1) { MessageBox.Show("User Created"); } else if (SaveType == 2) { MessageBox.Show("User Deleted"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void grid() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "stock.Get_List_of_Stock_details"; comm.Parameters.AddWithValue("@Search_Condition", textBoxSearch.Text); SqlDataAdapter da = new SqlDataAdapter(comm); DataTable dt = new DataTable(); da.Fill(dt); dataGridView1.DataSource = dt; DataGridViewColumn column = dataGridView1.Columns[0]; DataGridViewColumn column2 = dataGridView1.Columns[4]; column.Width = 255; column2.Width = 150; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void gridBanking() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Finance.Load_Banking_Transactions_To_Grid_View"; comm.Parameters.AddWithValue("@Search_Condition", textBoxSearch.Text); SqlDataAdapter da = new SqlDataAdapter(comm); DataTable dt = new DataTable(); da.Fill(dt); dataGridViewBanking.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.Message); } DataGridViewColumn column1 = dataGridViewBanking.Columns[1]; column1.Width = 250; DataGridViewColumn column2 = dataGridViewBanking.Columns[2]; column2.Width = 150; DataGridViewColumn column6 = dataGridViewBanking.Columns[6]; column6.Width = 170; }
public void LoadCustomer() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Customer.Load_Customer_Code_And_Name_Using_Vehicle_No"; comm.Parameters.AddWithValue("@Vehicle_No", ""); SqlDataReader dr; dr = comm.ExecuteReader(); if (dr.HasRows == true) { dr.Read(); textBoxCSID.Text = dr["Doc_No"].ToString(); textBoxCSName.Text = dr["Name"].ToString(); dr.Close(); } } catch (Exception) { MessageBox.Show("Error Loading Customer Details"); } }
public void LoadInvoice() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "dbo.SRN_Load_Invoice_Details"; comm.Parameters.AddWithValue("@Invoice", textBoxInvoice.Text); SqlDataAdapter da = new SqlDataAdapter(comm); DataTable dt = new DataTable(); da.Fill(dt); dataGridView1.DataSource = dt; DataGridViewColumn column = dataGridView1.Columns[0]; column.Width = 310; } catch (Exception ex) { Documentid = Guid.NewGuid().ToString(); labelDocID.Text = Documentid; MessageBox.Show(ex.Message); } }
private void buttonSave_Click(object sender, EventArgs e) { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "dbo.Update_Permission "; comm.Parameters.AddWithValue("@Setting_Name", labelSettingName.Text); if (checkBoxSetting.Checked == true) { comm.Parameters.AddWithValue("@Value", "ACTIVE"); } else { comm.Parameters.AddWithValue("@Value", "DEACTIVE"); } comm.ExecuteNonQuery(); Form1.LoadPermission(); LoadSettings(); MessageBox.Show("Successfully"); }
public void OtherGeneralDetails() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "dbo.SRN_Load_Invoice_Header"; comm.Parameters.AddWithValue("@Invoice", textBoxInvoice.Text); SqlDataReader dr; dr = comm.ExecuteReader(); if (dr.HasRows == true) { dr.Read(); textBoxCSID.Text = dr["Customer_Code"].ToString(); textBoxCSName.Text = dr["Name"].ToString(); textBoxItemAmount.Text = dr["Total_Amount"].ToString(); textBoxSelectedInv.Text = dr["Doc_No"].ToString(); dr.Close(); } } catch (Exception) { MessageBox.Show("Faild Loading Details"); } }
public void LoadItemDetailsBarcode() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Stock.Search_Items"; comm.Parameters.AddWithValue("@Search_Condition", textBoxItemCode.Text); SqlDataReader dr; dr = comm.ExecuteReader(); if (dr.HasRows == true) { dr.Read(); textBoxItemCode.Text = dr["Item Code"].ToString(); textBoxItemName.Text = dr["Item Name"].ToString(); textBoxCost.Text = dr["Selling_Price"].ToString(); dr.Close(); } } catch (Exception) { MessageBox.Show("Error Loading Customer Details"); } }
public void SaveInvoice() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "dbo.SRN_Save_Srn_header"; comm.Parameters.AddWithValue("@ID", Documentid.ToString()); comm.Parameters.AddWithValue("@Invoice", textBoxInvoice.Text); comm.Parameters.AddWithValue("@Total_Amount", Convert.ToDecimal(textBoxItemAmount.Text)); comm.Parameters.AddWithValue("@Remark ", textBoxRemark.Text); comm.Parameters.AddWithValue("@Customer_Code", textBoxCSID.Text); comm.Parameters.AddWithValue("@Date", Convert.ToDateTime(dateTimePickerTranDate.Text)); comm.ExecuteNonQuery(); MessageBox.Show("Sales Return Saved"); } catch (Exception ex) { MessageBox.Show("SRN HEADER ERROR \nTry Again with Correct Inputs \n" + ex.Message); } }
public void SaveDelete() { try { if (radioButtonCashOut.Checked == true || radioButtonCashIn.Checked == true) { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "finance.Save_Cash_transaction"; comm.Parameters.AddWithValue("@Save_Type", SaveType); comm.Parameters.AddWithValue("@Doc_No", labelDoc_No.Text); if (textBoxAmount.Text == "") { comm.Parameters.AddWithValue("@Amount", 0); } else { comm.Parameters.AddWithValue("@Amount", Convert.ToDecimal(textBoxAmount.Text)); } if (radioButtonCashIn.Checked == true) { comm.Parameters.AddWithValue("@Type", "Debit"); } else if (radioButtonCashOut.Checked == true) { comm.Parameters.AddWithValue("@Type", "Credit"); } if (checkBoxBankTransfer.Checked == true) { comm.Parameters.AddWithValue("@Account_Name", "Bank Trasnfer"); } else { comm.Parameters.AddWithValue("@Account_Name", textBoxDirection.Text); } comm.Parameters.AddWithValue("@Note", textBoxNote.Text); comm.Parameters.AddWithValue("@Transaction_Date", Convert.ToDateTime(dateTimePickerTransactionDate.Text)); comm.ExecuteNonQuery(); gridCash(); if (SaveType == 1) { MessageBox.Show("Saved Successfully"); } else if (SaveType == 2) { MessageBox.Show("Deleted Successfully"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void buttonBackup_Click(object sender, EventArgs e) { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "dbo.Backup_Database"; comm.ExecuteNonQuery(); MessageBox.Show("Back up Done successfully", "SQLDB Backup", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public void SaveUpdateDelete() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Suppliers.Save_Update_Delete_Supplier_Details"; comm.Parameters.AddWithValue("@Save_Type", SaveType); comm.Parameters.AddWithValue("@Doc_No", textBoxSupCode.Text); comm.Parameters.AddWithValue("@Name", textBoxName.Text); comm.Parameters.AddWithValue("@Company_Name", textBoxCompanyName.Text); comm.Parameters.AddWithValue("@Address", textBoxAddress.Text); comm.Parameters.AddWithValue("@Nic", textBoxNic.Text); comm.Parameters.AddWithValue("@Mobile_2", textBoxMobile02.Text); comm.Parameters.AddWithValue("@Mobile_1", textBoxMobile01.Text); comm.Parameters.AddWithValue("@Email", textBoxEmail.Text); comm.Parameters.AddWithValue("@Website", textBoxWebsite.Text); comm.Parameters.AddWithValue("@Other_Contact_Details", textBoxOtherContact.Text); comm.Parameters.AddWithValue("@Supplier_Since", Convert.ToDateTime(dateTimePickerSince.Text)); comm.Parameters.AddWithValue("@Note", textBoxNote.Text); comm.ExecuteNonQuery(); if (SaveType == 1) { LoadSupplierCode(); Clear(); grid(); MessageBox.Show("Updated"); } else if (SaveType == 2) { LoadSupplierCode(); Clear(); grid(); MessageBox.Show("Deleted"); } else if (SaveType == 3) { LoadSupplierCode(); Clear(); grid(); MessageBox.Show("Saved"); } } catch (Exception EX) { MessageBox.Show(EX.Message); } }
public void LoadSettings() { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "dbo.Load_Permission"; comm.Parameters.AddWithValue("@Search_Condition", textBoxSearch.Text); SqlDataAdapter da = new SqlDataAdapter(comm); DataTable dt = new DataTable(); da.Fill(dt); dataGridView1.DataSource = dt; }
private void buttonDelete_Click(object sender, EventArgs e) { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "dbo.SRN_Delete_SRN"; comm.Parameters.AddWithValue("@Doc_No", textBoxSearch.Text); comm.ExecuteNonQuery(); grid(); } catch (Exception) { MessageBox.Show("Fail Delete"); } }
public void SaveDeleteUpdate() { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Finance.Save_Update_Delete_Bank_Account_Details"; comm.Parameters.AddWithValue("@Save_Type", SaveType); comm.Parameters.AddWithValue("@Doc_No", textBoxDoc_No.Text); comm.Parameters.AddWithValue("@Bank_Or_Act", textBoxBankAccount.Text); comm.Parameters.AddWithValue("@Account_No", textBoxAccountNo.Text); comm.Parameters.AddWithValue("@Account_Type", comboBoxAccountType.Text); comm.ExecuteNonQuery(); LoadBnkCode(); grid(); }
public void SaveInvoice() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Sales.Save_Invoice_Details"; comm.Parameters.AddWithValue("@ID", Documentid.ToString()); comm.Parameters.AddWithValue("@CS_Code", textBoxCSID.Text); comm.Parameters.AddWithValue("@Doc_Date", Convert.ToDateTime(dateTimePickerTranDate.Text)); comm.Parameters.AddWithValue("@Total_Amount ", Convert.ToDecimal(textBoxItemAmount.Text)); if (textBoxCSPaidCash.Text == "") { comm.Parameters.AddWithValue("@Cash_Payment", 0); } else { comm.Parameters.AddWithValue("@Cash_Payment", Convert.ToDecimal(textBoxCSPaidCash.Text)); } if (textBoxChequeAmount.Text == "") { comm.Parameters.AddWithValue("@Cheque_Payment", 0); } else { comm.Parameters.AddWithValue("@Cheque_Payment", Convert.ToDecimal(textBoxChequeAmount.Text)); } comm.Parameters.AddWithValue("@Remark", textBoxRemark.Text); comm.ExecuteNonQuery(); LoadPrintInvoiceCode(); ClearInvoice(); } catch (Exception ex) { MessageBox.Show("Error Code INVH-01 \nTry Again with Correct Inputs \n" + ex.Message); } }
public void LoadSupplierCode() { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Suppliers.Load_Supplier_Codes"; SqlDataReader dr; dr = comm.ExecuteReader(); if (dr.HasRows == true) { dr.Read(); textBoxSupCode.Text = dr["Doc_No"].ToString(); dr.Close(); } }
public void LoadBnkCode() { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Finance.Bank_Account_Doc_No"; SqlDataReader dr; dr = comm.ExecuteReader(); if (dr.HasRows == true) { dr.Read(); textBoxDoc_No.Text = dr["Doc_No"].ToString(); dr.Close(); } }
public void LoadCashTranDocNo() { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "finance.Cash_Transaction_Doc_No"; SqlDataReader dr; dr = comm.ExecuteReader(); if (dr.HasRows == true) { dr.Read(); labelDoc_No.Text = dr["Doc_No"].ToString(); dr.Close(); } }
public void LoadBalance() { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Finance.Load_Cash_Balance"; SqlDataReader dr; dr = comm.ExecuteReader(); if (dr.HasRows == true) { dr.Read(); labelBalance.Text = dr["Amount"].ToString(); dr.Close(); } }
public void SaveDelete() { if (radioButtonBankOut.Checked == true || radioButtonBankIn.Checked == true) { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Finance.Save_Delete_Bank_Transaction"; comm.Parameters.AddWithValue("@Save_Type", SaveType); comm.Parameters.AddWithValue("@Doc_No", labelDoc_No.Text); comm.Parameters.AddWithValue("@Account_Doc_No", textBoxAccountDoc_No.Text); comm.Parameters.AddWithValue("@Account", textBoxDirection.Text); if (textBoxAmount.Text == "") { comm.Parameters.AddWithValue("@Amount", 0); } else { comm.Parameters.AddWithValue("@Amount", Convert.ToDecimal(textBoxAmount.Text)); } comm.Parameters.AddWithValue("@Date", Convert.ToDateTime(dateTimePickerTranBanking.Text)); if (radioButtonBankIn.Checked == true) { comm.Parameters.AddWithValue("@Type", "Debit"); } else if (radioButtonBankOut.Checked == true) { comm.Parameters.AddWithValue("@Type", "Credit"); } comm.Parameters.AddWithValue("@Note", textBoxNote.Text); comm.ExecuteNonQuery(); LoadBankTranDocNo(); gridBanking(); clear(); } }
public static void LoadPermission() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "dbo.Load_Permission_For_User"; SqlDataAdapter da = new SqlDataAdapter(comm); DataTable dt = new DataTable(); da.Fill(dt); //MessageBox.Show(dt.Rows[0][1].ToString()); //MessageBox.Show(dt.Rows[1][1].ToString()); Permission.InvoiceSave = dt.Rows[0][1].ToString(); Permission.InvoiceDisount = dt.Rows[1][1].ToString(); Permission.InvoiceCustomerSelect = dt.Rows[2][1].ToString(); Permission.InvoiceDateSelect = dt.Rows[3][1].ToString(); Permission.InvoiceSellingPriceChange = dt.Rows[4][1].ToString(); Permission.GRNCostChange = dt.Rows[5][1].ToString(); Permission.GRNDiscountChange = dt.Rows[6][1].ToString(); Permission.GRNOldView = dt.Rows[7][1].ToString(); Permission.GRNSave = dt.Rows[8][1].ToString(); Permission.ItemSave = dt.Rows[9][1].ToString(); Permission.ItemUpdate = dt.Rows[10][1].ToString(); Permission.ItemDelete = dt.Rows[11][1].ToString(); Permission.CustomerSave = dt.Rows[12][1].ToString(); Permission.CustomerUpdate = dt.Rows[13][1].ToString(); Permission.CustomerDelete = dt.Rows[14][1].ToString(); Permission.SupplierSave = dt.Rows[15][1].ToString(); Permission.SupplierUpadate = dt.Rows[16][1].ToString(); Permission.SupplierDelete = dt.Rows[17][1].ToString(); Permission.StockView = dt.Rows[18][1].ToString(); Permission.BarcodePrintAccess = dt.Rows[19][1].ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void gridCash() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "finance.Load_Cash_Transactions"; comm.Parameters.AddWithValue("@Search_Condition", textBoxSearch.Text); SqlDataAdapter da = new SqlDataAdapter(comm); DataTable dt = new DataTable(); da.Fill(dt); dataGridViewBanking.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void buttonDelete_Click(object sender, EventArgs e) { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "dbo.Delete_Service_List"; comm.Parameters.AddWithValue("@Doc_No", textBoxDocNo.Text); comm.ExecuteNonQuery(); grid(); textBoxDocNo.Clear(); MessageBox.Show("Deleted"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void SaveGRNHeader() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "GRN.Save_GRN_Details "; comm.Parameters.AddWithValue("@ID", Documentid.ToString()); comm.Parameters.AddWithValue("@Sup_Code", textBoxSUPID.Text); comm.Parameters.AddWithValue("@Doc_Date", Convert.ToDateTime(dateTimePickerTranDate.Text)); comm.Parameters.AddWithValue("@Total_Amount ", Convert.ToDecimal(textBoxItemAmount.Text)); if (textBoxPaidCash.Text == "") { comm.Parameters.AddWithValue("@Cash_Payment", 0); } else { comm.Parameters.AddWithValue("@Cash_Payment", Convert.ToDecimal(textBoxPaidCash.Text)); } if (textBoxChequeAmount.Text == "") { comm.Parameters.AddWithValue("@Cheque_Payment", 0); } else { comm.Parameters.AddWithValue("@Cheque_Payment", Convert.ToDecimal(textBoxChequeAmount.Text)); } comm.ExecuteNonQuery(); MessageBox.Show("Successfully"); Clear(); } catch (Exception ex) { MessageBox.Show("Error Code GRNH-01 \nTry Again with Correct Inputs \n" + ex.Message); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (textBoxName.Text == "") { MessageBox.Show("Required Name Field"); } else { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Customer.Save_Customer_Details"; comm.Parameters.AddWithValue("@Name", textBoxName.Text); comm.Parameters.AddWithValue("@Address", textBoxAddress.Text); comm.Parameters.AddWithValue("@Nic", textBoxNic.Text); comm.Parameters.AddWithValue("@Mobile_2", textBoxMobile02.Text); comm.Parameters.AddWithValue("@Mobile_1", textBoxMobile01.Text); comm.Parameters.AddWithValue("@Email", textBoxEmail.Text); comm.Parameters.AddWithValue("@Website", textBoxWebsite.Text); comm.Parameters.AddWithValue("@Other_Contact_Details", textBoxOtherContact.Text); comm.Parameters.AddWithValue("@Customer_Since", Convert.ToDateTime(dateTimePickerSince.Text)); comm.Parameters.AddWithValue("@Note", textBoxNote.Text); comm.Parameters.AddWithValue("@User_Code", ""); comm.ExecuteNonQuery(); grid(); LoadCustomerCode(); Clear(); MessageBox.Show("Saved"); } } catch (Exception ex) { MessageBox.Show(ex.ToString() + "Do not enter duplicate value"); } }
public void gridDetails() { try { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "dbo.[SRN_Load_SRN_DETAILS] "; comm.Parameters.AddWithValue("@Search_Condition", textBoxSearch.Text); SqlDataAdapter da = new SqlDataAdapter(comm); DataTable dt = new DataTable(); da.Fill(dt); //dataGridViewDetails.DataSource = dt; //DataGridViewColumn column = dataGridViewDetails.Columns[2]; //column.Width = 255; } catch (Exception ex) { MessageBox.Show(ex.Message); } }