コード例 #1
0
        public PrimitiveResponse Post(EarthquakeDto model)
        {
            var prms = new Dictionary <string, SqlParam>();

            prms.Add("@StationId", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.StationId
            });
            prms.Add("@HarmLevel", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.HarmLevel
            });
            prms.Add("@EarthquakeType", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.EarthquakeType
            });
            var result = _baseService.ExecuteNonQuery("sp_PostEarthquake", prms);
            PrimitiveResponse primitiveResult;

            if (result > 0)
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.Successful, ResponseMessage = "Insert successfully."
                };
            }
            else
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.UpdateNotCompleted, ResponseErrorMessage = "Canceled could not be completed."
                };
            }
            return(primitiveResult);
        }
コード例 #2
0
        public PrimitiveResponse Delete(int id)
        {
            var prms = new Dictionary <string, SqlParam>();

            prms.Add("@Id", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Int, Value = id
            });
            var result = _baseService.ExecuteNonQuery("sp_DeleteGroup", prms);
            PrimitiveResponse primitiveResult;

            if (result > 0)
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.Successful, ResponseMessage = "Delete successfully."
                };
            }
            else
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.DeleteNotCompleted, ResponseErrorMessage = "Canceled could not be completed."
                };
            }
            return(primitiveResult);
        }
コード例 #3
0
        public PrimitiveResponse SendSmsActiveUser(TwilioDto model)
        {
            var prms     = new Dictionary <string, SqlParam>();
            var result   = _baseService.QueryWithMultiOutput <UserDto>("sp_GetActiveUserList", prms);
            var userList = result.Item1.ToList();
            PrimitiveResponse primitiveResult = null;

            try
            {
                foreach (var item in userList)
                {
                    item.PhoneNumber = "+9" + item.PhoneNumber;
                    //TwilioService.SendSMS(new TwilioDto { PhoneNumber = item.PhoneNumber, Content = model.Content });
                }
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode    = ResponseCodes.Successful,
                    ResponseMessage = "Send Sms Success."
                };
            }
            catch (Exception ex)
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.ServiceError, ResponseMessage = ex.Message
                };
            }
            return(primitiveResult);
        }
コード例 #4
0
ファイル: FriendsService.cs プロジェクト: barlasayaz/Quake
        public PrimitiveResponse Delete(int groupId, List <UserDto> model)
        {
            PrimitiveResponse primitiveResult = null;
            var friendsCount = this.IsGroupToDeleteFriends(groupId, model);

            if (friendsCount == 0)
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.Successful, ResponseMessage = "Bu grupta silecek arkadaş yok!"
                };
            }
            else
            {
                foreach (var item in model)
                {
                    var prms = new Dictionary <string, SqlParam>();
                    prms.Add("@GroupId", new SqlParam()
                    {
                        Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Int, Value = groupId
                    });
                    prms.Add("@FriendUserId", new SqlParam()
                    {
                        Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = item.Id
                    });
                    var result = _baseService.ExecuteNonQuery("sp_DeleteFriends", prms);
                }
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.Successful, ResponseMessage = "Delete successfully."
                };
            }
            return(primitiveResult);
        }
コード例 #5
0
        public PrimitiveResponse SendSms(List <TwilioDto> model)
        {
            PrimitiveResponse primitiveResult = null;

            try
            {
                foreach (var item in model)
                {
                    item.PhoneNumber = "+9" + item.PhoneNumber;
                    TwilioService.SendSMS(item);
                }
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode    = ResponseCodes.Successful,
                    ResponseMessage = "Send Sms Success."
                };
            }
            catch (Exception ex)
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.ServiceError, ResponseMessage = ex.Message
                };
            }
            return(primitiveResult);
        }
コード例 #6
0
ファイル: GiftService.cs プロジェクト: barlasayaz/Quake
        public PrimitiveResponse GiftPopupShown(int userId)
        {
            PrimitiveResponse primitiveResult = null;
            var prms = new Dictionary <string, SqlParam>();

            prms.Add("@UserId", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Int, Value = userId
            });
            var result = _baseService.ExecuteNonQuery("sp_GiftPopupShown", prms);

            primitiveResult = new PrimitiveResponse()
            {
                ResponseCode = ResponseCodes.Successful, ResponseMessage = "Insert successfully."
            };
            return(primitiveResult);
        }
