private void btnsave_Click(object sender, EventArgs e) { try { if (strfinalarray[0] == "S") { serial = conn.getdataset("select * from ProductMaster where isactive=1 and Product_Name='" + DefaultSale.itemname + "'"); } else if (strfinalarray[0] == "SR") { serial = conn.getdataset("select * from ProductMaster where isactive=1 and Product_Name='" + DefaultSale.itemname + "'"); } else if (strfinalarray[0] == "P") { serial = conn.getdataset("select * from ProductMaster where isactive=1 and Product_Name='" + DefaultSale.itemname + "'"); } else if (strfinalarray[0] == "PR") { serial = conn.getdataset("select * from ProductMaster where isactive=1 and Product_Name='" + DefaultSale.itemname + "'"); } //else if (strfinalarray[0] == "SO") //{ // serial = conn.getdataset("select * from ProductMaster where isactive=1 and Product_Name='" + DefaultSaleOrder.itemname + "'"); //} //else if (strfinalarray[0] == "SC") //{ // serial = conn.getdataset("select * from ProductMaster where isactive=1 and Product_Name='" + DefaultSaleOrder.itemname + "'"); //} //else if (strfinalarray[0] == "PO") //{ // serial = conn.getdataset("select * from ProductMaster where isactive=1 and Product_Name='" + DefaultSaleOrder.itemname + "'"); //} //else if (strfinalarray[0] == "PC") //{ // serial = conn.getdataset("select * from ProductMaster where isactive=1 and Product_Name='" + DefaultSaleOrder.itemname + "'"); //} else if (strfinalarray[0] == "SO") { serial = conn.getdataset("select * from ProductMaster where isactive=1 and Product_Name='" + SalePurchaseOrderSimpleformate.itemname + "'"); } else if (strfinalarray[0] == "SC") { serial = conn.getdataset("select * from ProductMaster where isactive=1 and Product_Name='" + SalePurchaseOrderSimpleformate.itemname + "'"); } else if (strfinalarray[0] == "PO") { serial = conn.getdataset("select * from ProductMaster where isactive=1 and Product_Name='" + SalePurchaseOrderSimpleformate.itemname + "'"); } else if (strfinalarray[0] == "PC") { serial = conn.getdataset("select * from ProductMaster where isactive=1 and Product_Name='" + SalePurchaseOrderSimpleformate.itemname + "'"); } DataTable dt = conn.getdataset("Select Batchno from ProductPriceMaster where Batchno='" + txtbatchno.Text + "' and ProductID='" + serial.Rows[0]["ProductID"].ToString() + "'"); if (dt.Rows.Count > 0) { MessageBox.Show("Serial No is exists"); txtbatchno.Focus(); return; } if (strfinalarray[0] == "S") { p = DefaultSale.productid; } else if (strfinalarray[0] == "SR") { p = DefaultSale.productid; } else if (strfinalarray[0] == "P") { p = DefaultSale.productid; } else if (strfinalarray[0] == "PR") { p = DefaultSale.productid; } else if (strfinalarray[0] == "SO") { p = SalePurchaseOrderSimpleformate.productid; } else if (strfinalarray[0] == "SC") { p = SalePurchaseOrderSimpleformate.productid; } else if (strfinalarray[0] == "PO") { p = SalePurchaseOrderSimpleformate.productid; } else if (strfinalarray[0] == "PC") { p = SalePurchaseOrderSimpleformate.productid; } if (txtsaleprice.Text == "") { txtsaleprice.Text = "0"; } if (txtmrp.Text == "") { txtmrp.Text = "0"; } if (txtbasicprice.Text == "") { txtbasicprice.Text = "0"; } if (txtpurchaseprice.Text == "") { txtpurchaseprice.Text = "0"; } conn.execute("INSERT INTO [dbo].[ProductPriceMaster]([Productid],[Batchno],[BasicPrice],[SalePrice],[MRP],[PurchasePrice],[Barcode],[OpStock],[ExpDt],[mfgdt],[Expdays],[SelfVal],[minsaleprice],[oploose],[opstockval],[isactive])VALUES('" + p + "','" + txtbatchno.Text + "','" + txtbasicprice.Text + "','" + txtsaleprice.Text + "','" + txtmrp.Text + "','" + txtpurchaseprice.Text + "','" + txtbarcode.Text + "',0,'" + txtexpirydate.Text + "','" + txtmfgdate.Text + "','0','0','0','0','0.00','1')"); if (strfinalarray[0] == "S") { mdefaultSale.bindbatch(); } else if (strfinalarray[0] == "SR") { mdefaultSale.bindbatch(); } else if (strfinalarray[0] == "P") { mdefaultSale.bindbatch(); } else if (strfinalarray[0] == "PR") { mdefaultSale.bindbatch(); } else if (strfinalarray[0] == "SO") { // defaultSaleOrder.bindbatch(); salePurchaseOrderSimpleformate.bindbatch(); } else if (strfinalarray[0] == "SC") { // defaultSaleOrder.bindbatch(); salePurchaseOrderSimpleformate.bindbatch(); } else if (strfinalarray[0] == "PO") { // defaultSaleOrder.bindbatch(); salePurchaseOrderSimpleformate.bindbatch(); } else if (strfinalarray[0] == "PC") { // defaultSaleOrder.bindbatch(); salePurchaseOrderSimpleformate.bindbatch(); } this.Close(); if (a == 1) { batchno = txtbatchno.Text; mdefaultSale.bindbatchfromform(batchno); } if (a == 2) { batchno = txtbatchno.Text; // defaultSaleOrder.bindbatchfromform(batchno); salePurchaseOrderSimpleformate.bindbatchfromform(batchno); // mdefaultSale.bindbatchfromform(batchno); } clearall(); } catch { } }