public void GetDBBackup(string backupDBName, string backupPath)
        {
            try
            {
                DataBaseUtility db = new DataBaseUtility();

                SqlCommand cm = new SqlCommand();
                string s = DateTime.Now.ToString("MMM/dd/yyyy");

                SqlParameter[] sqlParams = new SqlParameter[]
            {   new SqlParameter("@DBNAME", backupDBName),
                new SqlParameter("@PATH", backupPath),
                new SqlParameter("@BACKUPTYPE", 1),
                new SqlParameter("@MSG", "Genrate Backup"),
                new SqlParameter("@BACKUPFILENAME", s.Replace("/", "_") )};

                db.ExecuteSP("DATABASE_BACKUP", sqlParams);

                log.Info("Backup created success fully with name "+ s.Replace("/", "_"));
            }
            catch (Exception ex)
            {

                log.Info("Exception in  GetDBBackup  ",ex);
            }
        }
Пример #2
0
 // Add Food Order this order add by only manager
 public void AddFoodOrder(FoodOrderDTO dto)
 {
     DataBaseUtility db = new DataBaseUtility();
     string query = "INSERT INTO [dbo].[FoodOrder]([StoreId],[OrderDateTime],[CreatedDateTime],[LastUpdateDateTime])VALUES ( "
                     + "  " + SQLUtility.getInteger(dto.StoreId) + " , '" + SQLUtility.FormateDateYYYYMMDDWtithTime(dto.FoodOrderDate) + "' , '" + SQLUtility.FormateDateYYYYMMDDWtithTime(dto.CreatedDateTime) + "' ,'" + SQLUtility.FormateDateYYYYMMDDWtithTime(dto.LastUpdateDateTime) + "'   ) ";
     db.ExecuteUpdate(query);
 }
Пример #3
0
        public void Add(string name, string role, string emailId)
        {
            try
            {
                string password = "";

                if (name.Length <= 4)
                {
                    password = ValidationUtility.CreatePassword(name.Length + 2);
                }
                else
                {
                    password = ValidationUtility.CreatePassword(name.Length);
                }

                int roleId = ValidationUtility.ToInteger(role);

                DataBaseUtility db = new DataBaseUtility();
                string query = " insert into Users ([UserId],[Password],[RoleId],[EmailId],[CreatedDateTime],[LastUpdateDateTime]) "
                                + " values(" + SQLUtility.getString(name) + "," + SQLUtility.getString(password) + ",  " + SQLUtility.getInteger(roleId) + ",  " + SQLUtility.getString(emailId) + " ,  '" + DateTime.Now.ToString("yyyy/MM/dd hh:mm tt") + "' ,'" + DateTime.Now.ToString("yyyy/MM/dd hh:mm tt") + "' )";
                db.ExecuteUpdate(query);

            }
            catch (Exception ex)
            {
                log.Error(" Exception in Add Method  ", ex);
            }
        }
Пример #4
0
        public void AddActual(ManagerBonusDTO managerBonusDTO)
        {
            DataBaseUtility db = new DataBaseUtility();

            string query = "INSERT INTO [dbo].[ManagerBonus] ([StoreId] ,[LastDateOFMonth] ,[FoodCost] ,[LaborCost] ,[FoodLaborCost] ,[SalesIncrease] ,[CustomerIndex] ,[CustomerComplaint] ,[Catering] ,[SubInspection] ,[CreatedDateTime] ,[LastUpdateDateTime]) "
                           + " VALUES (" + SQLUtility.getInteger(managerBonusDTO.StoreId) + ",'" + SQLUtility.FormateDateYYYYMMDD(managerBonusDTO.LastDateOFMonth) + "',0,0,0,0,0,0,0,0,'" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "')";
            db.ExecuteUpdate(query);
        }
 //Add Employee Clocking Information
 public void AddEmpClockingInfo(int empTrackerId, EmployeeClockingDTO employeeClockingDTO)
 {
     DataBaseUtility db = new DataBaseUtility();
     string query = "INSERT INTO [dbo].[EmployeeClocking]([EmployeeTrackerId],[ClockFunctionTypeId],[ClockingTime],[MinutesWorked],[CreatedDateTime],[LastUpdateDateTime]) "
                 + " VALUES(" + SQLUtility.getInteger(empTrackerId) + "," + SQLUtility.getInteger(employeeClockingDTO.ClockFunctionTypeId) + ",'" + SQLUtility.FormateDateYYYYMMDDWtithTime(employeeClockingDTO.ClockingTime) + "', "
                 + " " + SQLUtility.getInteger(employeeClockingDTO.MinutesWorked) + ",'" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "' )";
     db.ExecuteUpdate(query);
 }
 public void AddEmpInfo(int storeId, EmployeeInfoDTO employeeInfoDTO)
 {
     DataBaseUtility db = new DataBaseUtility();
     string query = "INSERT INTO [dbo].[EmployeeInfo] ([EmpId],[StoreId],[EmpFirstName],[EmpMiddleName],[EmpLastName],[CreatedDateTime],[LastUpdateDateTime]) "
                    + "  VALUES(" + SQLUtility.getInteger(employeeInfoDTO.EmpId) + "," + SQLUtility.getInteger(storeId) + "," + SQLUtility.getString(employeeInfoDTO.EmpFirstName) + "," + SQLUtility.getString(employeeInfoDTO.EmpMiddleName) + ", "
                    + " " + SQLUtility.getString(employeeInfoDTO.EmpLastName) + ",'" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "')";
     db.ExecuteUpdate(query);
 }
