Пример #1
0
        public GeneralSettingModel GetSettings()
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            var result = SCObjects.ExecGetData(cmd, Properties.Settings.Default.UserConnectionString);

            if (result != null)
            {
                var item = new GeneralSettingModel
                {
                    ParkingName = result.Rows[0]["ParkingName"].ToString(),
                    TIN         = result.Rows[0]["TIN"].ToString(),
                    Company     = result.Rows[0]["Company"].ToString(),
                    Address1    = result.Rows[0]["Address1"].ToString(),
                    Address2    = result.Rows[0]["Address2"].ToString(),
                    Address3    = result.Rows[0]["Address3"].ToString(),
                    PhoneNumber = result.Rows[0]["PhoneNumber"].ToString(),
                    Address     = result.Rows[0]["Address"].ToString(),
                };
                return(item);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        public IEnumerable <FirstApprovalItem> GetAllFirstApprovals(int userid)
        {
            List <FirstApprovalItem> items = new List <FirstApprovalItem>();
            string    sql = string.Format("EXEC [dbo].[spFirstApprovalPerApprover] @Id = {0}", userid.ToString());
            DataTable dt  = SCObjects.LoadDataTable(sql, UserConnectionString);

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        var item = new FirstApprovalItem
                        {
                            Id                    = int.Parse(dr["Id"].ToString()),
                            Type                  = dr["Type"].ToString(),
                            Name                  = dr["Name"].ToString(),
                            Title                 = dr["Title"].ToString(),
                            Description           = dr["Description"].ToString(),
                            Weight                = int.Parse(dr["Weight"].ToString()),
                            Status                = dr["Status"].ToString(),
                            RatedBy               = dr["RatedBy"].ToString(),
                            RatedDate             = dr["RatedDate"].ToString(),
                            PostedDate            = dr["PostedDate"].ToString(),
                            FirstApproverRemarks  = dr["FirstApproverRemarks"].ToString(),
                            SecondApproverRemarks = dr["SecondApproverRemarks"].ToString(),
                        };
                        items.Add(item);
                    }
                }
            }
            return(items);
        }
Пример #3
0
        public async Task <IEnumerable <CardEncodingModel> > CardEncodingAsync(DateTime date, string keyword, string terminal)
        {
            var        items = new List <CardEncodingModel>();
            SqlCommand cmd   = new SqlCommand();

            cmd.CommandText = "[dbo].[spCardEncoding]";
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@Date", date);
            cmd.Parameters.AddWithValue("@Keyword", keyword);
            cmd.Parameters.AddWithValue("@Terminal", terminal);
            var result = await SCObjects.ExecGetDataAsync(cmd, Properties.Settings.Default.UserConnectionString);

            if (result != null)
            {
                foreach (DataRow dr in result.Rows)
                {
                    var item = new CardEncodingModel
                    {
                        Id            = dr["Id"].ToString(),
                        EntranceGate  = dr["EntranceGate"].ToString(),
                        No            = dr["No"].ToString(),
                        PlateNo       = dr["PlateNo"].ToString(),
                        TimeIn        = dr["TimeIn"].ToString(),
                        TicketNumber  = dr["TicketNumber"].ToString(),
                        EntranceImage = dr["EntranceImage"].ToString().Length > 0 ? (byte[])dr["EntranceImage"] : null,
                    };
                    items.Add(item);
                }
            }
            return(items);
        }
        public async Task <IEnumerable <OperationHourlyAccountabilityModel> > OperationHourlyAccountabilityAsync(DateTime from, DateTime to, string terminal)
        {
            var        items = new List <OperationHourlyAccountabilityModel>();
            SqlCommand cmd   = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@DateFrom", from);
            cmd.Parameters.AddWithValue("@DateTo", to);
            cmd.Parameters.AddWithValue("@Terminal", terminal);
            var result = await SCObjects.ExecGetDataAsync(cmd, Properties.Settings.Default.UserConnectionString);

            if (result != null)
            {
                foreach (DataRow dr in result.Rows)
                {
                    var item = new OperationHourlyAccountabilityModel
                    {
                        RowNum           = int.Parse(dr["RowNum"].ToString()),
                        DurationHours    = dr["DurationHours"].ToString(),
                        NumberOfVehicles = int.Parse(dr["NumberOfVehicles"].ToString()),
                        Amount           = decimal.Parse(dr["Amount"].ToString()),
                    };
                    items.Add(item);
                }
            }
            return(items);
        }
