Exemple #1
0
 /// <summary>
 /// Add store staff in the database
 /// </summary>
 /// <param name="store"> store model</param>
 /// <param name="staff">staff model </param>
 public static void AddStoreStaffToTheDatabase(StoreModel store, StaffModel staff, string db)
 {
     using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnVal(db)))
     {
         var p = new DynamicParameters();
         p.Add("StaffId", staff.Id);
         p.Add("StoreId", store.Id);
         connection.Execute("dbo.spStaffStore_Create", p, commandType: CommandType.StoredProcedure);
     }
 }
Exemple #2
0
 /// <summary>
 /// -OLD- Update staff member data From username , password and permissionId
 /// </summary>
 /// <param name="staff"></param>
 /// <param name="db"></param>
 public static void UpdateStaffData(StaffModel staff, string db)
 {
     using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnVal(db)))
     {
         var p = new DynamicParameters();
         p.Add("@StaffId", staff.Id);
         p.Add("@StaffUsername", staff.Username);
         p.Add("@StaffPassword", staff.Password);
         p.Add("@StaffPermissionId", staff.Permission.Id);
         p.Add("@StaffSalary", staff.Salary);
         connection.Execute("dbo.spStaff_Update", p, commandType: CommandType.StoredProcedure);
     }
 }
Exemple #3
0
        /// <summary>
        /// Get how much money the Staff Member should receive this month
        /// </summary>
        public static decimal GetStaffShouldReceiveThisMonth(StaffModel staff)
        {
            decimal totalReceivedThisMonth = new decimal();

            totalReceivedThisMonth += StaffSalary.TotalReceivedByMonth(staff.GetStaffSalaries, DateTime.Now);

            if (totalReceivedThisMonth < staff.Salary)
            {
                return(staff.Salary - totalReceivedThisMonth);
            }
            else
            {
                return(0);
            }
        }
Exemple #4
0
 /// <summary>
 /// Filter all staff
 /// </summary>
 /// <param name="staff"></param>
 /// <returns></returns>
 public static List <OperationModel> FilterOperationsByStaff(StaffModel staff)
 {
     return(PublicVariables.Operations.FindAll(x => x.GetStaff == staff));
 }
Exemple #5
0
 /// <summary>
 /// Get the count of orders in specific period
 /// </summary>
 /// <param name="staff"></param>
 /// <param name="from"></param>
 /// <param name="to"></param>
 /// <returns></returns>
 public static int GetTheOrdersCount(StaffModel staff, DateTime from, DateTime to)
 {
     return(FilterOrders(staff, from, to).Count);
 }
Exemple #6
0
 /// <summary>
 /// Filter the staff orders by the time Period between the two dateTime
 /// </summary>
 /// <param name="staff">the staff model that we need it's orders to be filted</param>
 /// <param name="from">the start date</param>
 /// <param name="to"> the end date</param>
 /// <returns></returns>
 public static List <OrderModel> FilterOrders(StaffModel staff, DateTime from, DateTime to)
 {
     return(staff.GetOrders.FindAll(x => x.DateTimeOfTheOrder > from && x.DateTimeOfTheOrder < to));
 }
Exemple #7
0
 /// <summary>
 /// Get all Orders of this staff
 /// </summary>
 /// <param name="staff"></param>
 /// <returns></returns>
 public static List <OrderModel> GetOrders(StaffModel staff)
 {
     return(PublicVariables.Orders.FindAll(x => x.Staff.Id == staff.Id));
 }
Exemple #8
0
 /// <summary>
 /// Get All The staff Salaries models
 /// </summary>
 public static List <StaffSalaryModel> GetStaffSalaries(StaffModel staff)
 {
     return(PublicVariables.StaffSalaries.FindAll(x => x.ToStaff == staff));
 }