Пример #7
0
        public void DeleteComplaintsData(int cId)
        {
            DataBaseUtility db = new DataBaseUtility();

            string query = "delete from dbo.Complaints where Id=" + SQLUtility.getInteger(cId) + "";

            db.ExecuteUpdate(query);
        }
Пример #8
0
        //Add Food order
        public void AddFoodOrderItem(string item)
        {
            DataBaseUtility db = new DataBaseUtility();

            string query = "INSERT INTO [dbo].[FoodItem]([FoodName],[CreatedDateTime],[LastUpdateDateTime]) "
                    + " VALUES(" + SQLUtility.getString(item) + ",'" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "')";

            db.ExecuteUpdate(query);
        }
Пример #9
0
        //Add Inactive Store
        public void AddInactiveStore(StoreDTO storeDTO)
        {
            DataBaseUtility db = new DataBaseUtility();

            string query = "INSERT INTO [dbo].[Store] ([StoreNumber] ,[StoreName] ,[ConnectionString] ,[IsStoreActive] ,[CreatedDateTime] ,[LastUpdateDateTime])  VALUES(" + SQLUtility.getInteger(storeDTO.StoreNumber) + " , "
                + "" + SQLUtility.getString(storeDTO.StoreName) + "," + SQLUtility.getString(storeDTO.ConnectionString) + ",'" + storeDTO.IsActive + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "')";

            db.ExecuteUpdate(query);
        }
Пример #10
0
        public void DeleteFoodItem(int id)
        {
            DataBaseUtility db = new DataBaseUtility();

            string query = "delete from dbo.Orders where ItemId=" + SQLUtility.getInteger(id) + "";
            db.ExecuteUpdate(query);

            query = " delete from dbo.FoodItem where Id=" + SQLUtility.getInteger(id) + "";
            db.ExecuteUpdate(query);
        }
Пример #11
0
        // Add Order by manager
        // one food order have multiple order
        public void AddOrder(OrderDTO dto)
        {
            DataBaseUtility db = new DataBaseUtility();

            string query = " INSERT INTO [dbo].[Orders]([FoodOrderId],[ItemId],[NumberRemaining],[NumberOver],[CreatedDateTime],[LastUpdateDateTime])VALUES ( "
                          + "  " + SQLUtility.getInteger(dto.FoodOrderId) + " , " + SQLUtility.getInteger(dto.ItemId) + " ,  " + SQLUtility.getInteger(dto.NumberRemaining) + " , " + SQLUtility.getInteger(dto.NumberOver) + "  , "
                          + "  '" + SQLUtility.FormateDateYYYYMMDDWtithTime(dto.CreatedDateTime) + "' , '" + SQLUtility.FormateDateYYYYMMDDWtithTime(dto.LastUpdateDateTime) + "' ) ";

            db.ExecuteUpdate(query);
        }
