public ActionResult AsiDuzenleKaydet(FormCollection f) { try { int id = Convert.ToInt32(f.Get("eId")); string adi = f.Get("eAdi"); if (String.IsNullOrEmpty(adi)) { return(hata("Aşı düzenlenemedi. Lütfen gerekli alanların doldurulduğundan emin olup tekrar deneyin")); } string kontrendikasyon = f.Get("eKontrendikasyon"); int minyas = Convert.ToInt32(f.Get("eMinUygulamaYasi")); int maxyas = Convert.ToInt32(f.Get("eMaxUygulamaYasi")); int periyod = Convert.ToInt32(f.Get("eIslemPeriyodu")); DateTime degistirmeTarihi = DateTime.Now; Asi eski = db.Asis.Find(id); eski.Adi = adi; eski.Kontrendikasyon = kontrendikasyon; eski.MinUygulamaYasi = minyas; eski.MaxUygulamaYasi = maxyas; eski.IslemPeriyodu = periyod; eski.DuzenlenmeTarihi = degistirmeTarihi; db.SaveChanges(); return(onayyenile("Aşı başarıyla düzenlendi")); } catch { } return(hata("Aşı düzenlenemedi. Lütfen gerekli alanların doldurulduğundan emin olup tekrar deneyin")); }
public ActionResult AsiDetay(int?id) { try { Asi asi = db.Asis.Find(id); return(View(asi)); } catch { } return(RedirectToAction("Asilar")); }
public JavaScriptResult AsiSil(int?id) { try { Asi asi = db.Asis.Find(id); db.Asis.Remove(asi); db.SaveChanges(); return(onayyenile("Aşı başarıyla silindi")); } catch { } return(hata("Aşı silinirken bir hata meydana geldi. Bu aşıyı yaptığınız birisi varsa silemezsiniz. Önce o kayıtların silinmesi gerekiyor")); }
public JavaScriptResult YeniAsiKaydet(Asi asi) { try { asi.EklenmeTarihi = DateTime.Now; db.Asis.Add(asi); db.SaveChanges(); return(onayyenile("Aşı başarıyla kaydedildi")); } catch { } return(hata("Aşı kaydedilemedi. Lütfen gerekli alanların doldurulduğundan emin olup tekrar deneyin")); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Initialization(); } else { // after a post back return to the position as before Page.MaintainScrollPositionOnPostBack = true; // restore value if (ViewState["Value"] != null) { value = (BPvalues[])ViewState["Value"]; } asi = (Asi)Session["ASI"]; bp = (BPconnect)Session["BPconnect"]; } }
/* a method that add text and value to the drop down list */ private void Initialization() { // initialize grid view DataTable table = new DataTable(); table.Columns.Add("SKU", typeof(string)); table.Columns.Add("Short Description", typeof(string)); table.Columns.Add("Gift Box", typeof(bool)); table.Columns.Add("Quantity", typeof(int)); table.Columns.Add("Base Price", typeof(double)); table.Columns.Add("Pricing Tier", typeof(int)); gridview.DataSource = table; gridview.DataBind(); ViewState["DataTable"] = table; #region Drop Down List // local field for storing data List <ListItem> list = new List <ListItem> { new ListItem("") }; // adding SKUs to the dropdown list using (SqlConnection connection = new SqlConnection(Properties.Settings.Default.Designcs)) { SqlCommand command = new SqlCommand("SELECT SKU_Ashlin, Short_Description, GiftBox, Base_Price, Pricing_Tier FROM master_SKU_Attributes sku " + "INNER JOIN master_Design_Attributes design ON design.Design_Service_Code = sku.Design_Service_Code " + "WHERE sku.Active = 'True' and Design_Service_Flag = 'Design'", connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { list.Add(new ListItem(reader.GetString(0), reader.GetString(1) + ';' + reader.GetBoolean(2) + ';' + reader.GetValue(3) + ';' + reader.GetInt32(4))); } } skuDropdownlist.DataSource = list; skuDropdownlist.DataTextField = "Text"; skuDropdownlist.DataValueField = "Value"; skuDropdownlist.DataBind(); // declare BPconnect object for staff search and reset list bp = new BPconnect(); list.Clear(); // get staff dictionary Dictionary <string, string> dic = bp.GetStaff(); // put staff into dropboxlist list.AddRange(dic.Select(pair => new ListItem(pair.Value, pair.Key))); staffDropdownlist.DataSource = list; staffDropdownlist.DataTextField = "Text"; staffDropdownlist.DataValueField = "Value"; staffDropdownlist.DataBind(); #endregion // set default delivery date dateDeliveryTextbox.Text = DateTime.Today.AddDays(30).ToString("yyyy-MM-dd"); // add confirm attribute to buttons clearScreenLinkButton.Attributes.Add("onclick", "javascript:return confirm('Are you sure you want to clear all the information on the page?');"); quoteButton.Attributes.Add("onclick", "javascript:return confirm('Are you sure you want to create the quote for this order?');this.disabled=true;" + ClientScript.GetPostBackEventReference(quoteButton, null) + ';'); #region Session Declaration try { // initialize ASI object and store it if (Session["ASI"] == null) { Session["ASI"] = new Asi(); } } catch (System.Net.WebException ex) { // the case if there is error from asi -> disable asi function asiTextbox.Text = ((System.Net.HttpWebResponse)ex.Response).StatusDescription; asiTextbox.Enabled = false; asiNextButton.Enabled = false; } // initialize BPconnect object and store it if (Session["BPconnect"] == null) { Session["BPconnect"] = bp; } #endregion // check if the user has cookies login if (Request.Cookies["Login"] != null) { Application["USERNAME"] = Request.Cookies["Login"].Value; welcomePopup.Show(); } else { // the case has no cookies login -> show login panel for login loginPopup.Show(); } }