public int DA_ValidateSale(SaleEntities objSaleDetails) { int val = 0; DataTable dt = new DataTable(); try { con.Open(); MySqlCommand cmd = new MySqlCommand(objQuery.ValidateSale, con); cmd.Parameters.AddWithValue("@MobileNo", objSaleDetails.MobileNo); MySqlDataAdapter da = new MySqlDataAdapter(cmd); da.Fill(dt); if (dt.Rows.Count > 0) { val = Convert.ToInt32(dt.Rows[0]["saleId"]); } else { val = 0; } } catch (Exception ex) { ex.ToString(); //throw; } finally { con.Close(); } return(val); }
private void btnSearch_Click(object sender, EventArgs e) { using (SaleEntities db = new SaleEntities()) { if (txtWord.Text == "" && txtWord.Visible && txtMax.Text == "" && txtMin.Text == "") { fillData(db.Products.ToList()); return; } List <Product> products = new List <Product>(); if (cmbName.Text == "Name") { products = db.Products.Where(p => p.Name.Contains(txtWord.Text)).ToList(); fillData(products); } else { decimal.TryParse(txtMin.Text, out decimal min); decimal.TryParse(txtMax.Text, out decimal max); if (txtMin.Text != "" && txtMax.Text != "") { products = db.Products.Where(p => p.Price <max && p.Price> min).ToList(); } else { products = db.Products.Where(p => p.Price <max || p.Price> min).ToList(); } fillData(products); } } }
public int BAaddSaleDetails(SaleEntities objSaleDetails) { DASaleMaster objSaleDA = new DASaleMaster(); int returnValue = objSaleDA.DAaddSaleDetails(objSaleDetails); return(returnValue); }
protected void Button1_Click(object sender, EventArgs e) { int validate = 0; SaleEntities objSaleDetails = new SaleEntities(); //objSaleDetails.SaleId = Convert.ToInt16(SaleId.Text); objSaleDetails.BillNo = Convert.ToInt16(BillNo.Text); objSaleDetails.Date = Date.Text; objSaleDetails.CustomerName = CustomerName.Text; objSaleDetails.MobileNo = MobileNo.Text; objSaleDetails.EmailId = EmailId.Text; objSaleDetails.GSTNo = Convert.ToInt32(GSTNo.Text); objSaleDetails.Address = Address.InnerText; //objSaleDetails.Product = (Product.SelectedItem.Value); objSaleDetails.Price = Convert.ToInt32(Price.Text); objSaleDetails.Quantity = Convert.ToInt32(Quantity.Text); objSaleDetails.GSTType = ddlGSTType.Text; objSaleDetails.GSTPercentage = Convert.ToInt16(GSTPercentage.Text); objSaleDetails.Total = Convert.ToInt32(Total.Text); objSaleDetails.PlaceToSupply = PlaceToSupply.Text; objSaleDetails.Transport = Convert.ToInt16(Transport.Text); objSaleDetails.OtherCharges = Convert.ToInt16(OtherCharges.Text); //objSaleDetails.RoundOff = Convert.ToInt16(RoundOff.Text); objSaleDetails.TotalAmount = Convert.ToInt16(TotalAmount.Text); objSaleDetails.Discount = Convert.ToInt32(Discount.Text); objSaleDetails.RupeesInWord = RupeesInword.Text; objSaleDetails.Paymentmtd = Paymentmtd.Text; try { //BAL BASaleMaster objSaleMasterBA = new BASaleMaster(); validate = objSaleMasterBA.BA_ValidateSale(objSaleDetails); if (validate > 0) { SaleId = validate; } else { int rValue = objSaleMasterBA.BAaddSaleDetails(objSaleDetails); SaleId = rValue; if (rValue > 0) { GetTableDetails(); } else { Response.Write("<script>alert('Error')</script>"); } } AddSaleOutwards(SaleId); } catch (Exception ex) { ex.ToString(); //throw; } }
// GET: LeadReport public ActionResult Index() { SaleEntities entities = new SaleEntities(); var list = from TBL_Leads in entities.TBL_Leads.Take(50) select TBL_Leads; return(View(list)); }
public Form1() { InitializeComponent(); using (SaleEntities db = new SaleEntities()) { fillData(db.Products.ToList()); } cmbName.Items.Add("Name"); cmbName.Items.Add("Price"); }
public DataTable DA_ProductDetails(SaleEntities objSaleDetails) { QueryProcessor objQuery = new QueryProcessor(); con.Open(); MySqlCommand cmd = new MySqlCommand(objQuery.GetProductByName, con); cmd.Parameters.AddWithValue("@Product", objSaleDetails.Product); MySqlDataAdapter da = new MySqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); con.Close(); return(dt); }
protected void Product_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt = new DataTable(); SaleEntities objSaleDetails = new SaleEntities(); objSaleDetails.Product = Product.SelectedItem.Value; BASaleMaster objSaleMasterBA = new BASaleMaster(); dt = objSaleMasterBA.BA_GetProductDetails(objSaleDetails); foreach (DataRow dr in dt.Rows) { Price.Text = dr["SaleRate"].ToString(); GSTPercentage.Text = dr["GST"].ToString(); } }
public int DAaddSaleDetails(SaleEntities objSaleDetails) { int ReturnValue = 0; try { con.Open(); MySqlCommand cmd = new MySqlCommand(objQuery.InsertSale, con); // cmd.Parameters.AddWithValue("@SaleId", objSaleDetails.SaleId); cmd.Parameters.AddWithValue("@BillNo", objSaleDetails.BillNo); cmd.Parameters.AddWithValue("@Date", objSaleDetails.Date); cmd.Parameters.AddWithValue("@CustomerName", objSaleDetails.CustomerName); cmd.Parameters.AddWithValue("@MobileNo", objSaleDetails.MobileNo); cmd.Parameters.AddWithValue("@EmailId", objSaleDetails.EmailId); cmd.Parameters.AddWithValue("@GSTNo", objSaleDetails.GSTNo); cmd.Parameters.AddWithValue("@Address", objSaleDetails.Address); cmd.Parameters.AddWithValue("@Price", objSaleDetails.Price); cmd.Parameters.AddWithValue("@Quantity", objSaleDetails.Quantity); cmd.Parameters.AddWithValue("@GSTType", objSaleDetails.GSTType); cmd.Parameters.AddWithValue("@GSTPercentage", objSaleDetails.GSTPercentage); cmd.Parameters.AddWithValue("@Total", objSaleDetails.Total); cmd.Parameters.AddWithValue("@PlaceToSupply", objSaleDetails.PlaceToSupply); cmd.Parameters.AddWithValue("@Transport", objSaleDetails.Transport); cmd.Parameters.AddWithValue("@OtherCharges", objSaleDetails.MobileNo); cmd.Parameters.AddWithValue("@RoundOff", objSaleDetails.RoundOff); cmd.Parameters.AddWithValue("@TotalAmount", objSaleDetails.TotalAmount); cmd.Parameters.AddWithValue("@Discount", objSaleDetails.Discount); cmd.Parameters.AddWithValue("@RupeesInWord", objSaleDetails.RupeesInWord); cmd.Parameters.AddWithValue("@Paymentmtd", objSaleDetails.Paymentmtd); //ReturnValue = Convert.ToInt32(cmd.ExecuteScalar()); cmd.ExecuteNonQuery(); ReturnValue = Convert.ToInt32(Convert.ToDouble(cmd.LastInsertedId)); } catch (Exception ex) { ex.ToString(); } finally { con.Close(); } return(ReturnValue); }
public HttpResponseMessage UpdateSale(SaleEntities model) { var Httpresponse = new HttpResponseMessage(); try { var id = GetEmployeeId(); if (!id.HasValue) { Httpresponse = new HttpResponseMessage(HttpStatusCode.Unauthorized); response.Code = HttpStatusCode.Unauthorized; response.Message = "Authorization has been denied for this request."; response.Result = null; Httpresponse.Content = new StringContent(JsonConvert.SerializeObject(response)); Httpresponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return(Httpresponse); } else { if (model == null) { Httpresponse = new HttpResponseMessage(HttpStatusCode.BadGateway); response.Code = HttpStatusCode.BadGateway; response.Message = "Bad Gateway"; response.Result = null; Httpresponse.Content = new StringContent(JsonConvert.SerializeObject(response)); Httpresponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return(Httpresponse); } else { var sale = context.Sale.FirstOrDefault(x => x.State == ConstantHelper.Status.ACTIVE && x.SaleId == model.saleId); sale.CodeGuide = model.codeGuide; sale.LocalId = model.localId; sale.ClientId = model.clientId; sale.PriceTotal = model.priceTotal; context.SaveChanges(); } Httpresponse = new HttpResponseMessage(HttpStatusCode.OK); response.Code = HttpStatusCode.OK; response.Message = "Success"; response.Result = null; } Httpresponse.Content = new StringContent(JsonConvert.SerializeObject(response)); Httpresponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return(Httpresponse); } catch { Httpresponse = new HttpResponseMessage(HttpStatusCode.BadGateway); response.Code = HttpStatusCode.BadGateway; response.Message = "Bad Gateway"; response.Result = null; Httpresponse.Content = new StringContent(JsonConvert.SerializeObject(response)); Httpresponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return(Httpresponse); } }
public HttpResponseMessage AddSale(SaleEntities model) { var Httpresponse = new HttpResponseMessage(); try { var id = GetEmployeeId(); if (!id.HasValue) { Httpresponse = new HttpResponseMessage(HttpStatusCode.Unauthorized); response.Code = HttpStatusCode.Unauthorized; response.Message = "Unautorized"; response.Result = null; Httpresponse.Content = new StringContent(JsonConvert.SerializeObject(response)); Httpresponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return(Httpresponse); } else { var sale = new Sale(); if (model == null) { Httpresponse = new HttpResponseMessage(HttpStatusCode.BadGateway); response.Code = HttpStatusCode.BadGateway; response.Message = "Bad Gateway"; response.Result = null; Httpresponse.Content = new StringContent(JsonConvert.SerializeObject(response)); Httpresponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return(Httpresponse); } else { context.Sale.Add(sale); sale.DateCreation = DateTime.Today; sale.CodeGuide = model.codeGuide; sale.LocalId = model.localId; sale.ClientId = model.clientId; sale.State = ConstantHelper.Status.ACTIVE; sale.StateDelivery = ConstantHelper.Status.ACTIVE; sale.CompanyId = model.companyId; context.SaveChanges(); } Httpresponse = new HttpResponseMessage(HttpStatusCode.OK); response.Code = HttpStatusCode.OK; response.Message = "Success"; response.Result = sale; } Httpresponse.Content = new StringContent(JsonConvert.SerializeObject(response)); Httpresponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return(Httpresponse); } catch (Exception ex) { Httpresponse = new HttpResponseMessage(HttpStatusCode.BadGateway); response.Code = HttpStatusCode.BadGateway; response.Message = "Bad Gateway"; response.Result = null; Httpresponse.Content = new StringContent(JsonConvert.SerializeObject(response)); Httpresponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return(Httpresponse); } }
public DataTable BA_GetProductDetails(SaleEntities objSaleDetails) { DASaleMaster objSaleDA = new DASaleMaster(); return(objSaleDA.DA_ProductDetails(objSaleDetails)); }
public DataTable BA_GetCustomersDetails(SaleEntities objCustomerdetails) { DASaleMaster objSaleDA = new DASaleMaster(); return(objSaleDA.DA_CustomerDetails(objCustomerdetails)); }
public int BA_ValidateSale(SaleEntities objSaledetails) { DASaleMaster objSaleDA = new DASaleMaster(); return(objSaleDA.DA_ValidateSale(objSaledetails)); }
protected void CustomerName_TextChanged(object sender, EventArgs e) { //string customername; DataTable dt = new DataTable(); SaleEntities objSaleDetails = new SaleEntities(); objSaleDetails.CustomerName = CustomerName.Text; BASaleMaster objSaleMasterBA = new BASaleMaster(); dt = objSaleMasterBA.BA_GetCustomersDetails(objSaleDetails); foreach (DataRow dr in dt.Rows) { MobileNo.Text = dr["MobileNo"].ToString(); EmailId.Text = dr["EmailId"].ToString(); GSTNo.Text = dr["CustomerGSTNo"].ToString(); Address.InnerText = dr["Address"].ToString(); } // try // { // DataTable Result = new DataTable(); // DataTable dt = new DataTable(); // //CustomerName.Text = dt.Rows[0][1] + "<br/>"; // //MobileNo.Text = dt.Rows[0][2] + "<br/>"; // //EmailId.Text = dt.Rows[0][3] + "<br/>"; // //GSTNo.Text = dt.Rows[0][4] + "<br/>"; // //Address.InnerText = dt.Rows[0][5] + "<br/>"; // //foreach (DataRow dr in dt.Rows) // //{ // // foreach (DataColumn dc in dt.Columns) // // { // // CustomerName.Text = dt.Rows[0][1] + "<br/>"; // // MobileNo.Text = dt.Rows[0][2] + "<br/>"; // // EmailId.Text = dt.Rows[0][3] + "<br/>"; // // GSTNo.Text = dt.Rows[0][4] + "<br/>"; // // Address.InnerText = dt.Rows[0][5] + "<br/>"; // // } // //} // } // catch (Exception ex) // { // ex.ToString(); // } //} //[WebMethod] //public static List<string> SearchUser(string prefixText) //{ // DataTable dt = new DataTable(); // BASaleMaster obj_BASale = new BASaleMaster(); // dt = obj_BASale.BA_SearchName(prefixText); // List<string> Output = new List<string>(); // for (int i = 0; i < dt.Rows.Count; i++) // { // Output.Add(dt.Rows[i][0].ToString()); // } // return Output; }