public object creatReqVahed(vahedInfo vi) { Results<string> result = new Results<string>(); try { HelperData h = new HelperData(); int t = h.AddVahed(vi); if (t==1) { result.IsSuccessfull = true; } else if (t == 0) { result.Message = "خطا! فیلدی با این مشخصات قبلا ثبت شده است."; } } catch (Exception error) { result.IsSuccessfull = false; result.Message = error.Message; } return result; }
//Edit VahedInfo Table public int EditVahedInfo(vahedInfo vi) { try { var v = from i in db.vahedInfos where i.vahedCode == vi.vahedCode select i; vahedInfo newvahed = v.FirstOrDefault(); if(newvahed != null) { newvahed = vi; db.SubmitChanges(); return 1; } return 0;//not found } catch (Exception error) { return -1; } }
//Add to VahedInfo Table public int AddVahed(vahedInfo vi) { helperSearch h = new helperSearch(); try { if (h.checkUniqValue(vi.vahedName, vi.city)) { db.vahedInfos.InsertOnSubmit(vi); db.SubmitChanges(); return 1; } else return 0; } catch (Exception error) { return 3; } }
public static string creatReqVahed(vahedInfo rn) { VahedReqBLL fb = new VahedReqBLL(); return JsonConvert.SerializeObject(fb.creatReqVahed(rn)); }
partial void DeletevahedInfo(vahedInfo instance);
partial void UpdatevahedInfo(vahedInfo instance);
partial void InsertvahedInfo(vahedInfo instance);