コード例 #1
0
        private void Edit(int id)
        {
            var obj = WorkInstance.Find(f => f.id == id && f.Deleted == false);

            if (null == obj)
            {
                ShowNotification("../service/as_work_dispatch.aspx", "No work exist.", false);
            }
            else
            {
                WorkInstance.Update(f => f.id == id && f.Deleted == false, act =>
                {
                    act.Description = description.Value;
                    act.Director    = director.Value.Trim();
                    if (!string.IsNullOrEmpty(end1.Value))
                    {
                        act.ScheduleEnd = DateTime.Parse(end1.Value.Trim());
                    }
                    if (!string.IsNullOrEmpty(start1.Value.Trim()))
                    {
                        act.ScheduleStart = DateTime.Parse(start1.Value);
                    }
                    act.Title = title.Value.Trim();
                });

                SaveHistory(new TB_AccountHistory()
                {
                    ActionId = ActionInstance.Find(f => f.Name.Equals("EditWork")).id,
                    ObjectA  = WorkInstance.ToString(obj)
                });

                ShowNotification("../service/as_work_dispatch.aspx", "The work has changed.");
            }
        }
コード例 #2
0
        private void ShowWorks()
        {
            var now   = DateTime.Now;
            var then  = now.AddDays(-5);
            var time1 = start.Value;

            if (!string.IsNullOrEmpty(time1))
            {
                then = DateTime.Parse(time1 + " 00:00:00");
            }
            var time2 = end.Value;

            if (!string.IsNullOrEmpty(time2))
            {
                now = DateTime.Parse(time2 + " 23:59:59");
            }

            var totalRecords = 0;
            var pageIndex    = "" == hidPageIndex.Value ? 1 : int.Parse(hidPageIndex.Value);
            var list         = WorkInstance.FindPageList <TB_Work>(pageIndex, PageSize, out totalRecords,
                                                                   f => f.ScheduleStart >= then && f.ScheduleStart <= now && f.Deleted == false, null);
            var totalPages = totalRecords / PageSize + (totalRecords % PageSize > 0 ? 1 : 0);

            string html = "";

            if (totalRecords < 1)
            {
                html = "<tr><td colspan=\"8\">No records.</td></tr>";
            }
            else
            {
                var cnt = (pageIndex - 1) * PageSize;
                foreach (var obj in list)
                {
                    cnt++;
                    var id = Utility.UrlEncode(Utility.Encrypt(obj.id.ToString()));
                    html += "<tr>" +
                            "<td style=\"text-align: center; height: 25px;\">" + cnt + "</td>" +
                            "<td>" + obj.RegisterTime.Value.ToString("yyyy/MM/dd") + "</td>" +
                            "<td>" + obj.ScheduleStart.Value.ToString("yyyy/MM/dd") + "</td>" +
                            "<td>" + obj.ScheduleEnd.Value.ToString("yyyy/MM/dd") + "</td>" +
                            "<td>" + obj.Director + "</td>" +
                            "<td style=\"text-align: center;\">" + obj.TB_WorkDetail.Count + "</td>" +
                            "<td class=\"textoverflow\" style=\"text-align: left;\" data-data=\"" +
                            obj.Description + "\"><a data-content=\"" + obj.Description.Replace("\r\n", "<br />") +
                            "\" title=\"Description:\" data-toggle=\"popover\" href=\"./as_work_details.aspx?key=" +
                            id + "\">" + obj.Title + "</a></td>" +
                            "<td></td>" +
                            "</tr>";
                }
            }
            tbodyBody.InnerHtml  = html;
            divPagging.InnerHtml = "";
            if (totalRecords > 0)
            {
                ShowPaggings(pageIndex, totalPages, totalRecords, "./as_work_dispatch.aspx", divPagging);
            }
        }
