public int AddGradeInfo(gradeInfo gr) { HelperSearch h = new HelperSearch(); try { if (h.checkUniqGrade(gr.gradeName) == 1) { gr.deleted = false; db.gradeInfos.InsertOnSubmit(gr); db.SubmitChanges(); return gr.gradeCode; } else { return 0; } } catch (Exception error) { return 3; } }
partial void DeletegradeInfo(gradeInfo instance);
partial void UpdategradeInfo(gradeInfo instance);
partial void InsertgradeInfo(gradeInfo instance);
public object saveReqGrade(gradeInfo gr) { Results<string> result = new Results<string>(); try { HelperData h = new HelperData(); gr.deleted = false; int postCode = h.AddGradeInfo(gr); if (postCode != 0) { result.IsSuccessfull = true; } else { result.Message = "خطا! مقطع تحصیلی با این نام قبلا در سیستم ثبت شده است"; } } catch (Exception error) { result.IsSuccessfull = false; result.Message = error.Message; // reservDB.Transaction.Rollback(); } return result; }
public static string saveReqGrade(gradeInfo gr) { manageBLL mb = new manageBLL(); return JsonConvert.SerializeObject(mb.saveReqGrade(gr)); }