public bool DeleteCastody(Guid RowId) { StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); try { OpenEntityConnection(); int Result = 0; if (RowId != null && RowId != Guid.Empty) { Hr_EmpCustodies ObjForDelete = (from objLinq in objPharmaEntities.Hr_EmpCustodies where objLinq.Hdr_Id == RowId select objLinq).FirstOrDefault(); if (ObjForDelete != null) { objPharmaEntities.Hr_EmpCustodies.Remove(ObjForDelete); objPharmaEntities.SaveChanges(); return(Result > 0); } else { return(Result < 0); } } else { return(Result < 0); } } catch (Exception ex) { 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 SaveTransferData(EmpCastodyDL ObjTransferCastodyDL) { StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); var strErrorMessage = string.Empty; bool result = true; try { OpenEntityConnection(); if (ObjTransferCastodyDL != null) { if (ObjTransferCastodyDL.Hdr_Id != Guid.Empty && ObjTransferCastodyDL.Hdr_Id != null) { //Hr_EmpCustodies_History EmpCustodies = new Hr_EmpCustodies_History //{ // Hdr_Id = ObjTransferCastodyDL.Hdr_Id, // //Rec_Id = GetNewRec_Id(), // Company_Id = ObjTransferCastodyDL.Company_Id, // Branch_Id = ObjTransferCastodyDL.Branch_Id, // Emp_Serial_No = ObjTransferCastodyDL.Emp_Serial_No, // Emp_Serial_No_New = ObjTransferCastodyDL.Emp_Serial_No_New, // Transdate = ObjTransferCastodyDL.Transdate, // Custody_Id = ObjTransferCastodyDL.Custody_Id, // Custody_Serial_No = ObjTransferCastodyDL.Custody_Serial_No, // Custody_Status = ObjTransferCastodyDL.Custody_Status, // Custody_Status_New = ObjTransferCastodyDL.Custody_Status_New, // Custody_Desc = ObjTransferCastodyDL.Custody_Desc, // Custody_Note = ObjTransferCastodyDL.Custody_Note, // Received_Date = ObjTransferCastodyDL.Received_Date, // // Delivery_Date = ObjEmpCastodyDL.Delivery_Date, // Ins_User = UserNameProperty, // Ins_Date = DateTime.Now //}; //objPharmaEntities.Hr_EmpCustodies_History.Add(EmpCustodies); //objPharmaEntities.SaveChanges(); //return result; Hr_EmpCustodies ObjForUpdate = (from objLinq in objPharmaEntities.Hr_EmpCustodies where objLinq.Hdr_Id == ObjTransferCastodyDL.Hdr_Id select objLinq).FirstOrDefault(); if (ObjForUpdate != null) { ObjForUpdate.Emp_Serial_No = ObjTransferCastodyDL.Emp_Serial_No; ObjForUpdate.Transdate = ObjTransferCastodyDL.Transdate; ObjForUpdate.Received_Date = ObjTransferCastodyDL.Received_Date; ObjForUpdate.Custody_Status = ObjTransferCastodyDL.Custody_Status; ObjForUpdate.Custody_Desc = ObjTransferCastodyDL.Custody_Desc; ObjForUpdate.Custody_Note = ObjTransferCastodyDL.Custody_Note; objPharmaEntities.SaveChanges(); return(result); } else { return(false); } } else { return(false); } } else { return(false); } } catch (Exception ex) { 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(); } return(result); }
public bool SaveEmpCastodyData(EmpCastodyDL ObjEmpCastodyDL) { StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); var strErrorMessage = string.Empty; bool result = true; try { OpenEntityConnection(); // result = AddShiftGroup(ObjGroupD); if (ObjEmpCastodyDL != null) { if (ObjEmpCastodyDL.Hdr_Id == Guid.Empty || ObjEmpCastodyDL.Hdr_Id == null) { if (ObjEmpCastodyDL.IsEdit == 0) { Hr_EmpCustodies EmpCustodies = new Hr_EmpCustodies { Hdr_Id = GetNewHeaderId(), Rec_Id = GetNewRec_Id(), Company_Id = ObjEmpCastodyDL.Company_Id, Branch_Id = ObjEmpCastodyDL.Branch_Id, Emp_Serial_No = ObjEmpCastodyDL.Emp_Serial_No, Transdate = ObjEmpCastodyDL.Transdate, Custody_Id = ObjEmpCastodyDL.Custody_Id, Custody_Serial_No = ObjEmpCastodyDL.Custody_Serial_No, Custody_Status = ObjEmpCastodyDL.Custody_Status, Custody_Desc = ObjEmpCastodyDL.Custody_Desc, Custody_Note = ObjEmpCastodyDL.Custody_Note, Received_Date = ObjEmpCastodyDL.Received_Date, // Delivery_Date = ObjEmpCastodyDL.Delivery_Date, Ins_User = UserNameProperty, Ins_Date = DateTime.Now }; objPharmaEntities.Hr_EmpCustodies.Add(EmpCustodies); objPharmaEntities.SaveChanges(); return(result); } } //return result; else { if (ObjEmpCastodyDL.IsEdit == 1) { Hr_EmpCustodies ObjForUpdate = (from objLinq in objPharmaEntities.Hr_EmpCustodies where objLinq.Hdr_Id == ObjEmpCastodyDL.Hdr_Id select objLinq).FirstOrDefault(); if (ObjForUpdate != null) { ObjForUpdate.Emp_Serial_No = ObjEmpCastodyDL.Emp_Serial_No; ObjForUpdate.Custody_Id = ObjEmpCastodyDL.Custody_Id; ObjForUpdate.Transdate = ObjEmpCastodyDL.Transdate; ObjForUpdate.Received_Date = ObjEmpCastodyDL.Received_Date; ObjForUpdate.Custody_Serial_No = ObjEmpCastodyDL.Custody_Serial_No; ObjForUpdate.Custody_Status = ObjEmpCastodyDL.Custody_Status; ObjForUpdate.Custody_Desc = ObjEmpCastodyDL.Custody_Desc; ObjForUpdate.Custody_Note = ObjEmpCastodyDL.Custody_Note; objPharmaEntities.SaveChanges(); return(result); } } } } else { result = false; } } catch (Exception ex) { 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(); } return(result); }