Esempio n. 1
0
    public bool SaveSiteUsers(string username, string firstname, string lastname, string email, string address, string city, string state, string country, string createdby, Guid creatorid, string password)
    {
        dbContext = new MyProjectDataContext();
        SiteUser su = new SiteUser();

        su.Address    = address;
        su.City       = city;
        su.Country    = country;
        su.CreatedBy  = createdby;
        su.CreatedOn  = DateTime.Now;
        su.CreatorId  = creatorid;
        su.Email      = email;
        su.FirstName  = firstname;
        su.IsDeleted  = false;
        su.IsRejected = false;
        su.Lastname   = lastname;
        su.Password   = password;
        su.State      = state;
        su.UpdatedOn  = DateTime.Now;
        su.Username   = username;
        try
        {
            dbContext.SiteUsers.InsertOnSubmit(su);
            dbContext.SubmitChanges();
            return(true);
        }
        catch
        {
            return(false);
        }
        return(false);
    }
Esempio n. 2
0
    public bool UpdateAdmin(Guid userid, string img_path, string username, string firstname, string lastname, string address, string city, string state, string country)
    {
        dbContext = new MyProjectDataContext();
        var q = from a in dbContext.AdminProfiles
                where a.UserId == userid
                select a;

        if (q.Any())
        {
            AdminProfile ap = new AdminProfile();
            ap.Address     = address;
            ap.City        = city;
            ap.Country     = country;
            ap.FirstName   = firstname;
            ap.LastName    = lastname;
            ap.State       = state;
            ap.Updated     = DateTime.Now;
            ap.UpdatedBy   = username;
            ap.UserId      = userid;
            ap.UserImgPath = img_path;
            ap.Username    = username;
            try
            {
                dbContext.AdminProfiles.InsertOnSubmit(ap);
                dbContext.SubmitChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        return(false);
    }
Esempio n. 3
0
    public bool AddAdmin(Guid userid, string username)
    {
        dbContext = new MyProjectDataContext();
        string       imgPath = "~/admin/dist/img/male-user.png";
        AdminProfile ap      = new AdminProfile();

        ap.UserId      = userid;
        ap.Username    = username;
        ap.Created     = DateTime.Now;
        ap.Updated     = DateTime.Now;
        ap.UpdatedBy   = username;
        ap.UserImgPath = imgPath;
        ap.Rejected    = false;
        try
        {
            dbContext.AdminProfiles.InsertOnSubmit(ap);
            dbContext.SubmitChanges();
            return(true);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return(false);
    }
Esempio n. 4
0
    public bool ActivateAccount(Guid key)
    {
        MyProjectDataContext dbContext = new MyProjectDataContext();
        ActivateUser         act       = new ActivateUser();
        var q = from a in dbContext.ActivateUsers
                where a.ActivationKey == key
                select a;

        foreach (var a in q)
        {
            a.IsActivated = true;
            //  a.IsExpired = true;
            try
            {
                dbContext.ActivateUsers.InsertOnSubmit(act);
                dbContext.SubmitChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        return(false);
    }
    public string Register_Success(UserModel model)
    {
        if (model != null)
        {
            Membership m = new Membership();
            m.Password = model.Password;

            m.UserId = model.UserId;
            m.PasswordFailedAttempt = model.PasswordFailedAttempt;
            m.Role         = model.Role;
            m.isSuperAdmin = model.isSuperAdmin;
            m.isRejected   = model.isRejected;
            db.Memberships.InsertOnSubmit(m);
            db.SubmitChanges();
            return(Constants.SUCCESS);
        }
        else
        {
            return(Constants.ERROR);
        }
    }
Esempio n. 6
0
    public bool Save(string dbname, int websiteid, string websitename, Guid userid, string username)
    {
        DatabaseDetail dbdetail = new DatabaseDetail();

        dbdetail.CreatedBy      = username;
        dbdetail.CreatedOn      = DateTime.Now;
        dbdetail.DatabaseName   = dbname;
        dbdetail.DbForWebsiteId = websiteid;
        dbdetail.UpdatedOn      = DateTime.Now;
        dbdetail.UserId         = userid;
        dbdetail.Username       = username;
        dbdetail.WebsiteName    = websitename;
        try
        {
            dbContext.DatabaseDetails.InsertOnSubmit(dbdetail);
            dbContext.SubmitChanges();
            return(true);
        }
        catch
        {
            return(false);
        }
    }
Esempio n. 7
0
    public bool SaveActivationKey(Guid userid, Guid key)
    {
        MyProjectDataContext dbContext = new MyProjectDataContext();
        ActivateUser         act       = new ActivateUser();

        act.ActivationKey = key;
        act.Created       = DateTime.Now;
        act.IsActivated   = false;
        act.IsExpired     = false;
        act.UserId        = userid;
        try
        {
            dbContext.ActivateUsers.InsertOnSubmit(act);
            dbContext.SubmitChanges();
            return(true);
        }
        catch
        {
            return(false);
        }
    }
Esempio n. 8
0
    //[ScriptMethod(UseHttpGet = false)]
    public static string delete(Guid userid, string websitename, string username)
    {
        string msg;

        // Response.Write(userid);
        // Response.Write(websitename);
        msg = "Hello";
        //  datalayer dl = new datalayer();
        MyProjectDataContext da = new MyProjectDataContext();
        var q = from a in da.Websites
                where a.UserId == userid && a.WebsiteName == websitename
                select a;
        int websiteid = GetWebsiteId(userid, username, websitename);
        var q1        = from b in da.WebsitePages
                        where b.WebsiteId == websiteid
                        select b;

        foreach (var o in q1)
        {
            da.WebsitePages.DeleteOnSubmit(o);   // removing foreign key references
        }
        foreach (var o in q)
        {
            da.Websites.DeleteOnSubmit(o);
        }

        try
        {
            da.SubmitChanges();
            msg = "success";
        }
        catch
        {
            msg = "error";
        }

        //   msg=dl.Delete_Website(userid, websitename);
        return(msg);
    }
Esempio n. 9
0
    public void DoRegistration(string username, string email, string pass)
    {
        Registration rg = new Registration();

        rg.name  = username;
        rg.email = email;
        // rg.password = pass;
        da.Registrations.InsertOnSubmit(rg);
        da.SubmitChanges();
    }
Esempio n. 10
0
    //[ScriptMethod(UseHttpGet = false)]
    public static string delete(Guid userid, string websitename, string username)
    {
        string msg;

        // Response.Write(userid);
        // Response.Write(websitename);
        msg = "Hello";
        //  datalayer dl = new datalayer();
        MyProjectDataContext da = new MyProjectDataContext();
        var q = from a in da.Websites
                where a.UserId == userid && a.WebsiteName == websitename
                select a;
        int websiteid = GetWebsiteId(userid, username, websitename);
        var q1        = from b in da.WebsitePages
                        where b.WebsiteId == websiteid
                        select b;

        foreach (var o in q1)
        {
            da.WebsitePages.DeleteOnSubmit(o);   // removing foreign key references
        }
        foreach (var o in q)
        {
            da.Websites.DeleteOnSubmit(o);
        }

        try
        {
            //deleting name from drop down
            web_design_CreateWebsite ob = new web_design_CreateWebsite();
            ob.bind_website_ddl();
            //ob.ddl_select_website.Items.Remove(websitename);
            //--------------------------

            //deleting website folder and files

            string             subPath = "~/web-design/" + username + "/" + websitename + "/";
            System.Web.UI.Page p       = new System.Web.UI.Page(); //creating instance of object

            bool exists = System.IO.Directory.Exists(p.Server.MapPath(subPath));

            if (exists)
            {
                System.IO.Directory.Delete(p.Server.MapPath(subPath), true);
            }
            //deleting db
            DatabaseManagement dbManage = new DatabaseManagement();
            dbManage.DeleteDatabaseByWebsiteName(userid, websitename, username);
            //  end-------------
            da.SubmitChanges();

            msg = "success";
        }
        catch
        {
            msg = "error";
        }

        //   msg=dl.Delete_Website(userid, websitename);
        return(msg);
    }