Пример #12
0
        public void AddBounus(ManagerBonusDTO managerBonusDTO, bool isZeroBasis)
        {
            DataBaseUtility db = new DataBaseUtility();

            String query = "INSERT INTO [dbo].[ManagerBonus] ([StoreId] ,[FirstDateOfMonth],[LastDateOfMonth],[FoodCost] ,[LaborCost] ,[FoodLaborCost] ,[SalesIncrease] ,[CustomerIndex] ,[CustomerComplaint]  "
                           + " ,[Catering] ,[SubInspection],[IsZeroBasis] ,[CreatedDateTime] ,[LastUpdateDateTime]) "
                       + " VALUES (" + SQLUtility.getInteger(managerBonusDTO.StoreId) + ", '" + SQLUtility.FormateDateYYYYMMDD(managerBonusDTO.FirstDateOFMonth) + "','" + SQLUtility.FormateDateYYYYMMDD(managerBonusDTO.LastDateOFMonth) + "'," + SQLUtility.getDouble(managerBonusDTO.FoodCost) + "," + SQLUtility.getDouble(managerBonusDTO.LaborCost) + "," + SQLUtility.getDouble(managerBonusDTO.FoodLaborCost) + "," + SQLUtility.getDouble(managerBonusDTO.SalesIncrease) + ", "
                        + " " + SQLUtility.getDouble(managerBonusDTO.CustomerIndex) + "," + SQLUtility.getDouble(managerBonusDTO.CustomerComplaint) + "," + SQLUtility.getDouble(managerBonusDTO.Catering) + ", "
                          + " " + SQLUtility.getDouble(managerBonusDTO.SubInspection) + ",'" + isZeroBasis + "' , '" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "') ";
            db.ExecuteUpdate(query);
        }
        // Get General Manager AssignStore Information
        public ArrayList GetGenMngAssignStore(int userId)
        {
            ArrayList amList = new ArrayList();

            DataBaseUtility db = new DataBaseUtility();

            SqlConnection con = null;

            try
            {

              //  string query = " select su.*,u.UserId as AeaManagerName  from dbo.StoreUser su,dbo.Users u where su.UserId=u.Id and  su.UserId  in(select AreaManagerId from dbo.AssignAreaManagerInfo where GeneralManagerId=" + SQLUtility.getInteger(userId) + " ) ";

              //  string query = "select AreaManagerId from dbo.AssignAreaManagerInfo where GeneralManagerId=" + SQLUtility.getInteger(userId) + " ";

                string query = " select aami.AreaManagerId,u.UserId from dbo.AssignAreaManagerInfo aami,dbo.Users u  where aami.AreaManagerId=u.Id and  aami.GeneralManagerId=" + SQLUtility.getInteger(userId) + " ";
                con = db.OpenConnection();

                SqlCommand comm = db.getSQLCommand(query, con);

                SqlDataReader reader = comm.ExecuteReader();

                while (reader.Read())
                {

                    int uId = ValidationUtility.ToInteger(reader["AreaManagerId"].ToString());

                    string amName = reader["UserId"].ToString();

                    GeneralManagerBonusDTO dto = new GeneralManagerBonusDTO {UserId = uId, AmName = amName };
                    amList.Add(dto);
                }

                reader.Close();
                comm.Dispose();

            }
            catch (Exception ex)
            {

                log.Error(" Exception in  GetGenMngAssignStore Method ", ex);
            }
            finally
            {
                db.CloseConnection(con);
            }

            return amList;
        }
Пример #14
0
        public void AddComplaints(ComplaintsDTO complaintsDTO)
        {
            DataBaseUtility db = new DataBaseUtility();

            //string query = "INSERT INTO [dbo].[Complaints] ([StoreId],[ComplaintDate],[CustomerContacted],[FeedbackReceived],[ProblemFixed],[Comment],[Response] "
            //               + " ,[CreatedDateTime],[LastUpdateDateTime]) VALUES(" + SQLUtility.getInteger(complaintsDTO.StoreId) + ",'" + SQLUtility.FormateDateYYYYMMDDWtithTime(complaintsDTO.ComplaintDate) + "' ,"
            //              + " '" + complaintsDTO.CustomerContacted + "','" + complaintsDTO.FeedbackRecieved + "','" + complaintsDTO.ProblemFixed + "',"
            //                + " " + SQLUtility.getString(complaintsDTO.Comment) + ", " + SQLUtility.getString(complaintsDTO.Response) + ",'" + SQLUtility.FormateDateYYYYMMDDWtithTime(complaintsDTO.CreatedDateTime) + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(complaintsDTO.LastUpdateDateTime) + "' )";

            string query = "INSERT INTO [dbo].[Complaints] ([StoreId] ,[ComplaintDate],[CustomerContacted] ,[FeedbackReceived],[ProblemFixed] ,[EmailedSubway] "
                           +" ,[Comment],[Response],[Name] ,[Telephone] ,[Email],[CreatedDateTime] ,[LastUpdateDateTime]) "
                            + " VALUES(" + SQLUtility.getInteger(complaintsDTO.StoreId) + ",'" + SQLUtility.FormateDateYYYYMMDD(complaintsDTO.ComplaintDate) + "', '" + complaintsDTO.CustomerContacted + "','"+complaintsDTO.FeedbackRecieved+"', "
                             + " '" + complaintsDTO.ProblemFixed + "','" + complaintsDTO.EmailedSubway + "'," + SQLUtility.getString(ValidationUtility.TruncateString(complaintsDTO.Comment, 500)) + "," + SQLUtility.getString(ValidationUtility.TruncateString(complaintsDTO.Response, 500)) + "," + SQLUtility.getString(complaintsDTO.Name) + "," + SQLUtility.getString(complaintsDTO.TelePhone) + "," + SQLUtility.getString(complaintsDTO.Email) + ",'" + SQLUtility.FormateDateYYYYMMDDWtithTime(complaintsDTO.CreatedDateTime) + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(complaintsDTO.LastUpdateDateTime) + "')";
            db.ExecuteUpdate(query);
        }
Пример #15
0
        public void DeleteMaintenanceRequest(int id)
        {
            DataBaseUtility db = new DataBaseUtility();

            try
            {
                string query = " delete from dbo.StoreMaintainance where Id = " + SQLUtility.getInteger(id) + "  ";

                db.ExecuteUpdate(query);
            }
            catch (Exception ex)
            {
                log.Error(" Exception in  DeleteMaintenanceRequest Method ", ex);
            }
        }
