コード例 #1
0
        //todo this method will add signup details  and validate
        public dynamic AddVendor(PC_VendorDetails model)
        {
            try
            {
                if (isDataValid(model))
                {
                    if (dal.EmailExists(model.Vendor.Email) == false)
                    {
                        var user = objbalUser.GenerateUser(model.UserDetails);
                        if (user != null)
                        {
                            model.Vendor.UserId = user.Userid;

                            //Check is upccode special or not
                            var isRecommanded = dal.checkIsRecommandedUpc(model.Vendor.upccode);
                            if (isRecommanded)
                            {
                                model.Vendor.DocumentSigned = "Document Signed";
                            }

                            var vebdor = dal.AddVendor(model.Vendor);
                            if (vebdor != null)
                            {
                                return(shared.returnMessageJSON(Messages.SignUpSuccessTitle, Messages.SignUpSuccessDescription, false));
                            }
                            return(shared.returnMessageJSON(Messages.SignUpInValidDataTitle, Messages.SignUpInValidDataDescription, true));
                        }
                        return(shared.returnMessageJSON(Messages.SignUpInValidDataTitle, Messages.SignUpInValidDataDescription, true));
                    }
                    return(shared.returnMessageJSON(Messages.EmailExistErrorTitle, Messages.EmailExistSuccessDescription, true));
                }
                return(shared.returnMessageJSON(Messages.SignUpInValidDataTitle, Messages.SignUpInValidDataDescription, true));
            }
            catch (Exception E)
            {
                return(shared.returnMessageJSON(E.Data.ToString(), E.Message.ToString(), true));
            }
        }