protected void bind_website_ddl() { ///DatabaseManagement dbmanage = new DatabaseManagement(); string username = ""; if (Session[Constants.Session.USERNAME] != null) { username = Session[Constants.Session.USERNAME].ToString(); } else { Response.Redirect("~/login.aspx"); } datalayer c = new datalayer(); var q = c.Retrieve_Website(username); if (q.Any()) { ddl_select_website.Items.Clear(); ddl_select_website.Items.Insert(0, "Select"); // inserting at first position foreach (var a in q) { //binding website list in drop down------------ ddl_select_website.Items.Add(a.WebsiteName); //------------------------------------------ } } }
//GET api/values public HttpResponseMessage Get([FromBody] UserObj user) { string userid = user.MyFitnessPalUserName; datalayer dl = new datalayer(); var res = dl.getfitnesspaldata(userid); var response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent(res.ToString(), Encoding.UTF8, "application/json"); return(response); }
protected void Wizard_Create_Web_NextButtonClick(object sender, WizardNavigationEventArgs e) { if (Wizard_Create_Web.ActiveStepIndex == 0) { Message m = new Message(); datalayer dl = new datalayer(); System.Web.Security.MembershipUser mu; if (!Request.IsAuthenticated) { mu = null; Response.Redirect("~/login.aspx"); } else if (txt_website_name.Text.Trim() == "") { e.Cancel = true; error_div.Controls.Add(m.Error(Constants.ENTER_WEBSITE_NAME)); } else { Guid userid; mu = System.Web.Security.Membership.GetUser(); userid = (Guid)mu.ProviderUserKey; if (dl.SaveWebsite(Session[Constants.Session.USERNAME].ToString(), txt_website_name.Text.Trim(), userid) == Constants.SUCCESS) { e.Cancel = false; Session[Constants.WEBSITE_NAME] = txt_website_name.Text.Trim(); // pnl_create_pages.Visible = true; // pnl_website_name.Visible = false; } else if (dl.SaveWebsite(Session[Constants.Session.USERNAME].ToString(), txt_website_name.Text.Trim(), userid) == Constants.WEBSITE_ALREADY_EXIST) { e.Cancel = true; Session[Constants.ERROR] = Constants.WEBSITE_ALREADY_EXIST; error_div.Controls.Add(m.Error(Constants.WEBSITE_ALREADY_EXIST)); } else if (dl.SaveWebsite(Session[Constants.Session.USERNAME].ToString(), txt_website_name.Text.Trim(), userid) == Constants.ERROR) { Session[Constants.ERROR] = Constants.ERROR; e.Cancel = true; error_div.Controls.Add(m.Error(Constants.ERROR)); } // userid = (Guid)string.Empty; } } }
public static string add_page(Guid userid, string username, string websitename, string pagename) { string msg = ""; datalayer dl = new datalayer(); if (dl.SavePages(userid, username, pagename, websitename)) { msg = "inserted"; } else { msg = "error"; } return(msg); }
public void kitap_icerigi(string kitapadi, string kitap_yazari, string kitap_basimyili , string kitap_sayfasayisi) { string yolBegeler = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); FileStream fs = File.Create(yolBegeler + "\\kutuphaneOtomasyonu\\" + kitapadi + "" + "\\kitapbilgileri.txt"); fs.Close(); StreamWriter writer = File.AppendText(yolBegeler + "\\kutuphaneOtomasyonu\\" + kitapadi + "" + "\\kitapbilgileri.txt"); writer.WriteLine("Sayfa Sayısı:" + kitap_sayfasayisi); writer.WriteLine("Kitap Yazarı:" + kitap_yazari); writer.WriteLine("Kitap basım yılı:" + kitap_basimyili); writer.Close(); datalayer data = new datalayer(); //Aşağıdaki fonksiyon yanlış olduğu için açıklama satırına alındı //data.Kitap_dizi(kitapadi, kitap_yazari, kitap_basimyili, kitap_sayfasayisi); }
protected void Button1_Click(object sender, EventArgs e) { if (CheckBox1.Checked == true) { Guid key; key = Guid.NewGuid(); Message m = new Message(); if (Session["captcha"].ToString() != txtCaptcha.Text) { pnl_msg.Controls.Add(m.Error("Invalid captcha!")); } else { string username = Tname.Text.Trim(); string user_name = ConfigurationManager.AppSettings["Administrator"]; if (user_name == username) { string[] roles = Roles.GetRolesForUser(username); foreach (string role in roles) { if (role.Equals("Administrator")) { // Response.Redirect("admin/Home.aspx"); pnl_msg.Controls.Add(m.Error("This user already exists!")); } } string[] admin_roles = Roles.GetAllRoles(); foreach (string role in admin_roles) { if (role.Equals("Administrator")) { Roles.AddUserToRole(username, "Administrator"); if (Register()) { Guid userid; System.Web.Security.MembershipUser mu; mu = System.Web.Security.Membership.GetUser(username); userid = (Guid)mu.ProviderUserKey; admin_management admin = new admin_management(); if (admin.AddAdmin(userid, username)) { string name = Tname.Text.Trim(); string email = Temail.Text.Trim(); //string password = Tpassword.Text.Trim(); string gender = Rblgender.Text.Trim(); string s_ques = ddlsecurityQ.Text.Trim(); string s_ans = TAnswer.Text.Trim(); string dob = Tdob.Text.Trim(); string mobileno = Tmobile.Text.Trim(); string country = ddlcountry.Text.Trim(); string city = Tcity.Text.Trim(); string address = Taddress.Text.Trim(); datalayer c = new datalayer(); c.Registration(name, email, gender, s_ques, s_ans, dob, mobileno, country, city, address); Response.Redirect("admin/Home.aspx"); } else { pnl_msg.Controls.Add(m.Error("User can not created!")); } } } else { Roles.CreateRole("Administrator"); Roles.AddUserToRole(username, "Administrator"); if (Register()) { Guid userid; System.Web.Security.MembershipUser mu; mu = System.Web.Security.Membership.GetUser(username); userid = (Guid)mu.ProviderUserKey; admin_management admin = new admin_management(); if (admin.AddAdmin(userid, username)) { string name = Tname.Text.Trim(); string email = Temail.Text.Trim(); //string password = Tpassword.Text.Trim(); string gender = Rblgender.Text.Trim(); string s_ques = ddlsecurityQ.Text.Trim(); string s_ans = TAnswer.Text.Trim(); string dob = Tdob.Text.Trim(); string mobileno = Tmobile.Text.Trim(); string country = ddlcountry.Text.Trim(); string city = Tcity.Text.Trim(); string address = Taddress.Text.Trim(); datalayer c = new datalayer(); c.Registration(name, email, gender, s_ques, s_ans, dob, mobileno, country, city, address); Response.Redirect("admin/Home.aspx"); } else { pnl_msg.Controls.Add(m.Error("User can not created!")); } } } } Roles.CreateRole("Administrator"); Roles.AddUserToRole(username, "Administrator"); if (Register()) { Guid userid; System.Web.Security.MembershipUser mu; mu = System.Web.Security.Membership.GetUser(username); userid = (Guid)mu.ProviderUserKey; admin_management admin = new admin_management(); if (admin.AddAdmin(userid, username)) { string name = Tname.Text.Trim(); string email = Temail.Text.Trim(); //string password = Tpassword.Text.Trim(); string gender = Rblgender.Text.Trim(); string s_ques = ddlsecurityQ.Text.Trim(); string s_ans = TAnswer.Text.Trim(); string dob = Tdob.Text.Trim(); string mobileno = Tmobile.Text.Trim(); string country = ddlcountry.Text.Trim(); string city = Tcity.Text.Trim(); string address = Taddress.Text.Trim(); datalayer c = new datalayer(); c.Registration(name, email, gender, s_ques, s_ans, dob, mobileno, country, city, address); Response.Redirect("admin/Home.aspx"); } else { pnl_msg.Controls.Add(m.Error("User can not created!")); System.Web.Security.Membership.DeleteUser(username); } } } else { Account act = new Account(); if (Register()) { Guid userid; System.Web.Security.MembershipUser mu; mu = System.Web.Security.Membership.GetUser(username); userid = (Guid)mu.ProviderUserKey; if (act.SaveActivationKey(userid, key)) { // Hash_Pass hash = new Hash_Pass(); // string hash_pass = Hash_Pass.DESCryptoHelper.DESEncrypt(Tpassword.Text.Trim()); var siteRoot = Request.Url.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~/"); string activate_url = siteRoot + "ActivateAccount.aspx?key=" + key; string site_url = siteRoot; string web_design_url = siteRoot + "web-design/create.aspx"; string hosting_url = siteRoot + "hosting/main.aspx"; string help = siteRoot + "contact-us.html"; string address = "Balaganj, Lucknow Up 226003</br> Web Creation Inc."; string password = Hash_Pass.DESCryptoHelper.DESDecrypt(Session[Constants.Session.PASSWORD].ToString()); WMail mail = new WMail(); if (mail.Send(Temail.Text.Trim(), "", "", Tname.Text.Trim(), password, activate_url, site_url, web_design_url, hosting_url, help, address)) { string name = Tname.Text.Trim(); string email = Temail.Text.Trim(); //string password = Tpassword.Text.Trim(); string gender = Rblgender.Text.Trim(); string s_ques = ddlsecurityQ.Text.Trim(); string s_ans = TAnswer.Text.Trim(); string dob = Tdob.Text.Trim(); string mobileno = Tmobile.Text.Trim(); string country = ddlcountry.Text.Trim(); string city = Tcity.Text.Trim(); string user_address = Taddress.Text.Trim(); datalayer c = new datalayer(); c.Registration(name, email, gender, s_ques, s_ans, dob, mobileno, country, city, user_address); pnl_msg.Controls.Add(m.Error("An activation link has been sent to your email.")); clear(); } } else { pnl_msg.Controls.Add(m.Error("An error occurred while sending mail.")); System.Web.Security.Membership.DeleteUser(username); } // Response.Redirect("home.aspx"); } else { pnl_msg.Controls.Add(m.Error("An error occurred while processing your request.")); } } } } else { lbl_message.ForeColor = System.Drawing.Color.Red; lbl_message.Text = "Accept our terms and conditions."; } }