Пример #16
0
        //Method use  for General Manager
        public void AddAssignAreaManager(int gmId, int amId)
        {
            DataBaseUtility db = new DataBaseUtility();

            if (IsAreaManagerExist(amId))
            {
                string deleteQuery = "delete from dbo.AssignAreaManagerInfo where AreaManagerId=" + SQLUtility.getInteger(amId) + "";
                db.ExecuteUpdate(deleteQuery);
            }

            string query = "INSERT INTO [dbo].[AssignAreaManagerInfo] ([GeneralManagerId] ,[AreaManagerId] ,[CreatedDateTime] ,[LastUpdateDateTime]) "
                         + " VALUES (" + SQLUtility.getInteger(gmId) + "," + SQLUtility.getInteger(amId) + ",'" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "')";

            db.ExecuteUpdate(query);
        }
Пример #17
0
        // Store Functionality
        public void AddStore(int sNumber, string sName, string connectionString)
        {
            try
            {

                DataBaseUtility db = new DataBaseUtility();
                string query = " INSERT [dbo].[Store]([StoreNumber],[StoreName],[ConnectionString]) VALUES(" + SQLUtility.getInteger(sNumber) + " , "
                   + " " + SQLUtility.getString(sName) + "," + SQLUtility.getString(connectionString) + "  ) ";

                db.ExecuteUpdate(query);
            }
            catch (Exception ex)
            {
                log.Error(" Exception in AddStore Method  ", ex);
            }
        }
        public void AddPaperWork(ArrayList list)
        {
            foreach (WeeklyPaperworkDTO dto in list)
            {
                DataBaseUtility db = new DataBaseUtility();
                string query = "INSERT INTO [dbo].[WeeklyPaperWork]([StoreId],[NetSales],[GiftCardSales],[AR],[PaidOuts],[PettyExpense],[Total],[StoreTransfer],[PFG1],[PFG2],[TotalPFG],[Coke],[TotalCost],[CostPercent],[LaborCost],[LaborCostPercent],[Royalty],[FAF],[CostAndLaborCostPercent],[AdjTax],[GCRedeem],[GCDifference],[TaxPercent], "
                            + "  [ActualSalesTaxper],[DifferenceOfSalesTax],[NonTaxableSale],[WeekStartDate],[CreatedDateTime],[LastUpdateDateTime]) "
                    + " VALUES (" + SQLUtility.getInteger(dto.StoreId) + " , " + SQLUtility.getDouble(dto.NetSales) + " ," + SQLUtility.getDouble(dto.GiftCardSales) + "," + SQLUtility.getDouble(dto.Ar) + "," + SQLUtility.getDouble(dto.PaidOuts) + "," + SQLUtility.getDouble(dto.PettyExpense) + ", "
                   + " " + SQLUtility.getDouble(dto.Total) + "," + SQLUtility.getDouble(dto.StoreTransfer) + "," + SQLUtility.getDouble(dto.Pfg1) + "," + SQLUtility.getDouble(dto.Pfg2) + "," + SQLUtility.getDouble(dto.TotalPFG) + "," + SQLUtility.getDouble(dto.Coke) + "," + SQLUtility.getDouble(dto.TotalCost) + ", "
                    + " " + SQLUtility.getDouble(dto.CostPercent) + "," + SQLUtility.getDouble(dto.LaborCost) + "," + SQLUtility.getDouble(dto.LaborCostPercent) + "," + SQLUtility.getDouble(dto.Royalty) + "," + SQLUtility.getDouble(dto.Faf) + "," + SQLUtility.getDouble(dto.CostAndLaborCostPercent) + "," + SQLUtility.getDouble(dto.AdjTax) + "," + SQLUtility.getDouble(dto.GcRedeem) + "," + SQLUtility.getDouble(dto.GcDifference) + ", "
                    + " " + SQLUtility.getDouble(dto.TaxPercent) + ", " + SQLUtility.getDouble(dto.ActualSalesTaxper) + "," + SQLUtility.getDouble(dto.DifferenceOfSalesTax) + "," + SQLUtility.getDouble(dto.NonTaxableSale) + ",'" + SQLUtility.FormateDateYYYYMMDD(dto.WeekStartDate) + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "')";

                db.ExecuteUpdate(query);

            }
        }
Пример #19
0
        public void AddUserStore(int storeId, int userId)
        {
            try
            {

                DataBaseUtility db = new DataBaseUtility();
                string query = " INSERT [dbo].[StoreUser]([StoreId],[UserId],[CreatedDateTime],[LastUpdateDateTime]) VALUES(" + SQLUtility.getInteger(storeId) + " , "
                   + " " + SQLUtility.getInteger(userId) + " , '" + DateTime.Now.ToString("yyyy/MM/dd hh:mm tt") + "' ,'" + DateTime.Now.ToString("yyyy/MM/dd hh:mm tt") + "' ) ";

                db.ExecuteUpdate(query);
            }
            catch (Exception ex)
            {
                log.Error(" Exception in  AddUserStore Method ", ex);
            }
        }