Пример #5
0
        public IEnumerable <ApprovalLevelAccountItem> ApprovalLevelItems(int page)
        {
            string    sql = string.Format(@"EXEC [dbo].[spApprovalLevelIndex] @Page = {0}", page.ToString());
            DataTable dt  = SCObjects.LoadDataTable(sql, UserConnectionString);
            List <ApprovalLevelAccountItem> items = new List <ApprovalLevelAccountItem>();

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    var item = new ApprovalLevelAccountItem
                    {
                        Id         = int.Parse(dr["Id"].ToString()),
                        Name       = dr["Name"].ToString(),
                        Company    = dr["Company"].ToString(),
                        Branch     = dr["Branch"].ToString(),
                        Department = dr["Department"].ToString(),
                        Position   = dr["Position"].ToString(),
                        IsSet      = dr["IsSet"].ToString().Equals("1") ? true : false,
                    };
                    items.Add(item);
                }
            }

            return(items);
        }
Пример #6
0
        public async Task <decimal> TodaySalesAsync(DateTime date)
        {
            var sql    = string.Format("SELECT [dbo].[fnGetTodaySales]('{0}')", date.ToString("MM/dd/yyyy"));
            var result = await SCObjects.ReturnTextAsync(sql, Properties.Settings.Default.UserConnectionString);

            return(decimal.Parse(result));
        }
Пример #7
0
        public async Task <int> RemainingCarsAsync()
        {
            var sql    = "SELECT [dbo].[fnGetRemainingCars]()";
            var result = await SCObjects.ReturnTextAsync(sql, Properties.Settings.Default.UserConnectionString);

            return(int.Parse(result));
        }
Пример #8
0
        public async Task <IEnumerable <AuditTrailModel> > GetAuditTrailAsync(DateTime from, DateTime to, string terminal, string keyword)
        {
            var cmd = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@DateFrom", from);
            cmd.Parameters.AddWithValue("@DateTo", to);
            cmd.Parameters.AddWithValue("@Keyword", keyword);
            cmd.Parameters.AddWithValue("@Terminal", terminal);
            var result = await SCObjects.ExecGetDataAsync(cmd, Properties.Settings.Default.UserConnectionString);

            var items = new List <AuditTrailModel>();

            if (result != null)
            {
                foreach (DataRow dr in result.Rows)
                {
                    var item = new AuditTrailModel
                    {
                        Id          = dr["Id"].ToString(),
                        Date        = dr["Date"].ToString(),
                        Description = dr["Description"].ToString(),
                        Gate        = dr["Gate"].ToString(),
                        Username    = dr["Username"].ToString(),
                    };
                    items.Add(item);
                }
            }

            return(items);
        }
Пример #9
0
        public async Task <IEnumerable <ZReadingModel> > ZReadingAsync(DateTime dateFrom, DateTime dateTo, string terminal)
        {
            var        items = new List <ZReadingModel>();
            SqlCommand cmd   = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@DateFrom", dateFrom);
            cmd.Parameters.AddWithValue("@DateTo", dateTo);
            cmd.Parameters.AddWithValue("@Terminal", terminal);
            var result = await SCObjects.ExecGetDataAsync(cmd, Properties.Settings.Default.UserConnectionString);

            if (result != null)
            {
                foreach (DataRow dr in result.Rows)
                {
                    var item = new ZReadingModel
                    {
                        Id         = dr["Id"].ToString(),
                        Date       = dr["Date"].ToString(),
                        NewORNo    = dr["NewORNo"].ToString(),
                        OldORNo    = dr["OldORNo"].ToString(),
                        OldFRNo    = dr["OldFRNo"].ToString(),
                        NewFRNo    = dr["NewFRNo"].ToString(),
                        TodaySales = dr["TodaySales"].ToString().Length == 0 ? 0 : decimal.Parse(dr["TodaySales"].ToString()),
                        OldSales   = dr["OldSales"].ToString().Length == 0 ? 0 : decimal.Parse(dr["OldSales"].ToString()),
                        NewSales   = dr["NewSales"].ToString().Length == 0 ? 0 : decimal.Parse(dr["NewSales"].ToString()),
                    };
                    items.Add(item);
                }
            }
            return(items);
        }
