コード例 #1
0
 public static int UpdateClient(int id, Clients client)
 {
     try
     {
         using (eLawyerEntities ve = new eLawyerEntities())
         {
             Clients updated = ve.Clients.FirstOrDefault(cl => cl.Id == id);
             if (updated != null)
             {
                 updated.Name              = client.Name;
                 updated.Lane              = client.Lane;
                 updated.Street            = client.Street;
                 updated.City              = client.City;
                 updated.StateId           = client.StateId;
                 updated.Zip               = client.Zip;
                 updated.Phone1            = client.Phone1;
                 updated.Phone2            = client.Phone2;
                 updated.Cell              = client.Cell;
                 updated.Email             = client.Email;
                 updated.Website           = client.Website;
                 updated.LastUpdated       = DateTime.Now;
                 updated.Logo              = client.Logo;
                 updated.ContentType       = updated.ContentType;
                 updated.ContractStartDate = client.ContractStartDate;
                 updated.ContractEndDate   = client.ContractEndDate;
                 return(ve.SaveChanges());
             }
         }
     }
     catch
     {
         return(0);
     }
     return(0);
 }
コード例 #2
0
        public static int EditPayment(Payments payment)
        {
            using (eLawyerEntities ele = new eLawyerEntities())
            {
                Payments oldPayment = ele.Payments.FirstOrDefault(p => p.Id == payment.Id);
                if (oldPayment != null)
                {
                    //oldPayment.ClientId=payment.ClientId
                    oldPayment.CaseId        = payment.CaseId;
                    oldPayment.PaidTo        = payment.PaidTo;
                    oldPayment.ExpenseHeadId = payment.ExpenseHeadId;
                    oldPayment.PaymentModeId = payment.PaymentModeId;
                    oldPayment.Date          = payment.Date;
                    oldPayment.CHQ_DATE      = payment.CHQ_DATE;
                    oldPayment.CHQ_NO        = payment.CHQ_NO;
                    oldPayment.Amounts       = payment.Amounts;
                    oldPayment.BANK          = payment.BANK;
                    oldPayment.Narration     = payment.Narration;
                    oldPayment.Remarks       = payment.Remarks;

                    return(ele.SaveChanges());
                }
                return(0);
            }
        }
コード例 #3
0
 public static int UpdateCaseinfo(Cases currentCase)
 {
     using (eLawyerEntities ele = new eLawyerEntities())
     {
         Cases oldCase = ele.Cases.FirstOrDefault(cs => currentCase.CaseNumber.Equals(cs.CaseNumber, StringComparison.OrdinalIgnoreCase));
         if (oldCase != null)
         {
             oldCase.CourtName          = currentCase.CourtName;
             oldCase.EnrollmentDate     = currentCase.EnrollmentDate;
             oldCase.FirstHearingDate   = currentCase.FirstHearingDate;
             oldCase.FirstParty         = currentCase.FirstParty;
             oldCase.FirstPartyAddress  = currentCase.FirstPartyAddress;
             oldCase.FirstPartyPhone    = currentCase.FirstPartyPhone;
             oldCase.SecondParty        = currentCase.SecondParty;
             oldCase.SecondPartyAddress = currentCase.SecondPartyAddress;
             oldCase.SecondPartyPhone   = currentCase.SecondPartyPhone;
             oldCase.Status             = currentCase.Status;
             oldCase.NextDate           = currentCase.NextDate;
             oldCase.LastUpdated        = currentCase.LastUpdated;
             oldCase.IsFromFirstParty   = currentCase.IsFromFirstParty;
             oldCase.IsFromSecondParty  = currentCase.IsFromSecondParty;
             oldCase.MyPartyName        = currentCase.MyPartyName;
             oldCase.MyPartyPhone       = currentCase.MyPartyPhone;
             oldCase.Description        = currentCase.Description;
             return(ele.SaveChanges());
         }
         return(0);
     }
 }
コード例 #4
0
 public static int CreatePayment(Payments payment)
 {
     using (eLawyerEntities deo = new eLawyerEntities())
     {
         if (payment != null)
         {
             deo.AddToPayments(payment);
             return(deo.SaveChanges());
         }
     }
     return(0);
 }
コード例 #5
0
 public static int AddPayment(Payments newPayments)
 {
     using (eLawyerEntities ele = new eLawyerEntities())
     {
         if (newPayments != null)
         {
             ele.AddToPayments(newPayments);
             return(ele.SaveChanges());
         }
         return(0);
     }
 }
