private bool NewInsert_Check() { bool val = false; try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; SqlDataAdapter adp = new SqlDataAdapter("", con); adp.SelectCommand.CommandText = "select CategoryId from tCategory where Category=@Category"; adp.SelectCommand.Parameters.AddWithValue("@Category", txtCategory.Text.Trim()); DataSet ds = new DataSet(); adp.Fill(ds); if (ds.Tables [0].Rows.Count > 0) { val = true; } } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("Category", "NewInsert_Check", er); } return(val); }
private bool del_chk() { bool val = false; try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; SqlDataAdapter adp = new SqlDataAdapter("", con); adp.SelectCommand.CommandText = "select FabWidthId from tStyleMaster where FabWidthId=@FabWidthId"; adp.SelectCommand.Parameters.AddWithValue("@FabWidthId", y); DataSet ds = new DataSet(); adp.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { val = true; } } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("tFabWidth", "del_chk", er); } return(val); }
private void editSave_size() { try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; con.Open(); SqlCommand cmd = new SqlCommand("", con); cmd.CommandText = "update tSizeType set SizeType =@sizetype where SizeTypeId=@sizetypeid"; cmd.Parameters.AddWithValue("@sizetypeid", y); cmd.Parameters.AddWithValue("@sizetype", txtSizetype.Text); int i = cmd.ExecuteNonQuery(); if (i != 0) { MessageBox.Show("Updated Successfully"); } else { MessageBox.Show("Updation Failed"); } con.Close(); txtSizetype.Text = ""; tSizetypeLog_ins('E', y); showdata(); } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("SizeType", "editSave_sizetype", er); } }
private void editSave_Fab() { try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; con.Open(); SqlCommand cmd = new SqlCommand("", con); cmd.CommandText = "update tFabWidth set FabWidthName= @FabWidthName,WidthSize= @WidthSize from tFabWidth where FabWidthId= @FabWidthId"; cmd.Parameters.AddWithValue("@FabWidthId", y); cmd.Parameters.AddWithValue("@FabWidthName", txtWidthName.Text); cmd.Parameters.AddWithValue("@WidthSize", txtWidthSize.Text); int i = cmd.ExecuteNonQuery(); if (i != 0) { MessageBox.Show("Updated Successfully"); } else if (i == 0) { MessageBox.Show("Updation Failed"); } con.Close(); insrt_tFabWidthLog('E', y); txtWidthName.Text = ""; txtWidthSize.Text = ""; showdata(); } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("tFabWidth", "editSave_Fab", er); } }
private int Insertsubmethod() { int k = 0; SqlConnection con = new SqlConnection(); try { con.ConnectionString = clsDbForReports.constr; con.Open(); SqlCommand cmd = new SqlCommand("", con); cmd.CommandText = "subcat_sel_ins"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@compcode", clsDbForReports.companycode); cmd.Parameters.AddWithValue("@offcode", 100); cmd.Parameters.AddWithValue("@catid", cmbCategory.SelectedValue); cmd.Parameters.AddWithValue("@subcat", txtSubCategory.Text); cmd.Parameters.AddWithValue("@subcatid", 0).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); MessageBox.Show("Inserted"); int returnvalue = (int)cmd.Parameters["@subcatid"].Value; k = Convert.ToInt32(returnvalue); } catch (Exception e) { Clserrlogr eobj = new Clserrlogr(); eobj.write("Category", "btnNew_Save", e.Message); } finally { con.Close(); } return(k); }
private void delSizeType_fun() { try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; con.Open(); SqlCommand cmd = new SqlCommand("", con); cmd.CommandText = "delSizeType"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@sizetypeid", y); int i = cmd.ExecuteNonQuery(); if (i != 0) { MessageBox.Show("Deleted Successfully"); } con.Close(); txtSizetype.Text = ""; tSizetypeLog_ins('D', y); showdata(); } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("SizeType", "delSizeType_fun", er); } }
private void btnEdit_Save() { try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; con.Open(); SqlCommand cmd = new SqlCommand("", con); cmd.CommandText = "update tCategory set Category=@category where CategoryId=@categoryid"; cmd.Parameters.AddWithValue("@categoryid", y); cmd.Parameters.AddWithValue("@category", txtCategory.Text); int i = cmd.ExecuteNonQuery(); if (i != 0) { MessageBox.Show("Updated Successfully"); } else { MessageBox.Show("Updation Failed"); } con.Close(); insertcategorylog(y, 'E'); txtCategory.Text = ""; showdata(); } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("Category", "btnEdit_Save", er); } }
private void del_Fab() { try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; con.Open(); SqlCommand cmd = new SqlCommand("", con); cmd.CommandText = "FabWidthDel"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@FabWidthId", y); int i = cmd.ExecuteNonQuery(); if (i != 0) { MessageBox.Show("Deleted Successfully"); } else if (i == 0) { MessageBox.Show("Deletion Failed"); } con.Close(); insrt_tFabWidthLog('D', y); txtWidthName.Text = ""; txtWidthSize.Text = ""; showdata(); } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("tFabWidth", "del_Fab", er); } }
private void delCategory_fun() { try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; SqlCommand cmd = new SqlCommand("", con); con.Open(); cmd.CommandText = "tcat_del"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@categoryId", y); int i = cmd.ExecuteNonQuery(); if (i != 0) { MessageBox.Show("Deleted Successfully"); } con.Close(); insertcategorylog(y, 'D'); txtCategory.Text = ""; } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("Category", "delCategory_fun", er); } }
private void btnNew_Save() { try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; con.Open(); SqlCommand cmd = new SqlCommand("", con); cmd.CommandText = "cat_ins"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@compcode", clsDbForReports.companycode); cmd.Parameters.AddWithValue("@offcode", clsDbForReports.officecode); cmd.Parameters.AddWithValue("@catgry", txtCategory.Text); cmd.Parameters.AddWithValue("@catid", 0).Direction = ParameterDirection.Output; int i = cmd.ExecuteNonQuery(); if (i != 0) { MessageBox.Show("Inserted Successfully"); } else { MessageBox.Show("Insertion Failed"); } returnvalue = (int)cmd.Parameters["@catid"].Value; con.Close(); insertcategorylog(returnvalue, 'N'); txtCategory.Text = ""; showdata(); } catch (Exception e) { Clserrlogr eobj = new Clserrlogr(); eobj.write("Category", "btnNew_Save", e.Message); } }
private bool DelCheck() { bool ckdel = false; try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; SqlDataAdapter sda = new SqlDataAdapter("", con); sda.SelectCommand.CommandText = "select SubCategoryId from tStyleMaster where SubCategoryId=@id"; sda.SelectCommand.Parameters.AddWithValue("@id", globalID); DataSet ds = new DataSet(); sda.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { ckdel = true; } } catch (Exception e) { Clserrlogr eobj = new Clserrlogr(); eobj.write("Category", "btnNew_Save", e.Message); } return(ckdel); }
private void celldoubleclick(int a) { try { mode = "Edit"; lblMode.Text = "Mode:Edit"; y = Convert.ToInt32(dataGridFabWidth.Rows[a].Cells[0].Value); SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; SqlDataAdapter adp = new SqlDataAdapter("", con); adp.SelectCommand.CommandText = "select FabWidthName,WidthSize from tFabWidth where FabWidthId=@FabWidthId"; adp.SelectCommand.Parameters.AddWithValue("@FabWidthId", y); DataSet ds = new DataSet(); adp.Fill(ds); txtWidthName.Text = ds.Tables[0].Rows[0][0].ToString(); txtWidthSize.Text = ds.Tables[0].Rows[0][1].ToString(); } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("tFabWidth", "celldoubleclick", er); } }
private void Deletesubmethod() { SqlConnection con = new SqlConnection(); try { con.ConnectionString = clsDbForReports.constr; con.Open(); SqlCommand cmd = new SqlCommand("", con); cmd.CommandText = "subcat_del"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@subcatid", globalID); int i = cmd.ExecuteNonQuery(); if (i != 0) { MessageBox.Show("Deleted"); } txtSubCategory.Text = ""; } catch (Exception e) { Clserrlogr eobj = new Clserrlogr(); eobj.write("Category", "btnNew_Save", e.Message); } finally { con.Close(); } }
private void Editsubmethod() { SqlConnection con2 = new SqlConnection(); try { con2.ConnectionString = clsDbForReports.constr; con2.Open(); SqlCommand cmd2 = new SqlCommand("", con2); cmd2.CommandText = "Update tSubCategory set SubCategory=@subnm2 WHERE SubCategoryId=@id"; cmd2.Parameters.AddWithValue("@id", globalID); cmd2.Parameters.AddWithValue("subnm2", txtSubCategory.Text); int i = cmd2.ExecuteNonQuery(); if (i != 0) { MessageBox.Show("Updated"); } } catch (Exception e) { Clserrlogr eobj = new Clserrlogr(); eobj.write("Category", "btnNew_Save", e.Message); } finally { con2.Close(); } }
private bool Newinsertcheck() { bool chck = false; try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; SqlDataAdapter sda = new SqlDataAdapter("", con); sda.SelectCommand.CommandText = "select SubCategoryId from tSubCategory where SubCategory=@subcat"; sda.SelectCommand.Parameters.AddWithValue("@subcat", txtSubCategory.Text); DataSet ds = new DataSet(); sda.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { chck = true; } } catch (Exception e) { Clserrlogr eobj = new Clserrlogr(); eobj.write("Category", "btnNew_Save", e.Message); } return(chck); }
private bool edit_Chk() { bool val = false; try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; SqlDataAdapter adp = new SqlDataAdapter("", con); adp.SelectCommand.CommandText = "select SizeTypeId from tSizeType where SizeTypeId!=@SizeTypeId and SizeType=@SizeType"; adp.SelectCommand.Parameters.AddWithValue("@SizeType", txtSizetype.Text.Trim()); adp.SelectCommand.Parameters.AddWithValue("@SizeTypeId", y); DataSet ds = new DataSet(); adp.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { val = true; } } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("SizeType", "edit_Chk", er); } return(val); }
private void celldoubleclick(int b) { try { mode = "Edit"; lblmodsize.Text = "Mode:Edit"; y = Convert.ToInt32(dataGridViewSizetype.Rows[b].Cells[0].Value); SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; SqlDataAdapter adp = new SqlDataAdapter("", con); string str = "select SizeType from tSizeType where SizeTypeId=@typesizeid"; adp.SelectCommand.CommandText = str; adp.SelectCommand.Parameters.AddWithValue("@typesizeid", y); DataSet ds = new DataSet(); adp.Fill(ds); txtSizetype.Text = ds.Tables[0].Rows[0][0].ToString(); } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("SizeType", "celldoubleclick", er); } }
private void show_grid() { try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; SqlDataAdapter sda = new SqlDataAdapter("", con); sda.SelectCommand.CommandText = "select A.SubCategoryId,A.SubCategory,B.Category from tSubCategory A inner join tCategory B on A.CategoryId=B.CategoryId order by A.SubCategoryId"; DataSet ds = new DataSet(); sda.Fill(ds); dgvSubCategory.DataSource = ds.Tables[0]; } catch (Exception e) { Clserrlogr eobj = new Clserrlogr(); eobj.write("Category", "btnNew_Save", e.Message); } }
private void showdata() { try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; SqlDataAdapter adp = new SqlDataAdapter("", con); adp.SelectCommand.CommandText = "select CategoryId,Category from tCategory order by CategoryId desc "; DataSet ds = new DataSet(); adp.Fill(ds); datagridCategory.DataSource = ds.Tables[0]; } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("Category", "showdata", er); } }
private void show_combo() { try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; SqlDataAdapter sda = new SqlDataAdapter("", con); sda.SelectCommand.CommandText = "SELECT Category,CategoryId FROM tCategory"; DataSet ds = new DataSet(); sda.Fill(ds); cmbCategory.DataSource = ds.Tables[0]; cmbCategory.DisplayMember = "Category"; cmbCategory.ValueMember = "CategoryId"; } catch (Exception e) { Clserrlogr eobj = new Clserrlogr(); eobj.write("Category", "btnNew_Save", e.Message); } }
private void showdata() { try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; SqlDataAdapter adp = new SqlDataAdapter("", con); adp.SelectCommand.CommandText = "select FabWidthId,FabWidthName,WidthSize from tFabWidth order by FabWidthId desc"; DataSet ds = new DataSet(); adp.Fill(ds); dataGridFabWidth.DataSource = ds.Tables[0]; } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("tFabWidth", "showdata", er); } }
private void Celldoubleclick(int x) { try { gpbMode.Text = "Mode : Edit"; mode = "edit"; globalID = Convert.ToInt32(dgvSubCategory.Rows[x].Cells[0].Value); SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; SqlDataAdapter sda = new SqlDataAdapter("", con); sda.SelectCommand.CommandText = "select A.SubCategory,B.Category from tSubCategory A inner join tCategory B on A.CategoryId=B.CategoryId where SubCategoryId=@id"; sda.SelectCommand.Parameters.AddWithValue("@id", globalID); DataSet ds = new DataSet(); sda.Fill(ds); txtSubCategory.Text = ds.Tables[0].Rows[0][0].ToString(); } catch (Exception e) { Clserrlogr eobj = new Clserrlogr(); eobj.write("Category", "btnNew_Save", e.Message); } }
private void newSave_Fab() { try { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; con.Open(); SqlCommand cmd = new SqlCommand("", con); cmd.CommandText = "insrtFabWidth"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@compcode", clsDbForReports.companycode); cmd.Parameters.AddWithValue("@offcode", clsDbForReports.officecode); cmd.Parameters.AddWithValue("@fabwidthid", 0).Direction = ParameterDirection.Output; cmd.Parameters.AddWithValue("@fabwidthname", txtWidthName.Text); cmd.Parameters.AddWithValue("@fabwidthsize", txtWidthSize.Text); int i = cmd.ExecuteNonQuery(); int fid = (int)cmd.Parameters["@fabwidthid"].Value; if (i != 0) { MessageBox.Show("Inserted Successfully"); } else { MessageBox.Show("Insertion Failed"); } con.Close(); insrt_tFabWidthLog('N', fid); txtWidthName.Text = ""; txtWidthSize.Text = ""; showdata(); } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("tFabWidth", "newSave_Fab", er); } }
private void newSave_size() { try { int val; SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; con.Open(); SqlCommand cmd = new SqlCommand("", con); cmd.CommandText = "insrtSizeType"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@sizetype", txtSizetype.Text); cmd.Parameters.AddWithValue("@sizetypeid", 0).Direction = ParameterDirection.Output; cmd.Parameters.AddWithValue("@compcode", clsDbForReports.companycode); cmd.Parameters.AddWithValue("@offcode", clsDbForReports.officecode); int i = cmd.ExecuteNonQuery(); if (i != 0) { MessageBox.Show("Inserted Successfully"); } else { MessageBox.Show("Insertion Failed"); } con.Close(); val = (int)cmd.Parameters["@sizetypeid"].Value; txtSizetype.Text = ""; tSizetypeLog_ins('N', val); showdata(); } catch (Exception e) { string er; er = e.ToString(); Clserrlogr eobj = new Clserrlogr(); eobj.write("SizeType", "newSave_sizetype", er); } }