コード例 #3
0
        private void btnPunch_Click(object sender, EventArgs e)
        {
            punchOut.Text = $"Clocking...";
            DateTime date;

            try
            {
                using (SQLiteConnection connection = SqlConnectionFactory.GetSQLiteConnectionWithLock())
                {
                    if (DateTime.TryParse(dateDate.Text.ToString(), out date) && (IsClockIn.Checked || IsClockOut.Checked))
                    {
                        //makesure valid punch
                        WorkInstance wi = connection.Table <WorkInstance>().Last();
                        if (IsClockIn.Checked)
                        {
                            if (wi.ClockIn != wi.ClockOut)
                            {
                                DateTime timein     = new DateTime(date.Year, date.Month, date.Day, timePickIn.Hour, timePickIn.Minute, 0);
                                DateTime timeout    = new DateTime(date.Year, date.Month, date.Day, timePickOut.Hour, timePickOut.Minute, 0);
                                var      hourlyRate = (connection.Table <HourlyRate>().Last()).Rate;
                                connection.Insert(new WorkInstance()
                                {
                                    Date       = date,
                                    IsValid    = true,
                                    ClockIn    = MainActivity.GetLocalTime(timein),
                                    ClockOut   = IsClockOut.Checked ? MainActivity.GetLocalTime(timeout) : MainActivity.GetLocalTime(timein),
                                    HourlyRate = hourlyRate,
                                });
                                punchOut.Text = $"You are clocked!";
                            }
                            else
                            {
                                punchOut.Text = $"You still need to clock out from last clock in {wi.ClockIn.ToLongTimeString()}";
                            }
                        }
                        else if (IsClockOut.Checked)
                        {
                            if (wi.ClockIn == wi.ClockOut)
                            {
                                DateTime timeout = new DateTime(date.Year, date.Month, date.Day, timePickOut.Hour, timePickOut.Minute, 0);
                                wi.ClockOut = MainActivity.GetLocalTime(timeout);
                                connection.Update(wi);
                                punchOut.Text = $"You are clocked!";
                            }
                            else
                            {
                                punchOut.Text = $"You are not clocked in";
                            }
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                punchOut.Text = Ex.Message;
            }
            punchOut.Text += "  ||";
        }
コード例 #4
0
 public void OnClockPunchButtonsPushed(Button ib, EventArgs e)
 {
     using (SQLiteConnection connection = SqlConnectionFactory.GetSQLiteConnectionWithLock())
     {
         WorkInstance wi = null;
         OUT = Resource.Id.btnClockOut == ib.Id;
         try
         {
             wi = connection.Table <WorkInstance>().Last();
         }
         catch (Exception)
         {
         }
         if (wi != null)
         {
             if (OUT)
             {
                 if ((wi.ClockOut != wi.ClockIn))
                 {
                     ClockInOut_Success = false;
                     output            += "Need To CLOCK IN first";
                     SetOutput(output);
                     return;
                 }
                 ClockInOut_Success = EmailTaskMethod();
             }
             else
             {
                 if ((wi.ClockOut == wi.ClockIn))
                 {
                     ClockInOut_Success = false;
                     output            += "Need To CLOCK OUT first";
                     SetOutput(output);
                     return;
                 }
                 ClockInOut_Success = EmailTaskMethod();
             }
         }
         else
         {
             ClockInOut_Success = EmailTaskMethod();
         }
     }
     if (ClockInOut_Success)
     {
         output += "   seemed successful..";
     }
     else
     {
         output += "   something broke..";
     }
 }
コード例 #5
0
        public WorkInstanceDetailPage()
        {
            InitializeComponent();

            var item = new WorkInstance
            {
                Date    = DateTime.UtcNow.AddMonths(23),
                Comment = "This is Workinstabnce description."
            };

            viewModel      = new WorkInstanceDetailViewModel(item);
            BindingContext = viewModel;
        }
コード例 #6
0
        protected async override void OnStart()
        {
            var dbFolder   = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            var fileName   = "WorkInTest.db";
            var dbFullPath = Path.Combine(dbFolder, fileName);

            try
            {
                using (var db = new WorkInstanceContext(dbFullPath))
                {
                    await db.Database.MigrateAsync(); //We need to ensure the latest Migration was added. This is different than EnsureDatabaseCreated.


                    if (db.WorkInstances == null || await db.WorkInstances.CountAsync() < 3)
                    {
                        WorkInstance WorkInstanceGary = new WorkInstance()
                        {
                            Oid = 1, Date = DateTime.Now, HourlyRate = new HourlyRate(17.5f)
                        };
                        WorkInstance WorkInstanceJack = new WorkInstance()
                        {
                            Oid = 2, Date = DateTime.UtcNow, HourlyRate = new HourlyRate(18.5f)
                        };
                        WorkInstance WorkInstanceLuna = new WorkInstance()
                        {
                            Oid = 3, Date = DateTime.Now + TimeSpan.FromDays(987), HourlyRate = new HourlyRate(20)
                        };

                        List <WorkInstance> WorkInstancesInTheHat = new List <WorkInstance>()
                        {
                            WorkInstanceGary, WorkInstanceJack, WorkInstanceLuna
                        };

                        await db.WorkInstances.AddRangeAsync(WorkInstancesInTheHat);

                        await db.SaveChangesAsync();
                    }

                    var WorkInstancesInTheBag = await db.WorkInstances.ToListAsync();

                    foreach (var WorkInstance in WorkInstancesInTheBag)
                    {
                        Console.WriteLine($"{WorkInstance.Oid} - {WorkInstance.Date} - {WorkInstance.HourlyRate}" + System.Environment.NewLine);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
コード例 #7
0
        private void ShowWorkInfo()
        {
            var id   = ParseInt(Utility.Decrypt(hidKey.Value));
            var work = WorkInstance.Find(f => f.id == id && f.Deleted == false);

            if (null != work)
            {
                var ymd = "yyyy/MM/dd";
                workinfo.Rows[1].Cells[1].InnerText = work.Title;
                workinfo.Rows[2].Cells[1].InnerText = work.RegisterTime.Value.ToString(ymd);
                workinfo.Rows[3].Cells[1].InnerText = work.ScheduleStart.Value.ToString(ymd) + " - " + work.ScheduleEnd.Value.ToString(ymd);
                workinfo.Rows[4].Cells[1].InnerText = work.Director;
                workinfo.Rows[5].Cells[1].InnerText = work.TB_WorkDetail.Count.ToString();
                workinfo.Rows[6].Cells[1].InnerHtml = work.Description.Replace("\r\n", "<br />");
            }
            ShowWorkDetails(work);
        }
コード例 #8
0
ファイル: CreatePDF.cs プロジェクト: ritwikroy7/PDFGen
        private static void CreateUpperSubTable(WorkInstance oWork, TemplateDetails objTempDetails, Font lobjArialH, PdfPTable lobjMainTable)
        {
            PdfPTable lobjInfoTable = new PdfPTable(2);

            lobjInfoTable.HorizontalAlignment = 2;
            lobjInfoTable.AddCell(new PdfPCell(new Phrase("Template Name:", lobjArialH))
            {
                BackgroundColor = new Color(220, 220, 220),
                BorderColor     = new Color(220, 220, 220)
            });
            lobjInfoTable.AddCell(new PdfPCell(new Phrase(objTempDetails.TemplateFields[0].TemplateName, lobjArialH))
            {
                BackgroundColor = new Color(220, 220, 220),
                BorderColor     = new Color(220, 220, 220)
            });

            lobjInfoTable.AddCell(new PdfPCell(new Phrase("User ID:", lobjArialH))
            {
                BackgroundColor = new Color(220, 220, 220),
                BorderColor     = new Color(220, 220, 220)
            });

            lobjInfoTable.AddCell(new PdfPCell(new Phrase(oWork.UserID, lobjArialH))
            {
                BackgroundColor = new Color(220, 220, 220),
                BorderColor     = new Color(220, 220, 220)
            });

            lobjInfoTable.AddCell(new PdfPCell(new Phrase("Created Date/Time:", lobjArialH))
            {
                BackgroundColor = new Color(220, 220, 220),
                BorderColor     = new Color(220, 220, 220)
            });
            lobjInfoTable.AddCell(new PdfPCell(new Phrase(System.DateTime.Now.ToString(), lobjArialH))
            {
                BackgroundColor = new Color(220, 220, 220),
                BorderColor     = new Color(220, 220, 220)
            });

            lobjMainTable.AddCell(new PdfPCell(lobjInfoTable)
            {
                BorderColor = Color.WHITE, PaddingTop = 20.0F, PaddingBottom = 30.0F, GrayFill = 2.0F
            });
        }
コード例 #9
0
        private void New()
        {
            var obj = WorkInstance.GetObject();

            obj.ScheduleEnd   = DateTime.Parse(end.Value);
            obj.ScheduleStart = DateTime.Parse(start.Value);
            obj.Description   = description.Value;
            obj.Director      = director.Value.Trim();
            obj.Title         = title.Value.Trim();
            WorkInstance.Add(obj);

            SaveHistory(new TB_AccountHistory()
            {
                ActionId = ActionInstance.Find(f => f.Name.Equals("AddWork")).id,
                ObjectA  = WorkInstance.ToString(obj)
            });

            ShowNotification("../service/as_work_dispatch.aspx", "You added a new work.");
        }
コード例 #10
0
 protected bool AfterEmailSent()
 {
     using (SQLiteConnection connection = SqlConnectionFactory.GetSQLiteConnectionWithLock())
     {
         if (ClockInOut_Success)
         {
             string fileName = "/sdcard/punches/ClockPunches.txt";
             string dirName  = "/sdcard/punches";
             if (!Directory.Exists(dirName))
             {
                 Directory.CreateDirectory(dirName);
             }
             if (!File.Exists(fileName))
             {
                 File.Create(fileName);
             }
             string stamp = DateTime.Now.ToString() + "," + (OUT ? "OUT" : "IN") + "," + (RealClockPunch ? "REAL," + (connection.Table <EmailAddresses>().Where(x => x.EmailType == 1).Last()).Email : "FAKE," + (connection.Table <EmailAddresses>().Where(x => x.EmailType == 2).Last()).Email) + "\n";
             File.AppendAllText(fileName, stamp);
             if (RealClockPunch)
             {
                 if (!OUT)
                 {//in
                     float hourlyRate = (connection.Table <HourlyRate>().Last()).Rate;
                     connection.Insert(new WorkInstance()
                     {
                         IsValid    = true,
                         Date       = MainActivity.GetLocalTime().Date,
                         HourlyRate = hourlyRate,
                         ClockIn    = MainActivity.GetLocalTime()
                     });
                 }
                 else
                 {
                     WorkInstance wi = connection.Table <WorkInstance>().Last();
                     wi.ClockOut = MainActivity.GetLocalTime();
                     connection.Update(wi);
                 }
             }
         }
     }
     return(true);
 }
コード例 #11
0
        private void SaveWorkDetail()
        {
            var id   = ParseInt(Utility.Decrypt(hidKey.Value));
            var work = WorkInstance.Find(f => f.id == id && f.Deleted == false);

            if (null != work)
            {
                var obj = WorkDetailInstance.GetObject();
                if (!string.IsNullOrEmpty(hiddenTerminal.Value))
                {
                    obj.BookedTerminal = int.Parse(hiddenTerminal.Value);
                }
                obj.Equipment = int.Parse(hiddenEquipment.Value);
                obj.Type      = byte.Parse(hiddenType.Value);
                obj.Details   = detail.Value;
                obj.Work      = work.id;
                WorkDetailInstance.Add(obj);

                // 更新终端的预定状态
                if ((int?)null != obj.BookedTerminal)
                {
                    TerminalInstance.Update(f => f.id == obj.BookedTerminal && f.Delete == false, act =>
                    {
                        act.Booked = true;
                    });
                }
                // 保存操作历史记录
                SaveHistory(new TB_AccountHistory()
                {
                    ActionId = ActionInstance.Find(f => f.Name.Equals("EditWorkDetail")).id,
                    ObjectA  = WorkDetailInstance.ToString(obj)
                });

                ShowNotification("../service/as_work_details.aspx?key=" + hidKey.Value, "Add new work.");
            }
            else
            {
                ShowNotification("../service/as_work_dispatch.aspx", "This work is not exist.", false);
            }
        }
コード例 #12
0
 public WorkInstanceDetailViewModel(WorkInstance item = null)
 {
     Title        = item?.Date.ToString();
     WorkInstance = item;
 }
コード例 #13
0
ファイル: CreatePDF.cs プロジェクト: ritwikroy7/PDFGen
        private static void CreateHeaderRegion(WorkInstance oWork, out PdfPTable lobjPolicyInfoTable1, out PdfPTable lobjPolicyInfoTable2, out string strNewDiv)
        {
            lobjPolicyInfoTable1 = new PdfPTable(5);
            lobjPolicyInfoTable1.HorizontalAlignment = 0;
            lobjPolicyInfoTable1.SpacingBefore       = 2.0F;
            lobjPolicyInfoTable1.SpacingAfter        = 2.0F;

            lobjPolicyInfoTable2 = new PdfPTable(5);
            lobjPolicyInfoTable2.HorizontalAlignment = 0;
            lobjPolicyInfoTable2.WidthPercentage     = 50;
            lobjPolicyInfoTable2.SpacingBefore       = 2.0F;
            lobjPolicyInfoTable2.SpacingAfter        = 10.0F;

            List <String> lstrTitle = new List <string>();
            List <String> lstrValue = new List <string>();

            strNewDiv = String.Empty;
            if (!String.IsNullOrWhiteSpace(oWork.HeaderString))
            {
                oWork.HeaderString = oWork.HeaderString.Substring(0, oWork.HeaderString.Length - 1);
                String[] StrValueArray = oWork.HeaderString.Split(',');

                int FraudCount = StrValueArray.Count();
                if (FraudCount == 15)
                {
                    strNewDiv     = StrValueArray.ElementAt(FraudCount - 1);
                    StrValueArray = StrValueArray.Take(14).ToArray();
                }
                Int32  liCounter             = 0;
                String lstrPolicyInformation = String.Empty;

                foreach (String s in StrValueArray)
                {
                    if (liCounter == 0)
                    {
                        lobjPolicyInfoTable1.AddCell(new PdfPCell(new Phrase(s, FontFactory.GetFont("Arial", 18, Color.GRAY)))
                        {
                            BorderColor         = Color.WHITE,
                            PaddingLeft         = 5.0F,
                            PaddingRight        = 5.0F,
                            PaddingBottom       = 5.0F,
                            NoWrap              = true,
                            HorizontalAlignment = 0
                        });
                    }
                    if (liCounter == 2)
                    {
                        lobjPolicyInfoTable1.AddCell(new PdfPCell(new Phrase(s, FontFactory.GetFont("Arial", 18, Color.GRAY)))
                        {
                            BorderColor         = Color.WHITE,
                            PaddingLeft         = 5.0F,
                            PaddingRight        = 5.0F,
                            PaddingBottom       = 5.0F,
                            NoWrap              = true,
                            HorizontalAlignment = 1
                        });
                    }
                    if (liCounter == 1)
                    {
                        lobjPolicyInfoTable1.AddCell(new PdfPCell(new Phrase(s, FontFactory.GetFont("Arial", 20, 1, new Color(0, 191, 255))))
                        {
                            BorderColor         = Color.WHITE,
                            PaddingLeft         = 5.0F,
                            PaddingRight        = 5.0F,
                            PaddingBottom       = 5.0F,
                            NoWrap              = true,
                            HorizontalAlignment = 0
                        });
                    }
                    if (liCounter == 3)
                    {
                        lobjPolicyInfoTable1.AddCell(new PdfPCell(new Phrase(s, FontFactory.GetFont("Arial", 18, Color.DARK_GRAY)))
                        {
                            BorderColor         = Color.WHITE,
                            PaddingLeft         = 5.0F,
                            PaddingRight        = 5.0F,
                            PaddingBottom       = 5.0F,
                            Colspan             = 2,
                            HorizontalAlignment = 0
                        });
                    }
                    if (liCounter >= 4)
                    {
                        if (liCounter % 2 == 0)
                        {
                            lstrValue.Add(s);
                        }
                        else
                        {
                            lstrTitle.Add(s);
                        }
                    }

                    liCounter++;
                }


                foreach (String s in lstrValue)
                {
                    Font lobjArial = FontFactory.GetFont("Arial", 12, 1, Color.BLACK);
                    lobjPolicyInfoTable2.AddCell(new PdfPCell(new Phrase(s, lobjArial))
                    {
                        UseVariableBorders = true,
                        BorderColorLeft    = Color.WHITE,
                        BorderColorTop     = Color.WHITE,
                        BorderColorBottom  = Color.WHITE,
                        BorderColorRight   = Color.GRAY,
                        PaddingLeft        = 5.0F,
                        PaddingRight       = 5.0F
                    });
                }
                foreach (String s in lstrTitle)
                {
                    Font lobjArial = FontFactory.GetFont("Arial", 7, Color.GRAY);
                    lobjPolicyInfoTable2.AddCell(new PdfPCell(new Phrase(s, lobjArial))
                    {
                        UseVariableBorders = true,
                        BorderColorLeft    = Color.WHITE,
                        BorderColorTop     = Color.WHITE,
                        BorderColorBottom  = Color.WHITE,
                        BorderColorRight   = Color.GRAY,
                        PaddingLeft        = 5.0F,
                        PaddingRight       = 5.0F
                    });
                }
            }
        }
コード例 #14
0
ファイル: CreatePDF.cs プロジェクト: ritwikroy7/PDFGen
        public byte[] GetBinaryData(WorkInstance oWork)
        {
            //Generate PDF and store in Temp location
            Byte[] lobjBuffer = null;
            string FileName   = Convert.ToString(Guid.NewGuid());
            string FilePath   = System.Configuration.ConfigurationManager.AppSettings["PDFRepository"] + "\\" + FileName + ".pdf";

            Document document = new Document();

            try
            {
                using (FileStream lobjFileStream = new FileStream(FilePath, FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    PdfWriter.GetInstance(document, lobjFileStream);
                    document.Open();
                    document.Add(new Paragraph());
                    AWDDataAccess   objAwdDataAccess = new AWDDataAccess();
                    TemplateDetails objTempDetails   = objAwdDataAccess.getTemplateDetails(oWork.WorkTemplateID);
                    Font            lobjArialH       = FontFactory.GetFont("Arial", 10, Color.BLACK);
                    PdfPTable       lobjMainTable    = new PdfPTable(2);
                    lobjMainTable.WidthPercentage = 100;
                    PdfPCell lobjCell  = new PdfPCell();
                    string   imagePath = HttpContext.Current.Server.MapPath("~/Content/WNLLogo.jpg");
                    lobjMainTable.AddCell(new PdfPCell(iTextSharp.text.Image.GetInstance(imagePath))
                    {
                        BorderColor = Color.WHITE,
                    });

                    CreateUpperSubTable(oWork, objTempDetails, lobjArialH, lobjMainTable);


                    #region Header Information printing....
                    PdfPTable lobjPolicyInfoTable1;
                    PdfPTable lobjPolicyInfoTable2;
                    string    strNewDiv;
                    //call to Header Creator Function
                    CreateHeaderRegion(oWork, out lobjPolicyInfoTable1, out lobjPolicyInfoTable2, out strNewDiv);
                    #endregion

                    document.Add(lobjMainTable);
                    document.Add(lobjPolicyInfoTable1);
                    document.Add(lobjPolicyInfoTable2);

                    if (!String.IsNullOrWhiteSpace(strNewDiv))
                    {
                        PdfPTable lobjFraudTable = CreateFraudTable(strNewDiv);
                        document.Add(lobjFraudTable);
                    }

                    PdfPTable table = CreateFormFieldTable(oWork, objTempDetails);

                    //add the form field table to the document
                    document.Add(table);
                    document.Close();
                }
            }
            catch (System.Exception ex)
            {
                Utilities.LogError(ex.StackTrace, "GetBinaryData");
                throw;
            }

            lobjBuffer = System.IO.File.ReadAllBytes(FilePath);
            return(lobjBuffer);
        }
コード例 #15
0
ファイル: CreatePDF.cs プロジェクト: ritwikroy7/PDFGen
        private static PdfPTable CreateFormFieldTable(WorkInstance oWork, TemplateDetails objTempDetails)
        {
            Font      lobjArialF = FontFactory.GetFont("Arial", 9, Color.BLACK);
            Font      lobjArialG = FontFactory.GetFont("Arial", 11, Color.BLACK);
            PdfPTable table      = new PdfPTable(2);

            table.WidthPercentage     = 65;
            table.HorizontalAlignment = 0;
            table.SpacingBefore       = 30f;

            table.AddCell(new PdfPCell(new Phrase("Form Field Values", lobjArialG))
            {
                Colspan             = 2,
                PaddingBottom       = 5.0F,
                BackgroundColor     = Color.LIGHT_GRAY,
                BorderColor         = Color.WHITE,
                HorizontalAlignment = 1
            });
            int LOBCount = 0;

            LOBCount = oWork.FieldValues.Count;
            int NonLOBCount = 0;

            if (oWork.NonLOBFields != null)
            {
                NonLOBCount = oWork.NonLOBFields.Count;
            }

            int TotalCount = LOBCount + NonLOBCount;
            int j          = 0;

            for (int i = 1; i <= TotalCount; i++)
            {
                var LOBQuery = from LOB in oWork.FieldValues
                               where LOB.Sequence == i
                               select LOB;
                if (LOBQuery != null)
                {
                    foreach (FieldValue FV in LOBQuery)
                    {
                        String FieldDisplayName = (from T in objTempDetails.TemplateFields
                                                   where T.Dataname == FV.Name
                                                   select T.DisplayText).FirstOrDefault();

                        if (!String.IsNullOrWhiteSpace(FieldDisplayName))
                        {
                            PdfPCell cell = new PdfPCell(new Phrase(FieldDisplayName, lobjArialF));
                            cell.BorderColor         = Color.WHITE;
                            cell.HorizontalAlignment = 0;
                            cell.PaddingRight        = 5.0F;
                            cell.PaddingBottom       = 2.0F;

                            PdfPCell cell0 = new PdfPCell(new Phrase(FV.Value, lobjArialF));
                            cell0.BorderColor         = Color.WHITE;
                            cell0.HorizontalAlignment = 0;
                            cell0.PaddingLeft         = 5.0f;
                            cell.PaddingBottom        = 2.0F;

                            if (j % 2 == 0)
                            {
                                cell.BackgroundColor  = Color.WHITE;
                                cell0.BackgroundColor = Color.WHITE;
                            }

                            else
                            {
                                cell.BackgroundColor  = Color.LIGHT_GRAY;
                                cell0.BackgroundColor = Color.LIGHT_GRAY;
                            }
                            j = j + 1;
                            table.AddCell(cell);
                            table.AddCell(cell0);
                        }
                    }
                }

                var NonLOBQuery = from NonLOB in oWork.NonLOBFields
                                  where NonLOB.Sequence == i
                                  select NonLOB;

                if (NonLOBQuery != null)
                {
                    foreach (FieldValue FV in NonLOBQuery)
                    {
                        if (FV.Name != "chkUser" && FV.Name != "fldComment")
                        {
                            String FieldDisplayName = (from T in objTempDetails.TemplateFields
                                                       where T.Dataname == FV.Name
                                                       select T.DisplayText).FirstOrDefault();

                            PdfPCell cell = new PdfPCell(new Phrase(FieldDisplayName, lobjArialF));
                            cell.BorderColor         = Color.WHITE;
                            cell.HorizontalAlignment = 0;
                            cell.PaddingRight        = 5.0F;
                            cell.PaddingBottom       = 2.0F;

                            PdfPCell cell0 = new PdfPCell(new Phrase(FV.Value, lobjArialF));
                            cell0.BorderColor         = Color.WHITE;
                            cell0.HorizontalAlignment = 0;
                            cell0.PaddingLeft         = 5.0f;
                            cell.PaddingBottom        = 2.0F;

                            if (j % 2 == 0)
                            {
                                cell.BackgroundColor  = Color.WHITE;
                                cell0.BackgroundColor = Color.WHITE;
                            }

                            else
                            {
                                cell.BackgroundColor  = Color.LIGHT_GRAY;
                                cell0.BackgroundColor = Color.LIGHT_GRAY;
                            }
                            j = j + 1;

                            table.AddCell(cell);
                            table.AddCell(cell0);
                        }
                    }
                }
            }
            return(table);
        }