protected void dropCategory_SelectedIndexChanged(object sender, EventArgs e) { try { dropCategory.DataSource = null; dropMedicine.DataSource = null; lblMessage.Text = ""; if (dropMedicine.SelectedValue != null) { var item = new SealsModels(); int Id = Convert.ToInt32(dropCategory.SelectedValue); var items = _sealsManager.GetCatToMedicine(Id); dropMedicine.DataSource = items; dropMedicine.DataTextField = "Name"; dropMedicine.DataValueField = "Id"; dropMedicine.SelectedIndex = -1; dropMedicine.DataBind(); dropMedicine.Items.Insert(0, new ListItem("Select Medicine", "0")); } } catch (Exception en) { lblMessage.Text = en.Message; } }
public bool AddPerSave(SealsModels p) { try { var query = "INSERT INTO tbl_Seals (CustomerName,Code,Date,Total,Discount,PaymentMathod,GrandTotal,Statas) VALUES('" + p.CustomerName + "','" + p.Code + "','" + p.Date + "','" + p.Total + "','" + p.Discount + "','" + p.PaymentMathod + "','" + p.GrandTotal + "','" + p.Statas + "')"; var rowAffected = _pharmaDb.ExecuteNonQuery(query, _connectionString); return(rowAffected > 0); } catch (Exception e) { throw new Exception(e.Message); } }
protected void dropMedicine_SelectedIndexChanged(object sender, EventArgs e) { try { lblMessage.Text = ""; if (dropMedicine.SelectedValue != null) { var item = new SealsModels(); string Medicine = (dropMedicine.SelectedItem.ToString()); var reader = _sealsManager.GetPricee(Medicine); if (reader.HasRows) { while (reader.Read()) { lblPrice.Text = Convert.ToInt32(reader["SellingPrice"]).ToString(); } } } SealsModels stock = new SealsModels(); string Quantuity = (dropMedicine.SelectedItem.ToString()); var reader1 = _sealsManager.GetPricee(Quantuity); if (reader1.HasRows) { while (reader1.Read()) { var courseNames = reader1["Quantity"].ToString(); if (String.IsNullOrEmpty(courseNames)) { lblQuantity.Text = 0.ToString(); return; } lblQuantity.Text = courseNames; } } } catch (Exception exception) { lblMessage.Text = exception.Message; } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (TxtName.Text == "" || txtCode.Text == "" || lblAmmount.Text == "" || txtDis.Text == "" || dropMathod.SelectedValue == "" || txtGranf.Text == "" || dropStatus.SelectedValue == "") { string validationMessage = "Please fillup Required fields"; lblTotalMessage.Text = validationMessage; return; } var SealsModels = new SealsModels(); SealsModels.CustomerName = TxtName.Text; SealsModels.Code = txtCode.Text; SealsModels.Date = Convert.ToDateTime(txtDate.Text).ToShortDateString(); SealsModels.Total = Convert.ToInt32(lblAmmount.Text); SealsModels.Discount = Convert.ToInt32(txtDis.Text); SealsModels.PaymentMathod = dropMathod.SelectedItem.ToString(); SealsModels.GrandTotal = Convert.ToInt32(txtGranf.Text); SealsModels.Statas = dropStatus.SelectedValue; var isSave = _sealsManager.AddPerSave(SealsModels); if (isSave) { string successMessage = " Saved Successfully"; lblTotalMessage.Text = successMessage; lblTotalMessage.ForeColor = Color.Yellow; Response.Redirect("ShalseViews"); clear(); return; } string failMessage = "Fild Not Saved "; lblTotalMessage.Text = failMessage; } catch (Exception exception) { lblTotalMessage.Text = exception.Message; } }
public bool AddPerSave(SealsModels p) { var save = _purchaseRepository.AddPerSave(p); return(save); }