Пример #10
0
        public IEnumerable <EmployeeInformation> Employees(string keyword)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@Keyword", keyword);
            cmd.Parameters.AddWithValue("@QueryType", 2);
            DataTable dt = SCObjects.ExecGetData(cmd, UserConnectionString);
            List <EmployeeInformation> items = new List <EmployeeInformation>();

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    var item = new EmployeeInformation
                    {
                        Id         = int.Parse(dr["Id"].ToString()),
                        Name       = dr["Name"].ToString(),
                        EmployeeNo = dr["EmployeeNo"].ToString(),
                        Category   = dr["Category"].ToString(),
                        Company    = dr["Company"].ToString(),
                        Branch     = dr["Branch"].ToString(),
                        Department = dr["Department"].ToString(),
                        Position   = dr["Position"].ToString(),
                    };
                    items.Add(item);
                }
            }
            return(items);
        }
Пример #11
0
        public IEnumerable <EmployeePerformance> EmployeePerformances(int period, int id)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "[dbo].[spEmployeePerformance]";
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@SeasonId", period);
            cmd.Parameters.AddWithValue("@EmployeeId", id);
            DataTable dt = SCObjects.ExecGetData(cmd, UserConnectionString);

            List <EmployeePerformance> items = new List <EmployeePerformance>();

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    var item = new EmployeePerformance
                    {
                        Id             = int.Parse(dr["Id"].ToString()),
                        Name           = dr["EmployeeName"].ToString(),
                        Period         = dr["Period"].ToString(),
                        TotalScore     = decimal.Parse(dr["TotalScore"].ToString()),
                        TotalWeight    = decimal.Parse(dr["TotalWeight"].ToString()),
                        ConvertedScore = decimal.Parse(dr["ConvertedScore"].ToString()),
                        WeightedScore  = decimal.Parse(dr["WeightedScore"].ToString()),
                        Percentage     = decimal.Parse(dr["Percentage"].ToString()),
                    };
                    items.Add(item);
                }
            }
            return(items);
        }
Пример #12
0
        public IEnumerable <EvaluationReport> Evaluations(int periodid, string type)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@EvaluationSeason", periodid);
            cmd.Parameters.AddWithValue("@Type", type);
            cmd.Parameters.AddWithValue("@QueryType", 1);
            DataTable dt = SCObjects.ExecGetData(cmd, UserConnectionString);
            List <EvaluationReport> items = new List <EvaluationReport>();

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    var item = new EvaluationReport
                    {
                        Id          = int.Parse(dr["Id"].ToString()),
                        Name        = dr["Name"].ToString(),
                        Rater       = dr["Rater"].ToString(),
                        Period      = dr["Period"].ToString(),
                        Type        = dr["Type"].ToString(),
                        Status      = dr["Status"].ToString(),
                        DateCreated = dr["DateCreated"].ToString()
                    };
                    items.Add(item);
                }
            }
            return(items);
        }
Пример #13
0
        public IEnumerable <PeerRatingDetailed> PeerDetailedRating(int period, int employee)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "[dbo].[spPeerEvaluationReport]";
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@Period", period);
            cmd.Parameters.AddWithValue("@Id", employee);
            cmd.Parameters.AddWithValue("@QueryType", 1);
            DataTable dt = SCObjects.ExecGetData(cmd, UserConnectionString);
            List <PeerRatingDetailed> items = new List <PeerRatingDetailed>();

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    var item = new PeerRatingDetailed
                    {
                        Id         = int.Parse(dr["Id"].ToString()),
                        Period     = dr["Period"].ToString(),
                        Name       = dr["Name"].ToString(),
                        Rater      = dr["Rater"].ToString(),
                        Score      = decimal.Parse(dr["Score"].ToString()),
                        Weight     = decimal.Parse(dr["Weight"].ToString()),
                        TotalScore = decimal.Parse(dr["Average"].ToString()),
                    };
                    items.Add(item);
                }
            }

            return(items);
        }