Пример #20
0
        public ArrayList GetFoodItemList()
        {
            DataBaseUtility db = new DataBaseUtility();

            SqlConnection con = null;

            ArrayList list = new ArrayList();

            try
            {
                string query = "select Id,FoodName from dbo.FoodItem order by Id desc";

                //string query = "select Id,StoreId,BusinessDate,Item,ItemQuantity,LeftQuantity,OverQuantity from FoodOrder  WHERE BusinessDate BETWEEN '" + SQLUtility.FormateDateYYYYMMDD(weekStartDate) + "' AND '" + SQLUtility.FormateDateYYYYMMDD(weekEndDate) + "'";
                con = db.OpenConnection();

                SqlCommand comm = db.getSQLCommand(query, con);

                SqlDataReader reader = comm.ExecuteReader();

                while (reader.Read())
                {

                    int id = ValidationUtility.ToInteger(reader[0].ToString());
                    string foodName = reader[1].ToString();

                    FoodItemDTO dto = new FoodItemDTO { Id = id, FoodName = foodName };

                    list.Add(dto);

                }

                reader.Close();
                comm.Dispose();

            }
            catch (Exception ex)
            {
                log.Error(" Exception in GetFoodItemList Method  ", ex);

            }
            finally
            {
                db.CloseConnection(con);
            }

            return list;
        }
Пример #21
0
        public void AddMaintenanceRequest(MaintenanceDTO dto)
        {
            // string query = "insert into StoreMaintainance "

            try
            {
                DataBaseUtility db = new DataBaseUtility();
                string query = "INSERT INTO [dbo].[StoreMaintainance]([StoreId],[MaintenanceCategoryId],[Description],[status],[DateCreated]) VALUES "
                                + "(" + SQLUtility.getInteger(dto.StoreId) + ", " + SQLUtility.getInteger(dto.CategoryId) + " ," + SQLUtility.getString(dto.Description) + " , "
                                +  "  "+SQLUtility.getString(dto.Status)+" , '" + DateTime.Now.ToString("yyyy/MM/dd hh:mm tt") + "'   )";
                db.ExecuteUpdate(query);
            }
            catch (Exception ex)
            {
                log.Error(" Exception in  AddMaintenanceRequest Method ", ex);
            }
        }
        public void AddNewEmployeeInTracking(int empInfoId, DateTime date)
        {
            DateTime weekStartDate = ValidationUtility.GetActualWeekStartDate(date);

            DataBaseUtility db = new DataBaseUtility();

            for (int i = 0; i < 7; i++)
            {
                DateTime businessDate = weekStartDate.AddDays(i);

                EmployeeTrackerDTO employeeTrackerDTO = new EmployeeTrackerDTO();

                string query = "INSERT INTO [dbo].[EmployeeTracker]([BusinessDate],[EmployeeInfoId],[ScheduleIn],[ScheduleOut],[TotalTimeWorked],[CreatedDateTime],[LastUpdateDateTime]) "
                          + "  VALUES('" + SQLUtility.FormateDateYYYYMMDD(businessDate) + "'," + SQLUtility.getInteger(empInfoId) + ",'" + SQLUtility.FormateDateYYYYMMDDWtithTime(employeeTrackerDTO.ScheduleIn) + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(employeeTrackerDTO.ScheduleOut) + "', "
                            + " '00:00:00','" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "','" + SQLUtility.FormateDateYYYYMMDDWtithTime(DateTime.Now) + "' )";
                db.ExecuteUpdate(query);
            }
        }
Пример #23
0
        // Get AreaManager AssignStore Information
        public ArrayList GetAreaMngAssignStore(int userId)
        {
            ArrayList assigneStore = new ArrayList();

            DataBaseUtility db = new DataBaseUtility();

            SqlConnection con = null;

            try
            {

                string query = "select su.Id,s.StoreName,s.Id from dbo.StoreUser su, dbo.Store s where s.Id = su.StoreId and su.UserId = " + SQLUtility.getInteger(userId) + " ";

                con = db.OpenConnection();

                SqlCommand comm = db.getSQLCommand(query, con);

                SqlDataReader reader = comm.ExecuteReader();

                while (reader.Read())
                {
                    int uId = ValidationUtility.ToInteger(reader[0].ToString());
                    string storeName = reader[1].ToString();
                    int sId = ValidationUtility.ToInteger(reader[2].ToString());
                    StoreDTO dto = new StoreDTO { Id = uId, StoreName = storeName, StoreId = sId };
                    assigneStore.Add(dto);
                }

                reader.Close();
                comm.Dispose();

            }
            catch (Exception ex)
            {

                log.Error(" Exception in  GetAreaMngAssignStore Method ", ex);
            }
            finally
            {
                db.CloseConnection(con);
            }

            return assigneStore;
        }