コード例 #7
0
ファイル: FriendsService.cs プロジェクト: barlasayaz/Quake
        public PrimitiveResponse AddFriendsToGroup(int groupId, List <UserDto> model)
        {
            UserDto           me = this.GetUser(groupId);
            PrimitiveResponse primitiveResult = null;
            int groupCount = this.GetGroupCount(groupId);

            if (groupCount == 0)
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.InsertNotCompleted, ResponseMessage = groupId + " Id'li bir grup yok!"
                };
            }
            else if (model.Where(x => x.PhoneNumber == me.PhoneNumber).ToList().Count != 0)
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.InsertNotCompleted, ResponseMessage = "Kişi kendini gruplara ekleyemez!"
                };
            }
            else
            {
                foreach (var item in model)
                {
                    var prms = new Dictionary <string, SqlParam>();
                    prms.Add("@GroupId", new SqlParam()
                    {
                        Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Int, Value = groupId
                    });
                    prms.Add("@PhoneNumber", new SqlParam()
                    {
                        Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = item.PhoneNumber
                    });
                    var result = _baseService.ExecuteNonQuery("sp_AddFriendsToGroup", prms);
                    TwilioService.SendSMS(new TwilioDto {
                        Content = me.FirstName + " " + me.LastName + " adlı arkadaşınız sizi 7TP Deprem Erken Uyarı Sistemine davet ediyor. Uygulamayı indirmek için http://7tpbilisim.com/store/ adresine gidebilirsiniz.", PhoneNumber = "+9" + item.PhoneNumber
                    });
                }
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.Successful, ResponseMessage = "Insert successfully."
                };
            }
            return(primitiveResult);
        }
コード例 #8
0
ファイル: FriendsService.cs プロジェクト: barlasayaz/Quake
        public PrimitiveResponse InviteToAnswer(UserInvitedDto model)
        {
            PrimitiveResponse primitiveResult = null;
            var prms = new Dictionary <string, SqlParam>();

            prms.Add("@Id", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Int, Value = model.Id
            });
            prms.Add("@FriendshipStatus", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Int, Value = model.FriendshipStatus
            });
            var result = _baseService.ExecuteNonQuery("sp_InviteToAcceptOrReject", prms);

            primitiveResult = new PrimitiveResponse()
            {
                ResponseCode = ResponseCodes.Successful, ResponseMessage = "Insert successfully."
            };
            return(primitiveResult);
        }
コード例 #9
0
        public PrimitiveResponse ImSafe(UserDto model)
        {
            PrimitiveResponse primitiveResult = null;
            var prms = new Dictionary <string, SqlParam>();

            prms.Add("@Id", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Int, Value = model.Id
            });
            prms.Add("@LastLocation", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.LastLocation
            });
            var result = _baseService.ExecuteNonQuery("sp_ImSafe", prms);

            primitiveResult = new PrimitiveResponse()
            {
                ResponseCode = ResponseCodes.Successful, ResponseMessage = "Insert successfully."
            };
            return(primitiveResult);
        }
コード例 #10
0
        public PrimitiveResponse Post(GroupDto model)
        {
            var prms = new Dictionary <string, SqlParam>();

            prms.Add("@UserId", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Int, Value = model.UserId
            });
            prms.Add("@Name", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.Name
            });
            prms.Add("@ShareLocation", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.ShareLocation
            });
            prms.Add("@ShareStatus", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.ShareStatus
            });
            var result = _baseService.ExecuteNonQuery("sp_PostGroup", prms);
            PrimitiveResponse primitiveResult;

            if (result > 0)
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.Successful, ResponseMessage = "Insert successfully."
                };
            }
            else
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.UpdateNotCompleted, ResponseErrorMessage = "Canceled could not be completed."
                };
            }
            return(primitiveResult);
        }
