public TradeEntry(int PtradeId) { InitializeComponent(); TradeId = PtradeId; Trade_Model tm = new Trade_Model(); tm.Action = "fetchbyid"; tm.TradeId = PtradeId; DataSet ds = tm.TradeOperation(); if (ds.Tables[0].Rows.Count > 0) { txt_TradeName.Text = ds.Tables[0].Rows[0]["TradeName"].ToString(); txt_shortcode.Text = ds.Tables[0].Rows[0]["ShortCode"].ToString(); txt_Gstinno.Text = ds.Tables[0].Rows[0]["GstInNo"].ToString(); txt_Address1.Text = ds.Tables[0].Rows[0]["AddressLine1"].ToString(); txt_address2.Text = ds.Tables[0].Rows[0]["AddressLine2"].ToString(); txt_address3.Text = ds.Tables[0].Rows[0]["AddressLine3"].ToString(); txt_city.Text = ds.Tables[0].Rows[0]["CityName"].ToString(); txt_pincode.Text = ds.Tables[0].Rows[0]["Pincode"].ToString(); txt_ContactNo1.Text = ds.Tables[0].Rows[0]["ContactNo1"].ToString(); txt_contactno2.Text = ds.Tables[0].Rows[0]["ContactNo2"].ToString(); txt_email.Text = ds.Tables[0].Rows[0]["EmailId"].ToString(); txt_file.Text = ds.Tables[0].Rows[0]["Logo"].ToString(); btn_Save.Text = "Update"; btn_SaveAddNew.Enabled = false; btn_SaveAddNew.Text = "Update Trade"; } }
private bool Save() { if (txt_TradeName.Text != "") { Trade_Model tm = new Trade_Model(); if (btn_Save.Text == "Update") { tm.Action = "updateitem"; tm.TradeId = TradeId; } else { tm.Action = "insert"; } tm.TradeName = txt_TradeName.Text; tm.ShortCode = txt_shortcode.Text; tm.GstInNo = txt_Gstinno.Text; tm.AddressLine1 = txt_Address1.Text; tm.AddressLine2 = txt_address2.Text; tm.AddressLine3 = txt_address3.Text; tm.CityName = txt_city.Text; tm.Pincode = txt_pincode.Text; tm.ContactNo1 = txt_ContactNo1.Text; tm.ContactNo2 = txt_contactno2.Text; tm.EmailId = txt_email.Text; tm.Logo = txt_file.Text; //tm.StateId = ddl_State.SelectedItem.ToString(); DataSet ds = tm.TradeOperation(); if (ds.Tables[0].Rows[0].ItemArray[0].ToString() == "Record Submitted Successfully") { MessageBox.Show("Record Submitted Successfully", "MinifyERPBilling", MessageBoxButtons.OK, MessageBoxIcon.Information); return(true); } else if (ds.Tables[0].Rows[0].ItemArray[0].ToString() == "Update Successfully") { MessageBox.Show("Updated Successfully", "MinifyERPBilling", MessageBoxButtons.OK, MessageBoxIcon.Information); return(true); } else if (ds.Tables[0].Rows[0].ItemArray[0].ToString() == "Item Name Aready Exists") { MessageBox.Show("Item Name Aready Exists!!!Please Try Again With Diffrent Trade Name", "MinifyERPBilling", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } else { MessageBox.Show("Failed to Execute Command!!! Please Try Again Later", "MinifyERPBilling", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } else { MessageBox.Show("Failed to Execute Command!!! Please Try Again Later", "MINIFY", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
private DataTable GetAll() { DataTable dt = new DataTable(); dt.Columns.Add("TradeId", typeof(int)); dt.Columns.Add("TradeName", typeof(string)); dt.Columns.Add("ShortCode", typeof(string)); dt.Columns.Add("AddressLine1", typeof(string)); dt.Columns.Add("StateId", typeof(string)); dt.Columns.Add("CityName", typeof(string)); dt.Columns.Add("Pincode", typeof(string)); dt.Columns.Add("EmailId", typeof(string)); dt.Columns.Add("ContactNo1", typeof(string)); dt.Columns.Add("GstInNo", typeof(string)); dt.Columns.Add("Logo", typeof(string)); Trade_Model trade_Model = new Trade_Model(); trade_Model.Action = "fetch"; DataSet ds = trade_Model.TradeOperation(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { dt.Rows.Add( ds.Tables[0].Rows[i]["TradeId"].ToString(), ds.Tables[0].Rows[i]["TradeName"].ToString(), ds.Tables[0].Rows[i]["ShortCode"].ToString(), ds.Tables[0].Rows[i]["AddressLine1"].ToString(), ds.Tables[0].Rows[i]["StateId"].ToString(), ds.Tables[0].Rows[i]["CityName"].ToString(), ds.Tables[0].Rows[i]["Pincode"].ToString(), ds.Tables[0].Rows[i]["EmailId"].ToString(), ds.Tables[0].Rows[i]["ContactNo1"].ToString(), ds.Tables[0].Rows[i]["GstInNo"].ToString(), ds.Tables[0].Rows[i]["Logo"].ToString() ); } return(dt); }
private void ddl_Country_SelectedIndexChanged(object sender, EventArgs e) { Trade_Model tm = new Trade_Model(); DataSet ds = tm.TradeOperation(); }