Esempio n. 1
0
        public CustomerRegistration(string content)
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);

            if (!(String.IsNullOrEmpty(Ultis.Settings.Email)))
            {
                emailAddressEntry.Text = Ultis.Settings.Email;
            }

            if (content != "")
            {
                clsResponse verify_response = JsonConvert.DeserializeObject <clsResponse>(content);

                if (verify_response.Result != null)
                {
                    result = JObject.Parse(content)["Result"].ToObject <clsRegister>();

                    userNameEntry.Text    = result.UserName;
                    phoneEntry.Text       = result.MobileNo;
                    businessRegEntry.Text = result.RegNo;
                    companyEntry.Text     = result.CompanyName;
                }
            }
        }
        public ActionResult Details(clsRegister register, string Country, string State, HttpPostedFileBase File, string city, string Title, string usertypeid, string regid)
        {
            try
            {
                writeToLogFile("Details post - Load Data Binding Begins: " + date, "true");

                var Country1 = donateNeedy.usp_getCountryNames().Select(c => new
                {
                    CountryID   = c.countryID,
                    CountryName = c.countryName
                }).ToList();
                ViewBag.Country = new SelectList(Country1, "CountryID", "CountryName");
                var Title1 = donateNeedy.tblTitles.Select(c => new
                {
                    TitleID   = c.titleId,
                    TitleName = c.title
                }).ToList();
                ViewBag.Title1 = new SelectList(Title1, "TitleID", "TitleName");
                int             countryid  = Convert.ToInt32(Country);
                int             stateid    = Convert.ToInt32(State);
                int             cityid     = Convert.ToInt32(city);
                int             titleid    = Convert.ToInt32(Title);
                List <tblState> stateinfo  = donateNeedy.tblStates.Where(a => a.countryId == countryid).ToList();
                int             Usertypeid = Convert.ToInt32(usertypeid);

                if (File != null && File.ContentLength != 0)
                {
                    string file1 = System.IO.Path.GetFileName(File.FileName);
                    string path1 = System.IO.Path.Combine(Server.MapPath("~/ProfilePictures/"), file1);
                    File.SaveAs(path1);
                    List <usp_CRUDtblRegistation_Result> GetUserByID = donateNeedy.usp_CRUDtblRegistation(0, Usertypeid, countryid, stateid, register.firstName, register.lastName, register.emailID,
                                                                                                          null, register.Address, cityid, register.Pincode, file1, false, register.PhoneNumber, regid, null, register.middleName, titleid, 1).ToList();
                }
                else
                {
                    List <usp_CRUDtblRegistation_Result> GetUserByID = donateNeedy.usp_CRUDtblRegistation(0, Usertypeid, countryid, stateid, register.firstName, register.lastName, register.emailID,
                                                                                                          null, register.Address, cityid, register.Pincode, null, false, register.PhoneNumber, regid, null, register.middleName, titleid, 1).ToList();
                }

                var user3 = donateNeedy.tblRegistrations.Where(m => m.emailID == register.emailID && m.isActive == true && m.userTypeID == Usertypeid).ToList();
                if (user3.Count != 0)
                {
                    FormsAuthentication.SetAuthCookie(user3[0].firstName + "|" + "3" + "|" + regid, false);
                }
                else
                {
                    var user4 = donateNeedy.tblRegistrations.Where(m => m.firstName == register.firstName && m.isActive == true && m.userTypeID == Usertypeid).ToList();
                    FormsAuthentication.SetAuthCookie(user4[0].firstName + "|" + "4" + "|" + regid, false);
                }
                writeToLogFile("Details post - Load Data Binding Ends: " + date1 + "\r\n====================\r\n", "true");
            }
            catch (Exception ex)
            {
                errorLog(ex.Message.ToString(), ex.GetType().ToString(), "Details");
                TempData["msg"] = "Some thing went wrong. Please try Again..";
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
    public static string register(string sname, string email, bool gen, long contactno, string createddt)
    {
        string message = "";
        var    gender  = (gen ? "1" : "0");

        contactno = Convert.ToInt64(contactno);
        createddt = Convert.ToDateTime(createddt).ToString("yyyy-MM-dd HH:mm:ss");

        try
        {
            DataTable dt = new clsRegister().setStudent(sname, email, gender, contactno, createddt).Tables[0];

            if (dt.Columns.Count > 1)
            {
                string uid = dt.Rows[0][1].ToString();
                message = dt.Rows[0][0].ToString();

                if (uid != "0")
                {
                    System.Web.HttpContext.Current.Session["username"] = sname;
                    System.Web.HttpContext.Current.Session["uid"]      = uid;
                }
            }
            else
            {
                message = dt.Rows[0][0].ToString();
            }
        }
        catch (Exception ex)
        {
            Custom.generatelog(null, null, "Register", ex.Message + ex.StackTrace);
            message = ex.Message + "|2";
        }

        return(message);
    }
        protected void Login_Click(object sender, EventArgs e)
        {
            bool        isPassword = false;
            clsRegister reg;
            clsUser     user;

            string pass = null;

            conn.Open();
            SqlCommand    cmd      = new SqlCommand("select * from SystemUser where SystemUserID= '" + txtusername.Text + "'", conn);
            SqlDataReader dr       = cmd.ExecuteReader();
            DataTable     dtResult = new DataTable();

            dtResult.Load(dr);

            if (dtResult.Rows.Count > 0)
            {
                pass       = dtResult.Rows[0]["Pwd"].ToString();
                isPassword = true;
            }

            if (isPassword)
            {
                string DecryptPassword = null;
                con.Open();
                SqlCommand    cmdnew      = new SqlCommand("select * from Users where UserName= '******'", con);
                SqlDataReader drnew       = cmdnew.ExecuteReader();
                DataTable     dtResultnew = new DataTable();
                dtResultnew.Load(drnew);
                con.Close();
                conn.Close();
                SqlConnection.ClearAllPools();
                SqlConnection.ClearPool(con);
                SqlConnection.ClearPool(conn);
                if (dtResultnew.Rows.Count > 0)
                {
                    DecryptPassword = clsGlobal.Encrypt(txtpassword.Text.Trim());
                    conn.Close();
                    if (dtResultnew.Rows[0]["Pass"].ToString().Equals(DecryptPassword))
                    {
                        string         strRes = "select * from dbo.Register where Name='" + txtusername.Text + "' ";
                        SqlDataAdapter da1    = new SqlDataAdapter(strRes, con);
                        ds = new DataSet();
                        da1.Fill(ds);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            Session["Admin"] = ds.Tables[0].Rows[0][1].ToString();
                            Session["Image"] = ds.Tables[0].Rows[0][2].ToString();
                            reg          = new clsRegister();
                            reg.UserName = txtusername.Text;
                            reg.IsActive = DateTime.Now.ToString();
                            reg.updateIsActive();
                            clsGlobal.SetSessionValue(clsEnum.SessionVariables.Pass, txtpassword.Text);
                            Response.Redirect("Chat.aspx");
                        }
                    }
                    else
                    {
                        Response.Redirect("~/Login.aspx");
                        lblMsg.Text = "Username and Password is invalid.";
                    }
                }
                else
                {
                    try
                    {
                        reg              = new clsRegister();
                        user             = new clsUser();
                        user.UserName    = txtusername.Text.ToString();
                        user.Pass        = clsGlobal.Encrypt(txtpassword.Text.ToString());
                        Session["Admin"] = txtusername.Text;
                        Session["Image"] = "~/Style/Images/15.jpg";
                        user.insert();
                        reg.UserName = txtusername.Text.ToString();
                        reg.Image    = "~/Style/Images/15.jpg";
                        reg.insert();
                    }
                    catch (Exception ex)
                    {
                        Response.Redirect("~/Login.aspx");
                    }
                }
                Response.Redirect("Chat.aspx");
            }
        }
        async void GetBaseURL(object s, EventArgs e)
        {
            try
            {
                loading.IsVisible = true;

                if (!String.IsNullOrEmpty(startUpEnterprise.Text) || !String.IsNullOrEmpty(startUpEmail.Text))
                {
                    Ultis.Settings.Email = startUpEmail.Text;

                    switch (Ultis.Settings.App)
                    {
                    case "asolute.Mobile.AILSTracking":
                    case "com.asolute.AILSTracking":
                        var tracking_content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.emailVerifyURL(startUpEmail.Text), this);

                        clsResponse verify_response = JsonConvert.DeserializeObject <clsResponse>(tracking_content);

                        if (verify_response.IsGood)
                        {
                            loading.IsVisible = false;
                            loading.IsEnabled = false;

                            await Navigation.PushAsync(new CustomerRegistration(tracking_content));
                        }
                        break;

                    case "asolute.Mobile.AILSBusiness":
                    case "com.asolute.AILSBusiness":
                        clsRegister register = new clsRegister
                        {
                            DeviceId    = Ultis.Settings.DeviceUniqueID,
                            UserName    = "",
                            Email       = startUpEmail.Text,
                            MobileNo    = "",
                            RegNo       = "",
                            CompanyName = "",
                            FirebaseId  = firebaseID,
                            DeviceIdiom = CrossDeviceInfo.Current.Idiom.ToString(),
                            DeviceMfg   = CrossDeviceInfo.Current.Manufacturer,
                            DeviceModel = CrossDeviceInfo.Current.Model,
                            OSPlatform  = CrossDeviceInfo.Current.Platform.ToString(),
                            OSVer       = CrossDeviceInfo.Current.VersionNumber.ToString(),
                            AppVer      = CrossDeviceInfo.Current.AppVersion,
                            AppName     = clsRegister.AppNameConst.Business
                        };

                        var business_content = await CommonFunction.CallWebService(1, register, Ultis.Settings.SessionBaseURI, ControllerUtil.postBusinessRegisterURL(), this);

                        clsResponse register_response = JsonConvert.DeserializeObject <clsResponse>(business_content);
                        if (register_response.IsGood)
                        {
                            loading.IsVisible = false;
                            loading.IsEnabled = false;

                            Application.Current.MainPage = new AccountActivation();
                        }
                        break;

                    default:
                        Ultis.Settings.AppFirstInstall = "Second";

                        clsResponse json_response = JsonConvert.DeserializeObject <clsResponse>(await CommonFunction.CallWebService(0, null, "https://api.asolute.com/", ControllerUtil.getBaseURL(startUpEnterprise.Text), this));

                        if (json_response.IsGood)
                        {
                            Ultis.Settings.EnterpriseName = startUpEnterprise.Text.ToUpper();
                            Ultis.Settings.SessionBaseURI = json_response.Result + "api/";
                        }

                        Application.Current.MainPage = new NavigationPage(new LoginPage());
                        break;
                    }
                }
                else
                {
                    await DisplayAlert("Missing field", "Please fill in all field.", "OK");
                }

                loading.IsVisible = false;
            }
            catch
            {
                await DisplayAlert("Unable to connect", "Please connect to internet", "OK");
            }
        }
        public ActionResult register(clsRegister register, string Country, string State, HttpPostedFileBase File, string city, string Title)
        {
            try
            {
                writeToLogFile("signup post - Load Data Binding Begins: " + date, "true");

                int             countryid = Convert.ToInt32(Country);
                int             stateid   = Convert.ToInt32(State);
                int             cityid    = Convert.ToInt32(city);
                int             titleid   = Convert.ToInt32(Title);
                List <tblState> stateinfo = donateNeedy.tblStates.Where(a => a.countryId == countryid).ToList();

                var AID = donateNeedy.tblRegistrations.Where(a => a.emailID == register.emailID && a.isActive == true && a.userTypeID == 1).ToList();
                if (Convert.ToInt16(AID.Count) == 0)
                {
                    if (File != null && File.ContentLength != 0)
                    {
                        string file1 = System.IO.Path.GetFileName(File.FileName);
                        string path1 = System.IO.Path.Combine(Server.MapPath("~/Images/ProfilePictures/"), file1);
                        File.SaveAs(path1);
                        List <usp_CRUDtblRegistation_Result> GetUserByID = donateNeedy.usp_CRUDtblRegistation(0, 1, countryid, stateid, register.firstName, register.lastName, register.emailID,
                                                                                                              register.Password, register.Address, cityid, register.Pincode, file1, false, register.PhoneNumber, register.userName, null, register.middleName, titleid, 1).ToList();

                        string from    = "";
                        string subject = "DonateNeedy Registration";
                        string body    = "<html>" + "<body>" + "<p style='font-size: 14px; color: #000;'>"
                                         + "<p style='font-size: 14px; color: #000;'>" +
                                         string.Format("Dear {0} <BR/><BR/> Thank you for registering with us, please click on the link to complete your registration: <a href =\"{1}\">Click Here</a> <br/><br/><br/>Best Regards<br/>From DonateNeedy Team",
                                                       register.firstName, Url.Action("EmailConfirm", "User", new { Token = GetUserByID[0].registrationID }, Request.Url.Scheme)) +
                                         "</p>" + "</body>" + "</html>";

                        mail(from, subject, body, register.emailID);

                        TempData["msg1"] = "We have sent you an e-mail please go through that and confirm your account ";
                    }
                    else
                    {
                        List <usp_CRUDtblRegistation_Result> GetUserByID = donateNeedy.usp_CRUDtblRegistation(0, 1, countryid, stateid, register.firstName, register.lastName, register.emailID,
                                                                                                              register.Password, register.Address, cityid, register.Pincode, null, false, register.PhoneNumber, register.userName, null, register.middleName, titleid, 1).ToList();


                        string from    = "";
                        string subject = "DonateNeedy Registration";
                        string body    = "<html>" + "<body>" + "<p style='font-size: 14px; color: #000;'>"
                                         + "<p style='font-size: 14px; color: #000;'>" +
                                         string.Format("Dear {0} <BR/><BR/> Thank you for registering with us, please click on the link to complete your registration: <a href =\"{1}\">Click Here</a> <br/><br/><br/>Best Regards<br/>From DonateNeedy Team",
                                                       register.firstName, Url.Action("EmailConfirm", "User", new { Token = GetUserByID[0].registrationID }, Request.Url.Scheme)) +
                                         "</p>" + "</body>" + "</html>";

                        mail(from, subject, body, register.emailID);

                        TempData["msg1"] = "We have sent you an e-mail please go through that and confirm your account";
                    }
                }
                else
                {
                    TempData["msg2"] = "Your email is already registered with us";
                    ModelState.Clear();
                }
                writeToLogFile("signup post - Load Data Binding Ends: " + date1 + "\r\n====================\r\n", "true");
            }
            catch (Exception ex)
            {
                errorLog(ex.Message.ToString(), ex.GetType().ToString(), "SignUp");
                TempData["msg"] = "Some thing went wrong. Please try Again..";
            }
            return(View());
        }