Пример #14
0
        public async Task <IEnumerable <PeakLoadModel> > PeakLoadReportAsync(DateTime date)
        {
            var items = new List <PeakLoadModel>();

            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@Date", date);
            var result = await SCObjects.ExecGetDataAsync(cmd, Properties.Settings.Default.UserConnectionString);

            if (result != null)
            {
                foreach (DataRow dr in result.Rows)
                {
                    var item = new PeakLoadModel
                    {
                        Row           = int.Parse(dr["Row"].ToString()),
                        Time          = dr["Time"].ToString(),
                        GrossIn       = decimal.Parse(dr["GrossIn"].ToString()),
                        Cancel        = decimal.Parse(dr["Cancel"].ToString()),
                        NetIn         = decimal.Parse(dr["NetIn"].ToString()),
                        InPercentage  = decimal.Parse(dr["InPercentage"].ToString()),
                        NetOut        = decimal.Parse(dr["NetOut"].ToString()),
                        OutPercentage = decimal.Parse(dr["OutPercentage"].ToString()),
                        Amount        = decimal.Parse(dr["Amount"].ToString()),
                    };
                    items.Add(item);
                }
            }

            return(items);
        }
        public async Task <IEnumerable <CashierAccountabilityModel> > CashierAccountabilityAsync(DateTime from, DateTime to, int terminal)
        {
            var        items = new List <CashierAccountabilityModel>();
            SqlCommand cmd   = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@DateFrom", from);
            cmd.Parameters.AddWithValue("@DateTo", to);
            cmd.Parameters.AddWithValue("@Terminal", terminal);
            var result = await SCObjects.ExecGetDataAsync(cmd, Properties.Settings.Default.UserConnectionString);

            if (result != null)
            {
                foreach (DataRow dr in result.Rows)
                {
                    var item = new CashierAccountabilityModel
                    {
                        Row           = dr["Row"].ToString(),
                        RunDate       = dr["RunDate"].ToString(),
                        RunTime       = dr["RunTime"].ToString(),
                        Location      = dr["Location"].ToString(),
                        Terminal      = dr["Terminal"].ToString(),
                        TotalAmount   = decimal.Parse(dr["TotalAmount"].ToString()),
                        TotalChange   = decimal.Parse(dr["TotalChange"].ToString()),
                        CarParkIncome = dr["CarParkIncome"].ToString(),
                        ReceiptsOut   = int.Parse(dr["ReceiptsOut"].ToString()),
                        Amount        = decimal.Parse(dr["Amount"].ToString()),
                    };
                    items.Add(item);
                }
            }

            return(items);
        }
        public async Task <IEnumerable <HourlyAccountabilityModel> > HourlyAccountabilityReportAsync(DateTime from, DateTime to, string terminal)
        {
            var items = new List <HourlyAccountabilityModel>();

            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@DateFrom", from);
            cmd.Parameters.AddWithValue("@DateTo", to);
            cmd.Parameters.AddWithValue("@Terminal", terminal);
            var result = await SCObjects.ExecGetDataAsync(cmd, Properties.Settings.Default.UserConnectionString);

            if (result != null)
            {
                foreach (DataRow dr in result.Rows)
                {
                    var item = new HourlyAccountabilityModel
                    {
                        TimeString  = dr["TimeString"].ToString(),
                        TotalCard   = int.Parse(dr["TotalCard"].ToString()),
                        TotalAmount = decimal.Parse(dr["TotalAmount"].ToString()),
                    };
                    items.Add(item);
                }
            }
            return(items);
        }