Пример #24
0
        public static int GetActiveStoredId(int userId)
        {
            DataBaseUtility db = new DataBaseUtility();

            SqlConnection con = null;

            int storId = 0;

            try
            {
                string query = " select Id from dbo.Store where Id in(select StoreId from StoreUser where UserId = " + SQLUtility.getInteger(userId) + ")  and IsStoreActive='true'";

                con = db.OpenConnection();

                SqlCommand comm = db.getSQLCommand(query, con);

                SqlDataReader reader = comm.ExecuteReader();

                if (reader.Read())
                {
                    storId = ValidationUtility.ToInteger(reader[0].ToString());
                }

                reader.Close();
                comm.Dispose();
            }
            catch (Exception ex)
            {
                log.Error(" Exception in GetStoredId Method  ", ex);

            }
            finally
            {
                db.CloseConnection(con);
            }

            return storId;
        }
Пример #25
0
        public DataTable GetEmpInfo()
        {
            //  string query = " select AmtTotalSales as TOTAL_SUBWAY_SALES, QtyFootlongs as FOOT_LONG, Qty6Inches as INCH_6, Qty3Inches INCH_3, QtyMuffinMelt as MUFF_IN_MELT , QtySalads as SALAD ,QtyPizzas as PIZZA , AmtCateringSales as CATERING , AmtTotalRefund as REFUNDS , AmtSubwayVoid as VOIDS, AmtUnitSales as TOTAL_UNIT_SALES , AmtDrinkSales as TOTAL_DRINK_SALES  from Report.DrawersSummary where OpeningInformationId in (select OpeningInformationId from dbo.OpeningInformation where BusinessDate between '" + weekDate.ToString("yyyy/MM/dd") + "' and '" + nextDate.ToString("yyyy/MM/dd") + "'  )";

            DataTable drawersSummaryTable = null;

            try
            {
                string query = "select  emp.FirstName , emp.MiddleName, emp.LastName"
                                 + ", uc.ClockingTime,uc.MinutesWorked, uc.InsertedDate from dbo.UserClocking uc, dbo.Employees emp where emp.EmployeeId = uc.EmployeeId";

                DataBaseUtility db = new DataBaseUtility();

                drawersSummaryTable = db.FetchData(query);

            }
            catch (Exception ex)
            {
                log.Error(" Exception in GetEmpInfo Method  ", ex);
            }

            return drawersSummaryTable;
        }
Пример #26
0
        public ArrayList GetBonusEmpName(int userId, string connectionString, DateTime businessDate)
        {
            DataBaseUtility db = new DataBaseUtility();

            SqlConnection con = null;

            ArrayList list = new ArrayList();

            DateTime weekStartDate = GetActualWeekStartDate(businessDate);
            DateTime secondDate = weekStartDate.AddDays(1);
            DateTime thirdDate = weekStartDate.AddDays(2);
            DateTime fourDate = weekStartDate.AddDays(3);
            DateTime fiveDate = weekStartDate.AddDays(4);
            DateTime sixDate = weekStartDate.AddDays(5);
            DateTime sevenDate = weekStartDate.AddDays(6);

            ArrayList DateList = new ArrayList();
            DateList.Add(weekStartDate);
            DateList.Add(secondDate);
            DateList.Add(thirdDate);
            DateList.Add(fourDate);
            DateList.Add(fiveDate);
            DateList.Add(sixDate);
            DateList.Add(sevenDate);

            try
            {
                string query = null;

                con = db.OpenConnection();

                foreach (DateTime date in DateList)
                {
                    query = " select EmployeeId, FirstName,LastName,BusinessDate from dbo.EmployeeBonus  where StoreId  in (select StoreId  from dbo.StoreUser where UserId =" + SQLUtility.getInteger(userId) + ") and BusinessDate='" + date.ToString("yyyy/MM/dd") + "'";

                    SqlCommand comm = db.getSQLCommand(query, con);

                    SqlDataReader reader = comm.ExecuteReader();

                    while (reader.Read())
                    {
                        int emoId = ValidationUtility.ToInteger(reader[0].ToString());
                        string firstName = reader[1].ToString();
                        string lastName = reader[2].ToString();
                        EmpBonusDTO dto = new EmpBonusDTO { EmployeeId = emoId, FirstName = firstName, LastName = lastName, BusinessDateStringType = date.ToString("MM/dd/yyyy") };

                        list.Add(dto);

                    }

                    reader.Close();
                    comm.Dispose();

                }

            }
            catch (Exception ex)
            {
                log.Error("Exception in GetPerdaySales method  ", ex);

            }
            finally
            {
                db.CloseConnection(con);
            }

            return list;
        }