Esempio n. 7
0
        public async void Register_Clicked(object sender, EventArgs e)
        {
            try
            {
                if (RegisterButton.Text.Equals("Next"))
                {
                    if (emailAddressEntry.Text.Contains("@"))
                    {
                        string[] emailFormat = emailAddressEntry.Text.Split('@');

                        if (emailFormat[1].Contains("."))
                        {
                            var content = await CommonFunction.CallWebService(0, null, Ultis.Settings.SessionBaseURI, ControllerUtil.getCompanyNameURL(businessRegEntry.Text), this);

                            clsResponse company_response = JsonConvert.DeserializeObject <clsResponse>(content);

                            if (company_response.IsGood)
                            {
                                companyEntryView.IsVisible = true;
                                term.IsVisible             = true;

                                companyEntry.Text   = company_response.Result;
                                RegisterButton.Text = "Confirm";
                            }
                        }
                        else
                        {
                            await DisplayAlert("Error", "Email address must in [email protected] format.", "OK");
                        }
                    }
                    else
                    {
                        await DisplayAlert("Error", "Email address must in [email protected] format.", "OK");
                    }
                }
                else
                {
                    if (!(String.IsNullOrEmpty(emailAddressEntry.Text)) && !(String.IsNullOrEmpty(userNameEntry.Text)) && !(String.IsNullOrEmpty(phoneEntry.Text)) &&
                        !(String.IsNullOrEmpty(businessRegEntry.Text)) && !(String.IsNullOrEmpty(companyEntry.Text)))
                    {
                        try
                        {
                            OneSignal.Current.IdsAvailable((playerID, pushToken) => firebaseID = playerID);

                            Ultis.Settings.FireID = firebaseID;
                        }
                        catch
                        {
                        }

                        clsRegister register = new clsRegister();

                        register.DeviceId    = Ultis.Settings.DeviceUniqueID;
                        register.UserName    = userNameEntry.Text;
                        register.Email       = emailAddressEntry.Text;
                        register.MobileNo    = phoneEntry.Text;
                        register.RegNo       = businessRegEntry.Text;
                        register.CompanyName = companyEntry.Text;
                        register.FirebaseId  = firebaseID;
                        register.DeviceIdiom = CrossDeviceInfo.Current.Idiom.ToString();
                        register.DeviceMfg   = CrossDeviceInfo.Current.Manufacturer;
                        register.DeviceModel = CrossDeviceInfo.Current.Model;
                        register.OSPlatform  = CrossDeviceInfo.Current.Platform.ToString();
                        register.OSVer       = CrossDeviceInfo.Current.VersionNumber.ToString();
                        register.AppVer      = CrossDeviceInfo.Current.AppVersion;

                        var content = await CommonFunction.CallWebService(1, register, Ultis.Settings.SessionBaseURI, ControllerUtil.postBusinessRegisterURL(), this);

                        clsResponse register_response = JsonConvert.DeserializeObject <clsResponse>(content);

                        if (register_response.IsGood)
                        {
                            Application.Current.MainPage = new AccountActivation();
                        }
                        else
                        {
                            await DisplayAlert("Json Error", register_response.Message, "OK");
                        }
                    }
                    else
                    {
                        await DisplayAlert("Error", "Please enter all the field .", "OK");
                    }

                    /*if (term.Checked)
                     * {
                     * }
                     * else
                     * {
                     *  await DisplayAlert("Reminder", "Please tick the check box to continue", "OK");
                     * }*/
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", ex.Message, "OK");
            }
        }