Пример #17
0
        public async Task <int> ProcessedTicketsAsync(DateTime date)
        {
            var sql    = string.Format("SELECT [dbo].[fnGetProcessedTickets]('{0}')", date.ToString("MM/dd/yyyy"));
            var result = await SCObjects.ReturnTextAsync(sql, Properties.Settings.Default.UserConnectionString);

            return(int.Parse(result));
        }
        public IEnumerable <EmployeeEvaluation> GetAllRatingPerUser(int id)
        {
            List <EmployeeEvaluation> employeeEvaluations = new List <EmployeeEvaluation>();

            var       UserConnectionString = _dbContext.Database.GetDbConnection().ConnectionString;
            DataTable dt = SCObjects.LoadDataTable(string.Format("EXEC [dbo].[spGetEvaluationScorePerRater] @Rater = {0}", id.ToString()), UserConnectionString);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    var item = new EmployeeEvaluation
                    {
                        Id             = int.Parse(dr["Id"].ToString()),
                        Name           = dr["EmployeeName"].ToString(),
                        TotalScore     = decimal.Parse(dr["TotalScore"].ToString()),
                        TotalWeight    = decimal.Parse(dr["TotalWeight"].ToString()),
                        ConvertedScore = decimal.Parse(dr["ConvertedScore"].ToString()),
                        WeightedScore  = decimal.Parse(dr["WeightedScore"].ToString()),
                        Percentage     = decimal.Parse(dr["Percentage"].ToString()),
                    };
                    employeeEvaluations.Add(item);
                }
            }
            return(employeeEvaluations);
        }
Пример #19
0
        public async Task <decimal> WeeklyTotalSalesAsync()
        {
            var sql    = "EXEC [dbo].[spWeeklySalesDecimal]";
            var result = await SCObjects.ReturnTextAsync(sql, Properties.Settings.Default.UserConnectionString);

            return(decimal.Parse(result));
        }
        public IEnumerable <EvaluationResultItem> GetResultPerEmployee(int id)
        {
            List <EvaluationResultItem> items = new List <EvaluationResultItem>();
            var       UserConnectionString    = _dbContext.Database.GetDbConnection().ConnectionString;
            var       sql = string.Format("EXEC [dbo].[spGetEvaluationResultPerEmployee] @Id = {0}", id.ToString());
            DataTable dt  = SCObjects.LoadDataTable(sql, UserConnectionString);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    var item = new EvaluationResultItem
                    {
                        Id             = int.Parse(dr["Id"].ToString()),
                        Type           = dr["Type"].ToString(),
                        Name           = dr["EmployeeName"].ToString(),
                        TotalScore     = decimal.Parse(dr["TotalScore"].ToString()),
                        TotalWeight    = decimal.Parse(dr["TotalWeight"].ToString()),
                        ConvertedScore = decimal.Parse(dr["ConvertedScore"].ToString()),
                        WeightedScore  = decimal.Parse(dr["WeightedScore"].ToString()),
                        Percentage     = decimal.Parse(dr["Percentage"].ToString()),
                    };
                    items.Add(item);
                }
            }

            return(items);
        }
        public IEnumerable <Account> Recommender()
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@QueryType", 0);
            DataTable      dt    = SCObjects.ExecGetData(cmd, UserConnectionString);
            List <Account> items = new List <Account>();

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    var item = new Account
                    {
                        Id         = int.Parse(dr["Id"].ToString()),
                        FirstName  = dr["Firstname"].ToString(),
                        MiddleName = dr["Middlename"].ToString(),
                        LastName   = dr["Lastname"].ToString(),
                    };
                    items.Add(item);
                }
            }
            return(items);
        }
Пример #22
0
        public async Task <IEnumerable <AuditPerTerminalTicketAccountabilityModel> > AuditPerTerminalTicketAccountabilityAsync(DateTime from, DateTime to, string terminal)
        {
            var        items = new List <AuditPerTerminalTicketAccountabilityModel>();
            SqlCommand cmd   = new SqlCommand();

            cmd.CommandText = AuditPerTerminalTicketAccountability;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@DateFrom", from);
            cmd.Parameters.AddWithValue("@DateTo", to);
            cmd.Parameters.AddWithValue("@Terminal", terminal);
            var result = await SCObjects.ExecGetDataAsync(cmd, Properties.Settings.Default.UserConnectionString);

            if (result != null)
            {
                foreach (DataRow dr in result.Rows)
                {
                    var item = new AuditPerTerminalTicketAccountabilityModel
                    {
                        Id          = dr["Id"].ToString(),
                        Description = dr["Description"].ToString(),
                        Value       = dr["Value"].ToString(),
                    };
                    items.Add(item);
                }
            }
            return(items);
        }
