public AICPDAL.userdetail EditUserIDBAL(int userid)
        {
            AICPDAL.UserProfileDAL DAL = new UserProfileDAL();
            var editdata = DAL.EditReg(userid);

            return(editdata);
        }
Example #2
0
        public static int SaveUserProfile(string jsondata)
        {
            JObject jObject = JObject.Parse(jsondata);

            UserProfile user = new UserProfile();

            user.FirstName = jObject["First Name"].ToString();
            user.LastName  = jObject["Last Name"].ToString();
            user.Email     = jObject["Email"].ToString();
            user.Phone     = jObject["Phone"].ToString();
            return(UserProfileDAL.SaveUserProfile(user));
        }
Example #3
0
        public async Task <CardResult> GetNextCardText(IDialogContext context, Activity activity)
        {
            var         botdata         = context.PrivateConversationData;
            var         userInput       = activity.Text;
            UserProfile userProfileData = null;

            if (botdata.ContainsKey(UserDataKey))
            {
                userProfileData = botdata.GetValue <UserProfile>(UserDataKey);
            }

            var jObjectValue = activity.Value as JObject;

            var cardProvider = Convert.ToString(jObjectValue["nextcard"]);

            if (userProfileData == null)
            {
                userProfileData = new UserProfile();
            }

            if (cardProvider == "ShowInterviewDate")
            {
                userProfileData.InterviewDate = CommonDAL.getInterviewDate();
            }

            if (cardProvider != "")
            {
                Type cardProviderType = Type.GetType("RecruitmentQnA.Bot.CardProviders." + cardProvider);
                if (cardProviderType != null)
                {
                    object     classInstance   = Activator.CreateInstance(cardProviderType, null);
                    MethodInfo methodInfo      = cardProviderType.GetMethod("GetCardResult");
                    object[]   parametersArray = new object[] { userProfileData, jObjectValue, activity.Text, context };

                    dynamic    cardResult = methodInfo.Invoke(classInstance, parametersArray);
                    CardResult r          = cardResult.Result;

                    if (string.IsNullOrEmpty(r.ErrorMessage))
                    {
                        var action = Convert.ToString(jObjectValue["action"]);
                        if (!string.IsNullOrEmpty(action))
                        {
                            string validationErr = ValidateInfo(jObjectValue);
                            if (string.IsNullOrEmpty(validationErr))
                            {
                                userProfileData = AssignValuesToUser(userProfileData, jObjectValue);
                            }
                            else
                            {
                                r.ErrorMessage = validationErr;
                            }

                            if (action.ToLower() == "saveindb" && string.IsNullOrEmpty(r.ErrorMessage))
                            {
                                int result = UserProfileDAL.SaveUserProfile(userProfileData);
                                if (result == 0)
                                {
                                    r.ErrorMessage = "I'm sorry, I couldn't save your record. Please contact helpdesk/support for more information.";
                                }
                            }
                            botdata.SetValue(UserDataKey, userProfileData);
                        }
                    }

                    return(r);
                }
                else
                {
                    new CardResult()
                    {
                        ErrorMessage = "I'm sorry, I don't understand.  Please rephrase, or use the Card to respond."
                    }
                };
            }
            return(new CardResult()
            {
                ErrorMessage = "I'm sorry, I don't understand.  Please rephrase, or use the Card to respond."
            });
        }