コード例 #11
0
ファイル: UserAlarmsService.cs プロジェクト: barlasayaz/Quake
        public PrimitiveResponse Post(List <UserAlarmDto> model)
        {
            PrimitiveResponse primitiveResult;
            var idGroups = model.GroupBy(x => x.UserId).Select(group => group.Key);

            if (idGroups.Count() != 1)
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.UpdateNotCompleted, ResponseErrorMessage = "Tüm UserId'ler aynı olmalı!"
                };
            }
            else
            {
                foreach (var item in model)
                {
                    var prms = new Dictionary <string, SqlParam>();
                    prms.Add("@UserId", new SqlParam()
                    {
                        Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Int, Value = item.UserId
                    });
                    prms.Add("@RegionId", new SqlParam()
                    {
                        Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Int, Value = item.RegionId
                    });
                    prms.Add("@AlarmId", new SqlParam()
                    {
                        Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Int, Value = item.AlarmId
                    });
                    var result = _baseService.ExecuteNonQuery("sp_PostUserAlarms", prms);
                }
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.Successful, ResponseMessage = "Insert successfully."
                };
            }
            return(primitiveResult);
        }
コード例 #12
0
ファイル: UserAlarmsService.cs プロジェクト: barlasayaz/Quake
        public PrimitiveResponse Delete(int userId)
        {
            PrimitiveResponse primitiveResult;

            this.GetUser(userId);
            if (this.GetUser(userId) == 0)
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.UpdateNotCompleted, ResponseErrorMessage = userId + " Id'li bir kullanıcı yok!"
                };
            }
            else
            {
                var prms = new Dictionary <string, SqlParam>();
                prms.Add("@UserId", new SqlParam()
                {
                    Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Int, Value = userId
                });
                var result = _baseService.ExecuteNonQuery("sp_DeleteUserAlarms", prms);
                if (result > 0)
                {
                    primitiveResult = new PrimitiveResponse()
                    {
                        ResponseCode = ResponseCodes.Successful, ResponseMessage = "Delete successfully."
                    };
                }
                else
                {
                    primitiveResult = new PrimitiveResponse()
                    {
                        ResponseCode = ResponseCodes.UpdateNotCompleted, ResponseErrorMessage = "Canceled could not be completed."
                    };
                }
            }
            return(primitiveResult);
        }
コード例 #13
0
        public PrimitiveResponse Post(UserDto model)
        {
            var prms = new Dictionary <string, SqlParam>();

            prms.Add("@PushNotificationId", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.PushNotificationId
            });
            prms.Add("@PhoneNumber", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.PhoneNumber
            });
            prms.Add("@FirstName", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.FirstName
            });
            prms.Add("@LastName", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.LastName
            });
            prms.Add("@IsPhoneNumberVerified", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Bit, Value = model.IsPhoneNumberVerified
            });
            prms.Add("@IsPremium", new SqlParam()
            {
                Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.Bit, Value = model.IsPremium
            });
            if (model.UserInfo != null)
            {
                prms.Add("@DeviceOS", new SqlParam()
                {
                    Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.UserInfo.DeviceOS
                });
                prms.Add("@DeviceModel", new SqlParam()
                {
                    Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.UserInfo.DeviceModel
                });
                prms.Add("@DeviceOSVersion", new SqlParam()
                {
                    Direction = System.Data.ParameterDirection.Input, SqlType = System.Data.SqlDbType.NVarChar, Value = model.UserInfo.DeviceOSVersion
                });
            }
            var result = _baseService.ExecuteNonQuery("sp_PostUser", prms);
            PrimitiveResponse primitiveResult;

            if (result > 0)
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.Successful, ResponseMessage = "Insert successfully."
                };
            }
            else
            {
                primitiveResult = new PrimitiveResponse()
                {
                    ResponseCode = ResponseCodes.UpdateNotCompleted, ResponseErrorMessage = "Canceled could not be completed."
                };
            }
            return(primitiveResult);
        }