public Results<string> creatSoftReq(softwareInfo rn,upgrade up) { Results<string> result = new Results<string>(); try { HelperData h = new HelperData(); rn.userCode = Convert.ToInt16(System.Web.HttpContext.Current.Session["userCode"]); rn.deleted = false; up.deleted = false; Int16 t = h.AddSoftwareInfo(rn); if (t != 0) { result.IsSuccessfull = true; up.softwareCode = rn.softwareCode; h.AddUpgrade(up); } } catch (Exception error) { result.IsSuccessfull = false; result.Message = error.Message; } return result; }
public object createUpgrade(upgrade rn) { Results<string> result = new Results<string>(); try { HelperData h = new HelperData(); rn.deleted = false; bool t = h.AddUpgrade(rn); if (t ) { result.IsSuccessfull = true; } } catch (Exception error) { result.IsSuccessfull = false; result.Message = error.Message; } return result; }
public static string creatSoftUpgradeReq(softwareInfo rn,upgrade up) { AddSoftwareBLL asb = new AddSoftwareBLL(); return JsonConvert.SerializeObject(asb.creatSoftReq(rn,up)); }
//Edit Upgrade Table public int EditUpgrade(upgrade u) { try { var v = from i in db.upgrades where i.upgradeCode == u.upgradeCode select i; upgrade newupgrade = v.FirstOrDefault(); if(newupgrade != null) { newupgrade = u; db.SubmitChanges(); return 1; } return 0;//not found } catch (Exception error) { return -1; } }
//Add To Upgrade Table public bool AddUpgrade(upgrade u) { try { db.upgrades.InsertOnSubmit(u); db.SubmitChanges(); return true; } catch (Exception error) { return false; } }
partial void Deleteupgrade(upgrade instance);
partial void Updateupgrade(upgrade instance);
partial void Insertupgrade(upgrade instance);
private void detach_upgrades(upgrade entity) { this.SendPropertyChanging(); entity.vahedInfo = null; }
private void attach_upgrades(upgrade entity) { this.SendPropertyChanging(); entity.softwareInfo = this; }
//Edit Upgrade Table public int EditUpgrade(upgrade u) { try { var v = from i in db.upgrades where i.softwareCode == u.softwareCode select i; upgrade newupgrade = v.FirstOrDefault(); if (newupgrade != null) { newupgrade.description = u.description; newupgrade.vahedCode = u.vahedCode; newupgrade.softwareCode = u.softwareCode; newupgrade.deleted = u.deleted; newupgrade.upgradeDate = u.upgradeDate; db.SubmitChanges(); return 1; } return 0;//not found } catch (Exception error) { return -1; } }
public object updateUpgradeReq(upgrade rn) { Results<string> result = new Results<string>(); try { HelperData h = new HelperData(); rn.deleted = false; int t = h.EditUpgrade(rn); if (t != 0) { result.IsSuccessfull = true; // result.Value = rn.softwareCode.ToString(); } } catch (Exception error) { result.IsSuccessfull = false; result.Message = error.Message; } return result; }