Пример #23
0
        public async Task <IEnumerable <CashlessSummaryModel> > CashlessSummaryAsync(DateTime from, DateTime to, string terminal)
        {
            var items = new List <CashlessSummaryModel>();
            var cmd   = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@DateFrom", from);
            cmd.Parameters.AddWithValue("@DateTo", to);
            cmd.Parameters.AddWithValue("@Terminal", terminal);
            var result = await SCObjects.ExecGetDataAsync(cmd, Properties.Settings.Default.UserConnectionString);

            if (result == null)
            {
                return(null);
            }

            foreach (DataRow dr in result.Rows)
            {
                var item = new CashlessSummaryModel
                {
                    Id          = int.Parse(dr["Id"].ToString()),
                    Description = dr["Description"].ToString(),
                    Value       = dr["Value"].ToString(),
                };
                items.Add(item);
            }

            return(items);
        }
        public bool IsWithRecommendation(int id)
        {
            string sql       = string.Format("SELECT 1 FROM [dbo].[Recommendations] [r] WHERE [r].[EmployeeId] = {0} AND [r].[IsExpired] = 0 AND [r].[IsDeleted] = 0", id.ToString());
            string CheckThis = SCObjects.ReturnText(sql, UserConnectionString);

            return(CheckThis.Length > 0);
        }
Пример #25
0
        public void Save(ApprovalLevelAssignment approval, int userid)
        {
            //if(approval.Id == 0)
            //{
            //    approval.CreatedBy = userid.ToString();
            //    approval.CreationDate = DateTime.Now;
            //    _dbContext.Add(approval);
            //}
            //else
            //{
            //    approval.ModifiedBy = userid.ToString();
            //    approval.ModifiedDate = DateTime.Now;
            //    _dbContext.Entry(approval).State = EntityState.Modified;
            //}
            //_dbContext.SaveChanges();

            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "[dbo].[spApprovalLevelAssignment]";
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@Id", approval.Id);
            cmd.Parameters.AddWithValue("@EmployeeId", approval.Employee.Id);
            cmd.Parameters.AddWithValue("@FirstApproval", approval.FirstApproval.Id);
            if (approval.IsWithSecondApproval)
            {
                cmd.Parameters.AddWithValue("@SecondApproval", approval.SecondApproval.Id);
            }
            cmd.Parameters.AddWithValue("@CreatedBy", userid);
            cmd.Parameters.AddWithValue("@ModifiedBy", userid);
            cmd.Parameters.AddWithValue("@IsWithSecondApproval", approval.IsWithSecondApproval ? 1 : 0);
            cmd.Parameters.AddWithValue("@QueryType", approval.Id == 0 ? 1 : 2);
            var result = SCObjects.ExecuteNonQuery(cmd, UserConnectionString);
        }
        public async Task <IEnumerable <RemainingCarModel> > RemainingCarsAsync(DateTime date)
        {
            List <RemainingCarModel> items = new List <RemainingCarModel>();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@Date", date);
            var result = await SCObjects.ExecGetDataAsync(cmd, Properties.Settings.Default.UserConnectionString);

            if (result != null)
            {
                foreach (DataRow dr in result.Rows)
                {
                    var item = new RemainingCarModel
                    {
                        No           = dr["No"].ToString(),
                        ParkerType   = dr["ParkerType"].ToString(),
                        PlateNo      = dr["PlateNo"].ToString(),
                        RFIDName     = dr["RFIDName"].ToString(),
                        RFIDNumber   = dr["RFIDNumber"].ToString(),
                        TicketNumber = dr["TicketNumber"].ToString(),
                        TimeIn       = dr["TimeIn"].ToString(),
                    };
                    items.Add(item);
                }
            }
            return(items);
        }
        public async Task <IEnumerable <CardClearingModel> > CardClearingAsync(DateTime from, DateTime to, string terminal)
        {
            var items = new List <CardClearingModel>();
            var cmd   = new SqlCommand();

            cmd.CommandText = StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@DateFrom", from);
            cmd.Parameters.AddWithValue("@DateTo", to);
            cmd.Parameters.AddWithValue("@Terminal", terminal);
            var result = await SCObjects.ExecGetDataAsync(cmd, Properties.Settings.Default.UserConnectionString);

            if (result != null)
            {
                foreach (DataRow dr in result.Rows)
                {
                    var item = new CardClearingModel
                    {
                        Id           = dr["Id"].ToString(),
                        Row          = dr["Row"].ToString(),
                        EntranceGate = dr["EntranceGate"].ToString(),
                        PlateNo      = dr["PlateNo"].ToString(),
                        TicketNo     = dr["TicketNo"].ToString(),
                        DateTimein   = dr["DateTimein"].ToString(),
                        Comment      = dr["Comment"].ToString(),
                        ClearedUser  = dr["ClearedUser"].ToString(),
                    };
                    items.Add(item);
                }
            }

            return(items);
        }
