public string EditVendor(int vid, string vname, string vlocation, string Action) { VendorDetails vd = new VendorDetails(); SqlConnection con = new SqlConnection(Connection); DataTable dt = new DataTable(); con.Open(); SqlDataAdapter da = new SqlDataAdapter(); SqlCommand cmd = new SqlCommand("stp_srv_VendorCRUD", con); cmd.Parameters.Add("@Vid", SqlDbType.Int).Value = Convert.ToInt32(vid); cmd.Parameters.Add("@vname", SqlDbType.NVarChar).Value = vname; cmd.Parameters.Add("@vlocation", SqlDbType.NVarChar).Value = Convert.ToString(vlocation); cmd.Parameters.Add("@Action", SqlDbType.NVarChar).Value = Action; cmd.CommandType = CommandType.StoredProcedure; //da.SelectCommand = cmd; //da.Fill(dt); int i = cmd.ExecuteNonQuery(); con.Close(); if (i >= 1) { return("Vendor Not Update"); } else { return("Vendor Update Successfully"); } }
public List <VendorDetails> VendorList(string Action) { List <VendorDetails> listvd = new List <VendorDetails>(); SqlConnection con = new SqlConnection(Connection); DataTable dt = new DataTable(); con.Open(); SqlDataAdapter da = new SqlDataAdapter(); SqlCommand cmd = new SqlCommand("stp_srv_VendorCRUD", con); cmd.Parameters.Add("@Action", SqlDbType.NVarChar).Value = Action; cmd.CommandType = CommandType.StoredProcedure; da.SelectCommand = cmd; da.Fill(dt); con.Close(); VendorDetails vd; for (int i = 0; i < dt.Rows.Count; i++) { vd = new VendorDetails(); vd.VendorID = Convert.ToInt32(dt.Rows[i]["VendorID"].ToString()); vd.VendorName = dt.Rows[i]["VendorName"].ToString(); vd.VendorLocation = dt.Rows[i]["LocationID"].ToString(); listvd.Add(vd); } return(listvd); }
public List <VendorDetails> GetVendorList() { List <VendorDetails> vendorDetails = new List <VendorDetails>(); DataTable dt = new DataTable(); SqlConnection con = new SqlConnection(Connection); con.Open(); SqlDataAdapter da = new SqlDataAdapter(); SqlCommand cmd = new SqlCommand("stp_srv_GetUniqueVendorDetails", con); cmd.CommandType = CommandType.StoredProcedure; da.SelectCommand = cmd; da.Fill(dt); con.Close(); VendorDetails vd; for (int i = 0; i < dt.Rows.Count; i++) { vd = new VendorDetails(); vd.VendorID = Convert.ToInt32(dt.Rows[i]["VendorID"].ToString()); vd.VendorName = dt.Rows[i]["VendorName"].ToString(); vd.VendorLocation = dt.Rows[i]["VendorLocation"].ToString(); vendorDetails.Add(vd); } return(vendorDetails); }
public InventoryModule GetInventoryModule() { InventoryModule inventoryModules = new InventoryModule(); List <ProductDetails> productDetails = new List <ProductDetails>(); List <VendorDetails> vendorDetails = new List <VendorDetails>(); DataSet ds = new DataSet(); //DataTable dt = new DataTable(); SqlConnection con = new SqlConnection(Connection); con.Open(); SqlDataAdapter da = new SqlDataAdapter(); SqlCommand cmd = new SqlCommand("stp_srv_GetUniqueVendorProductDetails", con); cmd.CommandType = CommandType.StoredProcedure; da.SelectCommand = cmd; da.Fill(ds); con.Close(); if (ds.Tables[0].Rows.Count > 0) { ProductDetails pd; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { pd = new ProductDetails(); pd.ProductID = Convert.ToInt32(ds.Tables[0].Rows[i]["ProductID"].ToString()); pd.ProductName = ds.Tables[0].Rows[i]["ProductName"].ToString(); pd.BillingName = ds.Tables[0].Rows[i]["BillingName"].ToString(); pd.Type = ds.Tables[0].Rows[0]["Type"].ToString(); pd.GST = Convert.ToInt32(ds.Tables[0].Rows[i]["GST"].ToString()); pd.HSNCode = Convert.ToInt32(ds.Tables[0].Rows[i]["HSN"].ToString()); productDetails.Add(pd); } } if (ds.Tables[1].Rows.Count > 0) { VendorDetails vd; for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { vd = new VendorDetails(); vd.VendorID = Convert.ToInt32(ds.Tables[1].Rows[i]["VendorID"].ToString()); vd.VendorName = ds.Tables[1].Rows[i]["VendorName"].ToString(); vd.VendorLocation = ds.Tables[1].Rows[i]["LocationName"].ToString(); vendorDetails.Add(vd); } } inventoryModules.productDetails = productDetails; inventoryModules.vendorDetails = vendorDetails; return(inventoryModules); }