예제 #1
0
        public static string AddReferenceInfo(string[] Name, string[] Relationship, string[] MobileNo, string[] YearsKnown, string[] RefType)
        {
            //bool isAdded = false;
            UserProfileInfo userProfileInfo = new UserProfileInfo();
            string          message         = Constant.CONST_REFERENCE_INFORMATION_FAILURE;

            if (SessionWrapper.LoggedUser == null)
            {
                return(message = Constant.SESSION_EXPIRE);
            }
            int count = 0;

            try
            {
                List <UserReferenceInfo> userReferences = new List <UserReferenceInfo>();
                UserReferenceInfo        userReference;

                int referenceTypeId;
                count = 0;
                while (count < Name.Length)
                {
                    if (!String.IsNullOrEmpty(Name[count]))
                    {
                        userReference                 = new UserReferenceInfo();
                        referenceTypeId               = ReferenceTypeHelper.GetReferenceTypeIdByName(RefType[count]);
                        userReference.Name            = Name[count].Trim();
                        userReference.Relationship    = Relationship[count].Trim();
                        userReference.MobileNumber    = MobileNo[count].Trim();
                        userReference.YearsKnown      = YearsKnown[count].Trim();
                        userReference.ReferenceTypeId = referenceTypeId;
                        userReference.UserId          = SessionWrapper.LoggedUser.UserId;

                        userReferences.Add(userReference);
                    }

                    count++;
                }
                userProfileInfo = UserReferenceInfoHelper.SaveUserReferenceInfo(userReferences);
            }
            catch { }
            if (userProfileInfo.IsFirstRecord)
            {
                message = Constant.CONST_REFERENCE_INFORMATION_ADD_SUCCESS;
            }
            else
            {
                message = Constant.CONST_REFERENCE_INFORMATION_SUCCESS;
            }

            return(message);
        }
예제 #2
0
        public static string AddReferenceInfo(string[] Name, string[] Relationship, string[] MobileNo, string[] YearsKnown, string[] RefType)
        {
            UserProfileInfo userProfileInfo = new UserProfileInfo();
            string          message         = Constant.CONST_REFERENCE_INFORMATION_FAILURE;

            if (SessionWrapper.LoggedUser == null)
            {
                return(message = Constant.SESSION_EXPIRE);
            }
            try
            {
                List <UserReferenceInfo> userReferences = new List <UserReferenceInfo>();
                UserReferenceInfo        userReference;

                OrderDetails  orderDetails = GetSessionOrderDetails();
                ReferenceInfo referenceInfo;
                int           referenceTypeId;
                orderDetails.ReferenceInfoes = new List <ReferenceInfo>();
                //get reference type id from stringint
                int count = 0;
                while (count < Name.Length)
                {
                    referenceTypeId = ReferenceTypeHelper.GetReferenceTypeIdByName(RefType[count]);

                    referenceInfo = new ReferenceInfo();
                    userReference = new UserReferenceInfo();

                    referenceInfo.ReferenceTypeId = referenceTypeId;
                    referenceInfo.Name            = Name[count].Trim();
                    referenceInfo.Relationship    = Relationship[count].Trim();
                    referenceInfo.MobileNumber    = MobileNo[count].Trim();
                    referenceInfo.YearsKnown      = YearsKnown[count].Trim();

                    orderDetails.ReferenceInfoes.Add(referenceInfo);

                    userReference.ReferenceTypeId = referenceTypeId;
                    userReference.Name            = Name[count].Trim();
                    userReference.Relationship    = Relationship[count].Trim();
                    userReference.MobileNumber    = MobileNo[count].Trim();
                    userReference.YearsKnown      = YearsKnown[count].Trim();
                    userReference.UserId          = SessionWrapper.LoggedUser.UserId;

                    userReferences.Add(userReference);

                    count++;
                }
                SessionWrapper.OrderDetail = orderDetails;

                if (userReferences.Count != 0)
                {
                    userProfileInfo = UserReferenceInfoHelper.SaveUserReferenceInfo(userReferences);

                    if (userProfileInfo.IsFirstRecord)
                    {
                        message = Constant.CONST_REFERENCE_INFORMATION_ADD_SUCCESS;
                    }
                    else
                    {
                        message = Constant.CONST_REFERENCE_INFORMATION_SUCCESS;
                    }
                }
                else
                {
                    message = Constant.CONST_REFERENCE_INFORMATION_ADD_SUCCESS;
                }
            }
            catch { }
            return(message);
        }