Example #1
0
        private bool DeleteQueFromDb(Que que)

        {
            bool Issuccess = false;

            try

            {
                string sqlQueDelter = @"DELETE From Que Where [UserId]=@UserId And [CustomerId] = @CustomerId And [EmployeeId] = @EmployeeId And [FromDate]=@FromDate And [ToDate]=@ToDate And [QueType]=@QueType";

                DataBaseRetriever db = new DataBaseRetriever(ConfigManager.ConnectionString);

                var affectedRows = db.Execute(sqlQueDelter, 1, que);
            }

            catch (Exception ex)

            {
                Logger.Write(ex);

                Issuccess = false;
            }



            Issuccess = true;

            return(Issuccess);
        }
Example #2
0
        private bool AddQueToDb(Que que)

        {
            bool Issuccess = false;

            try

            {
                string sqlQueInsert = @"INSERT INTO Que ([UserId],[FromDate],[ToDate],[QueType],[EmployeeId],[CustomerId],[GroupId]) Values

                (@UserId,@FromDate,@ToDate,@QueType,@EmployeeId,@CustomerId,@GroupId);";

                DataBaseRetriever db = new DataBaseRetriever(ConfigManager.ConnectionString);

                var affectedRows = db.Execute(sqlQueInsert, 1, que);
                if (affectedRows > 0)
                {
                    Task.Factory.StartNew(() => AddCusomersToUsers(que.UserId, que.CustomerId));
                }
            }

            catch (Exception ex)

            {
                Logger.Write(ex);

                Issuccess = false;
            }



            Issuccess = true;

            return(Issuccess);
        }
Example #3
0
 private void updateMessageStatus(int queId)
 {
     try
     {
         string            sqlUpdate = "UPDATE Que SET [IsMessageSent]=1 where [id]=@QueId;";
         DataBaseRetriever db        = new DataBaseRetriever(ConfigManager.ConnectionString);
         var affectedRows            = db.Execute(sqlUpdate, 1, new { QueId = queId });
     }
     catch (Exception ex)
     {
         Logger.Write(ex);
     }
 }
Example #4
0
        public string DeleteGroup(string guid, int groupId)
        {
            if (!IsCustomerExist(guid))
            {
                return("ארעה שגיאה");
            }
            try
            {
                string            sqlUpdate = "Delete FROM GroupsCustomers where [GroupId]=@GroupId;";
                DataBaseRetriever db        = new DataBaseRetriever(ConfigManager.ConnectionString);
                var affectedRows            = db.Execute(sqlUpdate, 1, new { GroupId = groupId });

                string sqlUpdate2    = "Delete FROM Groups where [GroupId]=@GroupId;";
                var    affectedRows2 = db.Execute(sqlUpdate2, 1, new { GroupId = groupId });
            }
            catch (Exception ex)
            {
                Logger.Write(ex);
                return("ארעה שגיאה");
            }
            return("");
        }
Example #5
0
        private void AddCusomersToUsers(int userId, int customerId)
        {
            string sql = "Select count(1) from UsersToCusomers Where [UserId]=@UserId And [CustomerId]=@CustomerId;";

            DataBaseRetriever db = new DataBaseRetriever(ConfigManager.ConnectionString);

            bool isExist = db.IsExist(sql, new { UserId = userId, CustomerId = customerId }, 1);

            if (!isExist)
            {
                string sqlUserCustomerInsert = @"INSERT INTO UsersToCusomers ([UserId],[CustomerId]) Values

                        (@UserId,@CustomerId);";

                var Rows = db.Execute(sqlUserCustomerInsert, 1, new { UserId = userId, CustomerId = customerId });
            }
        }
Example #6
0
 public string DeleteQue(string decryptedQueId)
 {
     try
     {
         SecureData sec   = new SecureData();
         string     queId = sec.DecryptTextWithNoSpecialCharecters(decryptedQueId, "shalomHa!@");
         //IsApproved field
         string            sqlUpdate = "Delete FROM Que where [id]=@QueId;";
         DataBaseRetriever db        = new DataBaseRetriever(ConfigManager.ConnectionString);
         var affectedRows            = db.Execute(sqlUpdate, 1, new { QueId = queId });
     }
     catch (Exception ex)
     {
         Logger.Write(ex);
         return("ארעה שגיאה");
     }
     return("");
 }