Пример #27
0
        public void UpdatePerdaySales(double perDaySalesAmount, int storeId, DateTime bussnessDate, int opId)
        {
            bool isCurrentDateSale = IsCurrentDateSaleIsExsist(storeId, bussnessDate);

            DataBaseUtility db = new DataBaseUtility();

            if (isCurrentDateSale)
            {

                string query = " update dbo.PerdaySales set  SalesAmount = " + SQLUtility.getDouble(perDaySalesAmount) + "  , OpeningInformationId = " + SQLUtility.getInteger(opId) + " , "
                              + " LastUpdateDateTime = '" + DateTime.Now.ToString("yyyy/MM/dd hh:mm tt") + "' where StoreId =  " + SQLUtility.getInteger(storeId) + " and BusinessDate = '" + bussnessDate.ToString("yyyy/MM/dd") + "' ";

                db.ExecuteUpdate(query);

            }
            else
            {
                string query = " INSERT INTO [dbo].[PerdaySales]([StoreId],[OpeningInformationId],[BusinessDate],[SalesAmount],[WeekOfDay],[CreatedDateTime],[LastUpdateDateTime]) VALUES "
                    + " (" + SQLUtility.getInteger(storeId) + ", " + SQLUtility.getInteger(opId) + " , '" + SQLUtility.FormateDateYYYYMMDD(bussnessDate) + "' ," + SQLUtility.getDouble(perDaySalesAmount) + " , " + SQLUtility.getString(bussnessDate.DayOfWeek.ToString()) + " , "
                    + " '" + DateTime.Now.ToString("yyyy/MM/dd hh:mm tt") + "' , '" + DateTime.Now.ToString("yyyy/MM/dd hh:mm tt") + "')  ";
                db.ExecuteUpdate(query);

            }
        }
Пример #28
0
        // Method is use for Get perday total sales amount day
        public bool IsCurrentDateSaleIsExsist(int storeId, DateTime currentDate)
        {
            DataBaseUtility db = new DataBaseUtility();

            SqlConnection con = null;

            bool isCurrentDateSale = false;

            try
            {

                string query = "  select * from dbo.PerdaySales where BusinessDate = '" + currentDate.ToString("yyyy/MM/dd") + "' and StoreId = " + SQLUtility.getInteger(storeId) + " ";

                con = db.OpenConnection();

                SqlCommand comm = db.getSQLCommand(query, con);

                SqlDataReader reader = comm.ExecuteReader();

                if (reader.Read())
                {
                    isCurrentDateSale = true;

                }

                reader.Close();
                comm.Dispose();

            }
            catch (Exception ex)
            {
                log.Error("Exception in IsCurrentDateSaleIsExsist method  ", ex);
            }
            finally
            {
                db.CloseConnection(con);
            }

            return isCurrentDateSale;
        }
Пример #29
0
        public ArrayList GetRecodSaleList(int userId, DateTime selectedDate)
        {
            DateTime dt = Convert.ToDateTime(selectedDate);

               // DateTime weekStartDate =  GetActualWeekStartDate(DateTime.Now);

            DateTime weekStartDate = GetActualWeekStartDate(dt);

            weekStartDate = weekStartDate.AddDays(-1);

            DataBaseUtility db = new DataBaseUtility();

            SqlConnection con = null;

            ArrayList list = new ArrayList();

            try
            {

                string query = " select * from dbo.RecordSales where StoreId  in (select StoreId  from dbo.StoreUser where UserId = " + SQLUtility.getInteger(userId) + ")";

                con = db.OpenConnection();

                SqlCommand comm = db.getSQLCommand(query, con);

                SqlDataReader reader = comm.ExecuteReader();

                while (reader.Read())
                {
                    weekStartDate = weekStartDate.AddDays(1);
                    string weekDate = weekStartDate.ToString("MM/dd/yyyy");
                    RecordSalesDTO dto = null;
                    int id = ValidationUtility.ToInteger(reader[0].ToString());
                    int sid = ValidationUtility.ToInteger(reader[1].ToString());
                    string day = reader[2].ToString();
                    DateTime businessDate = ValidationUtility.ToDate(reader[3].ToString());
                    double salesAmount = ValidationUtility.ToDouble(reader[4].ToString());

                    //if (!ValidationUtility.IsEqual("01-01-0001 00:00:00", BusinessDate.ToString()) || !ValidationUtility.IsEqual("1/1/0001 12:00:00 AM", BusinessDate.ToString()))
                    if (ValidationUtility.FormateDateYYYYMMDD(ValidationUtility.GetDefaultDate()).Equals(ValidationUtility.FormateDateYYYYMMDD(businessDate)))
                    {
                        dto = new RecordSalesDTO { Id = id, StoreId = sid, DayOfWeek = day.Substring(0, 3).ToUpper(), WeekDayDate = weekDate, BusinessDateStringType = "N/A", SalesAmountStringType = "N/A" };
                        //dto = new RecordSalesDTO { Id = id, StoreId = sid, DayOfWeek = day.Substring(0, 3).ToUpper(), WeekDayDate = weekDate, BusinessDateStringType = BusinessDate.ToString("MM/dd/yyyy"), SalesAmountStringType = salesAmount.ToString() };
                    }
                    //else if (ValidationUtility.IsEqual("1/1/0001 12:00:00 AM", BusinessDate.ToString()))
                    //{
                    //    dto = new RecordSalesDTO { Id = id, StoreId = sid, DayOfWeek = day.Substring(0, 3).ToUpper(), WeekDayDate = weekDate, BusinessDateStringType = "N/A", SalesAmountStringType = "N/A" };
                    //   // dto = new RecordSalesDTO { Id = id, StoreId = sid, DayOfWeek = day.Substring(0, 3).ToUpper(), WeekDayDate = weekDate, BusinessDateStringType = BusinessDate.ToString("MM/dd/yyyy"), SalesAmountStringType = salesAmount.ToString() };
                    //}
                    else
                    {
                        dto = new RecordSalesDTO { Id = id, StoreId = sid, DayOfWeek = day.Substring(0, 3).ToUpper(), WeekDayDate = weekDate, BusinessDateStringType = businessDate.ToString("MM/dd/yyyy"), SalesAmountStringType = salesAmount.ToString() };
                       // dto = new RecordSalesDTO { Id = id, StoreId = sid, DayOfWeek = day.Substring(0, 3).ToUpper(), WeekDayDate = weekDate, BusinessDateStringType = "N/A", SalesAmountStringType = "N/A" };
                    }

                    list.Add(dto);

                }

                reader.Close();
                comm.Dispose();

            }
            catch (Exception ex)
            {
                log.Error("Exception in GetRecodSaleList method  ", ex);
            }
            finally
            {
                db.CloseConnection(con);
            }

            return list;
        }