Пример #28
0
        public void SaveKeyResultAreaEvaluation(RatingHeader header, IEnumerable <RatingKeySuccessArea> ratings, int userid, int employeeid)
        {
            if (header.Id == 0)
            {
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "[dbo].[spNotifications]";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@From", userid);
                cmd.Parameters.AddWithValue("@To", employeeid);
                cmd.Parameters.AddWithValue("@Message", "KRA evaluation was created.");
                cmd.Parameters.AddWithValue("@QueryType", 1);
                var result = SCObjects.ExecuteNonQuery(cmd, UserConnectionString);

                header.EvaluationSeason = ActiveSeason();
                _dbContext.Add(header);
            }
            else
            {
                header.EvaluationSeason        = ActiveSeason();
                _dbContext.Entry(header).State = EntityState.Modified;
            }
            foreach (var item in ratings)
            {
                item.RatingHeader = header;
                if (item.Id == 0)
                {
                    _dbContext.Add(item);
                }
                else
                {
                    _dbContext.Entry(item).State = EntityState.Modified;
                }
            }
            _dbContext.SaveChanges();
        }
Пример #29
0
        public IEnumerable <PeerEvaluationListingItem> Evaluations(int userid)
        {
            List <PeerEvaluationListingItem> items = new List <PeerEvaluationListingItem>();

            DataTable dt = SCObjects.LoadDataTable(string.Format("EXEC [dbo].[spPeerEvaluationSummaryPerEmployee] @Id = {0}", userid.ToString()), UserConnectionString);

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        var item = new PeerEvaluationListingItem
                        {
                            EvaluationId   = int.Parse(dr["EvaluationId"].ToString()),
                            Id             = int.Parse(dr["Id"].ToString()),
                            Name           = dr["Name"].ToString(),
                            Position       = dr["Position"].ToString(),
                            Company        = dr["Company"].ToString(),
                            Branch         = dr["Branch"].ToString(),
                            Department     = dr["Department"].ToString(),
                            EvaluationDate = dr["DateEvaluated"].ToString(),
                            TotalScore     = int.Parse(dr["TotalScore"].ToString()),
                            Status         = dr["Status"].ToString()
                        };
                        items.Add(item);
                    }
                }
            }

            return(items);
        }
        public IEnumerable <EmployeeViewModel> EmployeeItems(int page)
        {
            List <EmployeeViewModel> items = new List <EmployeeViewModel>();
            string    sql = string.Format("EXEC [dbo].[spEmployeeAssignmetIndex] @Page = {0}", page.ToString());
            DataTable dt  = SCObjects.LoadDataTable(sql, UserConnectionString);

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    var item = new EmployeeViewModel
                    {
                        Id         = int.Parse(dr["Id"].ToString()),
                        EmployeeNo = dr["EmployeeNo"].ToString(),
                        Name       = dr["Name"].ToString(),
                        Company    = dr["Company"].ToString(),
                        Department = dr["Department"].ToString(),
                        Branch     = dr["Branch"].ToString(),
                        Position   = dr["Position"].ToString(),
                        Category   = dr["Category"].ToString(),
                    };
                    items.Add(item);
                }
            }
            return(items);
        }