private static GLLines getEntityByModel(GLLinesModel model, decimal conversionRate)
        {
            if (model == null) return null;

            GLLines entity = new GLLines();
            entity.Id = model.Id;
            entity.HeaderId = model.HeaderId;
            entity.CodeCombinationId = model.CodeCombinationId;
            entity.Description = model.Description;
            entity.EnteredCr = model.EnteredCr;
            entity.EnteredDr = model.EnteredDr;
            entity.AccountedCr = model.EnteredCr * conversionRate;
            entity.AccountedDr = model.EnteredDr * conversionRate;
            entity.Qty = model.Quantity;
            entity.TaxRateCode = model.TaxRateCode;
            if (model.Id == 0)
            {
                entity.CreateBy = AuthenticationHelper.UserId;
                entity.CreateDate = DateTime.Now;
            }
            else
            {
                entity.CreateBy = model.CreateBy;
                entity.CreateDate = model.CreateDate;
            }
            entity.UpdateBy = AuthenticationHelper.UserId;
            entity.UpdateDate = DateTime.Now;
            return entity;
        }
 public static void DeleteGLLine(GLLinesModel model)
 {
     GLHeaderModel header = SessionHelper.JV;
     GLLinesModel glLine = header.GlLines.FirstOrDefault(x => x.Id == model.Id);
     header.GlLines.Remove(glLine);
 }
 public static void Insert(GLLinesModel model)
 {
     GLHeaderModel header = SessionHelper.JV;
     header.GlLines.Add(model);
 }
 public static void UpdateGLLine(GLLinesModel model)
 {
     GLHeaderModel header = SessionHelper.JV;
     header.GlLines.FirstOrDefault(x => x.Id == model.Id).AccountedCr = model.AccountedCr;
     header.GlLines.FirstOrDefault(x => x.Id == model.Id).AccountedDr = model.AccountedDr;
     header.GlLines.FirstOrDefault(x => x.Id == model.Id).CodeCombinationId = model.CodeCombinationId;
     header.GlLines.FirstOrDefault(x => x.Id == model.Id).Description = model.Description;
     header.GlLines.FirstOrDefault(x => x.Id == model.Id).EnteredCr = model.EnteredCr;
     header.GlLines.FirstOrDefault(x => x.Id == model.Id).EnteredDr = model.EnteredDr;
     header.GlLines.FirstOrDefault(x => x.Id == model.Id).Quantity = model.Quantity;
     header.GlLines.FirstOrDefault(x => x.Id == model.Id).TaxRateCode = model.TaxRateCode;
 }