コード例 #6
0
 public static int DeleteCaseHearingById(int id)
 {
     using (eLawyerEntities ele = new eLawyerEntities())
     {
         CaseHearings oldCaseHearing = ele.CaseHearings.FirstOrDefault(cs => cs.ID == id);
         if (oldCaseHearing != null)
         {
             oldCaseHearing.IsDeleted = true;
             return(ele.SaveChanges());
         }
         return(0);
     }
 }
コード例 #7
0
        public static int UpdateCaseHearing(CaseHearings caseHearing)
        {
            using (eLawyerEntities ele = new eLawyerEntities())
            {
                CaseHearings oldStudent = ele.CaseHearings.FirstOrDefault(st => st.ID == caseHearing.ID);

                if (oldStudent == null)
                {
                    return(-1);//Student record not found.
                }
                var updatedStudents = ele.ApplyCurrentValues(oldStudent.GetType().Name, caseHearing);
                return(ele.SaveChanges());
            }
        }
コード例 #8
0
 public static int CreateClient(Clients client)
 {
     try
     {
         using (eLawyerEntities ve = new eLawyerEntities())
         {
             ve.AddToClients(client);
             return(ve.SaveChanges());
         }
     }
     catch (Exception)
     {
         return(0);
     }
 }
コード例 #9
0
 public static int CreateNewCaseHearing(CaseHearings newHearing)
 {
     try
     {
         using (eLawyerEntities ele = new eLawyerEntities())
         {
             ele.AddToCaseHearings(newHearing);
             return(ele.SaveChanges());
         }
     }
     catch
     {
         return(0);
     }
 }
コード例 #10
0
 /// <summary>
 /// Enroll New Case
 /// </summary>
 /// <param name="newCase"></param>
 /// <returns></returns>
 public static int EnrollNewCase(Cases newCase)
 {
     using (eLawyerEntities ele = new eLawyerEntities())
     {
         Cases oldCase = ele.Cases.FirstOrDefault(cs => newCase.CaseNumber.Equals(cs.CaseNumber, StringComparison.OrdinalIgnoreCase));
         if (oldCase == null)
         {
             newCase.CreatedDate = DateTime.Now.Date;
             newCase.LastUpdated = DateTime.Now.Date;
             newCase.IsActive    = true; // intially a case will be assumed as a active case.
             ele.AddToCases(newCase);
             return(ele.SaveChanges());
         }
         return(0);
     }
 }
コード例 #11
0
 public static int DeleteLedgerByLedgerId(int id)
 {
     using (eLawyerEntities islObject = new eLawyerEntities())
     {
         Payments payment = islObject.Payments.FirstOrDefault(pmt => pmt.ExpenseHeadId == id);
         if (payment == null)
         {
             EXPENSESHEAD ledger = islObject.EXPENSESHEAD.FirstOrDefault(rk => rk.Id == id);
             if (ledger != null)
             {
                 islObject.DeleteObject(ledger);
                 return(islObject.SaveChanges());
             }
         }
         return(0);
     }
 }
コード例 #12
0
 //=====================================================================
 #region Ledgers
 public static int CreateLedger(EXPENSESHEAD ledger)
 {
     using (eLawyerEntities deo = new eLawyerEntities())
     {
         EXPENSESHEAD oldLedger = deo.EXPENSESHEAD.FirstOrDefault(exp => exp.ClientId == ledger.ClientId && ledger.CODE.Equals(exp.CODE, StringComparison.OrdinalIgnoreCase));
         if (oldLedger != null)
         {
             return(0);
         }
         else
         {
             if (ledger != null)
             {
                 deo.AddToEXPENSESHEAD(ledger);
                 return(deo.SaveChanges());
             }
         }
     }
     return(0);
 }
コード例 #13
0
 public static int UpdateLedger(int ledgerId, EXPENSESHEAD newledger)
 {
     using (eLawyerEntities deo = new eLawyerEntities())
     {
         EXPENSESHEAD oldLedger = deo.EXPENSESHEAD.FirstOrDefault(exp => newledger.CODE.Equals(exp.CODE, StringComparison.OrdinalIgnoreCase));
         if (oldLedger != null)
         {
             EXPENSESHEAD oldledger = deo.EXPENSESHEAD.FirstOrDefault(rk => rk.Id == ledgerId);
             if (oldledger != null && newledger != null)
             {
                 oldledger.CODE         = newledger.CODE;
                 oldledger.NAME         = newledger.NAME;
                 oldledger.LedgerTypeId = newledger.LedgerTypeId;
                 oldledger.OP_BAL       = newledger.OP_BAL;
                 return(deo.SaveChanges());
             }
         }
         else
         {
             return(0);
         }
     }
     return(0);
 }