Пример #1
0
        //public string getConnectionString(int serverID)
        //{
        //    //Get the connection string for the selected database
        //    var context = new App_Data.AcuPayEntities();

        //    var query1 = (from a in context.tbl_Servers
        //                  where a.ServerID == serverID
        //                  select new
        //                  {
        //                      a.ConnectionString
        //                  }).ToString();
        //    return query1;
        //}

        public List <string> getLocationID(int serverID, string loggedInUser)
        {
            //Get the locations the user is assigned to
            var context = new App_Data.AcuPayEntities();

            var query1 = (from a in context.tbl_Users_Servers
                          join b in context.tbl_Estate on a.EstatesID equals b.EstateID
                          join c in context.tbl_Users on a.UserID equals c.UserID
                          where a.ServerID == serverID && c.UserName == loggedInUser
                          select new
            {
                b.Guy_EstateCode
            }).ToList();

            List <string> results = new List <string>();

            if (query1.Count > 0)
            {
                foreach (var item in query1)
                {
                    string val = item.ToString();
                    val = val.Remove(0, 19);
                    val = val.TrimEnd('}');
                    results.Add(val.TrimEnd(' '));
                }
            }
            else
            {
                results.Add("NoLocation");
            }

            return(results);
        }
Пример #2
0
        private void loadGridviewData()
        {
            List <string> estates = new List <string>();

            if (EstateID.Count > 0)
            {
                foreach (string li in EstateID)
                {
                    estates.Add(li);
                }
            }
            //estates = estates.TrimEnd(',');
            //Select from Entity Data Model to Bind gridview with all records not uploaded.
            var context = new App_Data.AcuPayEntities();

            var query1 = (from a in context.tbl_1_Export_PieceWork
                          where a.Uploaded.Contains("N") && estates.Contains(a.EstateiD)
                          orderby a.WorkDate descending
                          select new
            {
                a.RecordId,
                a.FirstName,
                a.LastName,
                a.Emp_Seq_No,
                a.est_emp_no,
                a.WorkDate,
                a.Quantity,
                a.TentativeRate,
                a.TotalEarnings,
                a.DayWorked,
                a.ActivityMaster,
                a.ActivityCode,
                a.ExpenseCode,
                a.Holding_ac_Code,
                a.LocationID,
                a.ChargedTo,
                a.EstateLocationId,
                a.EstateiD,
                a.TemporaryGang,
                a.TemporaryGangOption,
                a.Recoverable,
                a.Unit
            }).ToList();

            gvTime.DataSource = query1;
            gvTime.DataBind();

            if (gvTime.Rows.Count == 0)
            {
                toggleEndableDisable(false);
                lblTime.Text = "No data available for upload.";
            }
            else if (gvTime.Rows.Count > 0)
            {
                toggleEndableDisable(true);
                lblTime.Text = "Records available for upload: " + query1.Count;
            }
        }
        private void loadGridviewData()
        {
            List <string> estates = new List <string>();

            if (EstateID.Count > 0)
            {
                foreach (string li in EstateID)
                {
                    estates.Add(li);
                }
            }
            //estates = estates.TrimEnd(',');

            //Select from Entity Data Model to Bind gridview with all records not uploaded.
            var context = new App_Data.AcuPayEntities();

            var query1 = (from a in context.tbl_3_Export_OtherEarnings
                          where a.Uploaded.Contains("N") && estates.Contains(a.Estate_ID)
                          orderby a.Work_date descending
                          select new
            {
                a.RecordId,
                a.FirstName,
                a.LastName,
                a.Emp_seq_no,
                a.est_emp_no,
                a.Work_date,
                a.INCOME_ID,
                a.Amount,
                a.EarningRate,
                a.Total_other_earnings,
                a.Earnings_table_name,
                a.Link_id,
                a.Estate_location_id,
                a.Estate_ID
            }).ToList();

            gvTime.DataSource = query1;
            gvTime.DataBind();

            if (gvTime.Rows.Count == 0)
            {
                toggleEndableDisable(false);
                lblTime.Text = "No data available for upload.";
            }
            else if (gvTime.Rows.Count > 0)
            {
                toggleEndableDisable(true);
                lblTime.Text = "Records available for upload: " + query1.Count;
            }
        }
