예제 #1
0
        //set isvalidated as false first and then after validation set it to false
        public async Task <ResultInfo> SaveMarshalInfo(MarshallToAdd MarshallObject)
        {
            string LiveMail, PhoneNumber;
            int    GroupID = Convert.ToInt32(MarshallObject.GroupID);
            var    result  = new ResultInfo();

            if (GroupID == 0)
            {
                result.ResultType = ResultTypeEnum.Error;
                result.Message    = "Invalid Group ID";
            }
            if (MarshallObject != null)
            {
                LiveMail    = MarshallObject.LiveMail;
                PhoneNumber = MarshallObject.PhoneNumber;
            }
            else
            {
                return(new ResultInfo()
                {
                    ResultType = ResultTypeEnum.Error,
                    Message = "Invalid Parameters, Empty Object."
                });
            }

            try
            {
                string            encryptedMobileNumber = utility.Security.Encrypt(PhoneNumber);
                MarshalStatusInfo resMarsahlInfo        =
                    await _GroupRepository.ValidateAndSaveMarshal(GroupID, LiveMail, encryptedMobileNumber, false);

                if (resMarsahlInfo.Code == 1)
                {
                    string ValidationID = utility.TokenManager.GenerateNewValidationID();
                    entities.GroupMarshalValidator GMV = Caster.MakeGroupMarshalValidator(resMarsahlInfo.ProfileID,
                                                                                          GroupID, LiveMail, ValidationID);
                    if (utility.Email.SendGroupValidationMail(LiveMail, ValidationID,
                                                              resMarsahlInfo.ProfileID.ToString(), "GroupMarshal"))
                    {
                        GMV.NotificationSent = true;
                    }
                    _GroupStorageAccess.SaveGroupMarshalValidator(GMV);
                    result.ResultType = ResultTypeEnum.Success;
                    result.Message    = resMarsahlInfo.MessageInfo;
                }
                else
                {
                    result.ResultType = ResultTypeEnum.Error;
                    result.Message    = resMarsahlInfo.MessageInfo;
                }
            }
            catch
            {
                result.ResultType = ResultTypeEnum.Exception;
                result.Message    = "Failed";
            }

            return(result);
        }
예제 #2
0
        public ResultInfo SaveMarshalInfo(MarshallToAdd oMarshallToAdd)
        {
            string AuthID = WebOperationContext.Current.IncomingRequest.Headers["AuthID"];
            string UType  = WebOperationContext.Current.IncomingRequest.Headers["UserType"];

            var user = AuthorizeUser(AuthID, Convert.ToChar(UType), oMarshallToAdd.GroupID);

            if (user.IsValid)
            {
                WebOperationContext.Current.IncomingRequest.Headers.Add("LiveUserID", user.LiveUserID);
                return(new GroupService().SaveMarshalInfo(oMarshallToAdd).Result);
            }
            else
            {
                return(null);
            }
        }