public int SaveData(Hr_FinalFingerPrint objInsert) { StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); int RowEffected = 0; try { if (objInsert != null) { OpenEntityConnection(); objInsert.InsDate = DateTime.Now;//DateTime.Today; objInsert.Rec_Id = GetNewHeaderId(); objPharmaEntities.Hr_FinalFingerPrint.Add(objInsert); RowEffected = objPharmaEntities.SaveChanges(); } } catch (Exception ex) { RowEffected = -1; catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(), this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString()); ex.InnerException.Message.ToString(); } finally { CloseEntityConnection(); } return(RowEffected); }
public bool SaveUpdateData(List <UpdateFinalFingerPrintDL> ListDtls, string UserName) { StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); bool Result; try { OpenEntityConnection(); Result = true; foreach (UpdateFinalFingerPrintDL Obj_Dtls in ListDtls) { if (Obj_Dtls != null) { Hr_FinalFingerPrint loclDtlsUpdate = (from objLinq in objPharmaEntities.Hr_FinalFingerPrint where objLinq.Rec_Id == Obj_Dtls.Rec_Id select objLinq).FirstOrDefault(); if (loclDtlsUpdate != null) { if (Obj_Dtls.Row_Status == 1) { loclDtlsUpdate.InOutMode = Convert.ToString(Obj_Dtls.InOutMode); loclDtlsUpdate.UpdateFPStatus = 1; loclDtlsUpdate.UpdateDate = DateTime.Now; loclDtlsUpdate.UpdateUser = UserName; objPharmaEntities.SaveChanges(); // Result = (objPharmaEntities.SaveChanges() > 0); } // dbTran.Commit(); } } } return(Result); } catch (Exception ex) { Result = false; catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(), this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString()); ex.InnerException.Message.ToString(); return(false); } finally { CloseEntityConnection(); } }
public bool DeleteRow(Guid RowID) { StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); bool Result; try { OpenEntityConnection(); Result = true; if (RowID != Guid.Empty) { Hr_FinalFingerPrint loclDtlsDelete = (from objLinq in objPharmaEntities.Hr_FinalFingerPrint where objLinq.Rec_Id == RowID select objLinq).FirstOrDefault(); if (loclDtlsDelete != null) { objPharmaEntities.Hr_FinalFingerPrint.Remove(loclDtlsDelete); objPharmaEntities.SaveChanges(); Result = true; } else { Result = false;; } } return(Result); } catch (Exception ex) { Result = false; catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(), this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString()); ex.InnerException.Message.ToString(); return(false); } finally { CloseEntityConnection(); } }