Пример #4
0
        private void loadGridviewData()
        {
            List <string> estates = new List <string>();

            if (EstateID.Count > 0)
            {
                foreach (string li in EstateID)
                {
                    estates.Add(li);
                }
            }
            //estates = estates.TrimEnd(',');

            //Select from Entity Data Model to Bind gridview with all records not uploaded.
            var context = new App_Data.AcuPayEntities();

            var query1 = (from a in context.tbl_6_Export_NotRequired
                          where a.Uploaded.Contains("N")
                          orderby a.WorkDate descending
                          //&& estates.Contains(a.EstateId)
                          select new
            {
                a.RecordId,
                a.FirstName,
                a.LastName,
                a.emp_seq_no,
                a.est_emp_no,
                a.WorkDate,
                a.NRStatus,
                a.EstateId,
                a.EstateLocationId,
            }).ToList();

            gvTime.DataSource = query1;
            gvTime.DataBind();

            if (gvTime.Rows.Count == 0)
            {
                toggleEndableDisable(false);
                lblTime.Text = "No data available for upload.";
            }
            else if (gvTime.Rows.Count > 0)
            {
                toggleEndableDisable(true);
                lblTime.Text = "Records available for upload: " + query1.Count;
            }
        }
Пример #5
0
        public bool IsAdmin(string loggedInUser)
        {
            //Check if the loggedinuser is an Admin
            var context = new App_Data.AcuPayEntities();

            var query1 = (from a in context.tbl_Users
                          where a.UserName == loggedInUser
                          select new
            {
                a.Admin
            }).ToList();

            string result      = "";
            bool   adminStatus = new bool();

            if (query1.Count > 0)
            {
                foreach (var item in query1)
                {
                    string val = item.ToString();
                    val    = val.Remove(0, 10);
                    val    = val.TrimEnd('}');
                    result = val.TrimEnd(' ');
                }
            }

            if (result != "")
            {
                if (result == "True")
                {
                    adminStatus = true;
                }
                else
                {
                    adminStatus = false;
                }
            }
            else
            {
                adminStatus = false;
            }

            return(adminStatus);
        }
Пример #6
0
        //Updated uploaded record for Time Details to show it was uploaded
        public void setUploadStatus_TimeDetails(int recordID, string updatedBy)
        {
            var contex = new App_Data.AcuPayEntities();

            try
            {
                var recordToUpdate = (from a in contex.tbl_2_Export_TimeDetails
                                      where a.RecordId == recordID
                                      select a).First();
                recordToUpdate.Uploaded   = "Y";
                recordToUpdate.UploadedBy = updatedBy;
                recordToUpdate.UploadedOn = DateTime.Now;
                contex.SaveChanges();
                successfulCommit = true;
            }
            catch (System.Exception excec)
            {
                successfulCommit = false;
                writetoAlertLog(excec.ToString().ToUpper());
            }
        }
        private void loadGridviewData()
        {
            List <string> estates = new List <string>();

            if (EstateID.Count > 0)
            {
                foreach (string li in EstateID)
                {
                    estates.Add(li);
                }
            }
            //estates = estates.TrimEnd(',');
            //Select from Entity Data Model to Bind gridview with all records not uploaded.
            var context = new App_Data.AcuPayEntities();

            var query1 = (from a in context.tbl_2_Export_TimeDetails
                          where a.Uploaded.Contains("N") && estates.Contains(a.EstateID)
                          orderby a.WorkDate descending
                          select new
            {
                a.RecordId,
                a.FirstName,
                a.LastName,
                a.Emp_seq_no,
                a.est_emp_no,
                a.WorkDate,
                a.ShiftId,
                a.FromTime,
                a.ToTime,
                a.OverNight,
                a.HasSplit,
                a.SS_FromTime,
                a.SS_ToTime,
                a.Rate,
                a.ActivityMaster,
                a.ActivityCode,
                a.Holding_Acc_Code,
                a.LocationId,
                a.ChargedTo,
                a.EstateLocationID,
                a.EstateID,
                a.TypeOfEntry,
                a.TemporaryGang,
                a.TemporaryGangOption,
                a.Vehicle,
                a.Recoverable,
                a.Quantity
            }).ToList();

            gvTime.DataSource = query1;
            gvTime.DataBind();

            if (gvTime.Rows.Count == 0)
            {
                toggleEndableDisable(false);
                lblTime.Text = "No data available for upload.";
            }
            else if (gvTime.Rows.Count > 0)
            {
                toggleEndableDisable(true);
                lblTime.Text = "Records available for upload: " + query1.Count;
            }
        }