public int InsertActType(SMIM_AccountType_ST actype) { try { db.Configuration.ProxyCreationEnabled = false; #region Close Max Account ID /*SMIM_AccountType_ST*/ //int maxActId = 0; //if (db.SMIM_AccountType_ST.Count() > 0) //{ // maxActId = db.SMIM_AccountType_ST.Select(x => x.ID).Max(); //} //maxActId = maxActId + 1; //actype.ID = maxActId; #endregion db.SMIM_AccountType_ST.Add(actype); db.SaveChanges(); return(actype.ID); } catch (Exception ex) { throw ex; //return 0; } }
public int DeleteActType(SMIM_AccountType_ST actype) { try { db.Configuration.ProxyCreationEnabled = false; db.Entry(actype).State = EntityState.Deleted; db.SaveChanges(); return(Convert.ToInt32(actype.ID)); } catch (Exception ex) { throw ex; //return 0; } }
public ActionResult AccountType(int?user, SMIM_AccountType_ST actype) { try { string strMessage = ""; bool _success = false; if (actype.ID > 0) { actype.IDSpecified = true; int maxValue = dbUser.UpdateActType(actype); if (maxValue > 0) { strMessage = "Record successfully updated."; _success = true; } else { strMessage = "Application server error."; } } else { actype.IDSpecified = true; int maxValue = dbUser.InsertActType(actype); actype.ID = maxValue; if (maxValue > 0) { strMessage = "Record successfully saved."; _success = true; } else { strMessage = "Application server error."; } } return(Json(new { success = _success, response = strMessage })); } catch (Exception ex) { Log.LogWrite(ex.Message, "Account Type Insert/Edit", ex); return(Json(new { success = false, response = ex.Message.ToString() })); } }
public int DeleteActType(SMIM_AccountType_ST actype) { try { dbUser.Timeout = System.Threading.Timeout.Infinite; int _ActiD = 0; bool specified = false; dbUser.DeleteActType(actype, out _ActiD, out specified); dbUser.Dispose(); dbUser.Abort(); return(Convert.ToInt32(actype.ID)); } catch (Exception ex) { dbUser.Dispose(); dbUser.Abort(); throw ex; } }
public int InsertActType(SMIM_AccountType_ST actype) { try { dbUser.Timeout = System.Threading.Timeout.Infinite; int _ActiD = 0; bool specified = false; dbUser.InsertActType(actype, out _ActiD, out specified); //out _Bankid, dbUser.Dispose(); dbUser.Abort(); return(_ActiD); } catch (Exception ex) { dbUser.Dispose(); dbUser.Abort(); throw ex; } }