Пример #30
0
        public ArrayList GetPerdaySales(int userId, string connectionString, DateTime businessDate)
        {
            DataBaseUtility db = new DataBaseUtility();

            SqlConnection con = null;

            ArrayList list = new ArrayList();

            DateTime weekStartDate = GetActualWeekStartDate(businessDate);
            DateTime secondDate = weekStartDate.AddDays(1);
            DateTime thirdDate = weekStartDate.AddDays(2);
            DateTime fourDate = weekStartDate.AddDays(3);
            DateTime fiveDate = weekStartDate.AddDays(4);
            DateTime sixDate = weekStartDate.AddDays(5);
            DateTime sevenDate = weekStartDate.AddDays(6);

            ArrayList DateList = new ArrayList();
            DateList.Add(weekStartDate);
            DateList.Add(secondDate);
            DateList.Add(thirdDate);
            DateList.Add(fourDate);
            DateList.Add(fiveDate);
            DateList.Add(sixDate);
            DateList.Add(sevenDate);

            try
            {
                string query = null;

                con = db.OpenConnection();

                foreach (DateTime date in DateList)
                {
                    query = " select * from dbo.PerdaySales where StoreId  in (select StoreId  from dbo.StoreUser where UserId =" + SQLUtility.getInteger(userId) + ") and BusinessDate='" + date.ToString("yyyy/MM/dd") + "'";

                    SqlCommand comm = db.getSQLCommand(query, con);

                    SqlDataReader reader = comm.ExecuteReader();

                    if (reader.Read())
                    {
                        int id = ValidationUtility.ToInteger(reader[0].ToString());
                        int sid = ValidationUtility.ToInteger(reader[1].ToString());
                        int openingInformationId = ValidationUtility.ToInteger(reader[2].ToString());
                        double salesAmount = ValidationUtility.ToDouble(reader[4].ToString());
                        string day = reader[5].ToString();

                        if (openingInformationId == 0 && !ValidationUtility.IsEqual(day, DateTime.Now.DayOfWeek.ToString()))
                        {
                            PerdaySalesDTO dto = new PerdaySalesDTO { Id = id, StoreId = sid, OpeningInformationId = openingInformationId, BusinessDate = date, SalesAmountString = "N/A", WeekOfDay = day };

                            list.Add(dto);
                        }
                        else
                        {
                            PerdaySalesDTO dto = new PerdaySalesDTO { Id = id, StoreId = sid, OpeningInformationId = openingInformationId, BusinessDate = date, SalesAmountString = salesAmount.ToString(), WeekOfDay = day };

                            list.Add(dto);
                        }

                    }
                    else
                    {
                        reader.Close();
                        comm.Dispose();
                        PerdaySalesDTO dto = null;
                        if (date<=DateTime.Now)
                        {
                            int id = GetCurrentDateOpeningInfoId(date, connectionString);

                            if (id == 0)
                            {
                                dto = new PerdaySalesDTO { SalesAmountString = "N/A" };
                                list.Add(dto);
                            }
                            else
                            {
                                dto = new PerdaySalesDTO { SalesAmountString = "0" };
                                list.Add(dto);
                            }
                        }
                        else
                        {
                            dto = new PerdaySalesDTO { SalesAmountString = "0" };
                            list.Add(dto);
                        }

                    }

                    reader.Close();
                    comm.Dispose();

                }

            }
            catch (Exception ex)
            {
                log.Error("Exception in GetPerdaySales method  ", ex);

            }
            finally
            {
                db.CloseConnection(con);
            }

            return list;
        }