예제 #1
0
        // *****************************************************************************************
        // Kullanıcı Yarat
        // *****************************************************************************************
        protected void btnCreateUser_Click(object sender, EventArgs e)
        {
            try
            {
                /// ---------------------------------------------------------------------------------------------------------------
                if (String.IsNullOrEmpty(txtRegisterNameSurname.Value) || String.IsNullOrEmpty(this.txtRegisterUserName.Value)
                    || String.IsNullOrEmpty(this.txtRegisterPassword.Value) || String.IsNullOrEmpty(this.txtRegisterPasswordAgain.Value))
                {
                    pnlAlertMessage.Visible = true;
                    this.lblAlertMessage.Text = "Zorunlu Alanları Doldurunuz.";
                    this.txtRegisterNameSurname.Style.Add("border-color", "#a94442");
                    this.txtRegisterUserName.Style.Add("border-color", "#a94442");
                    this.txtRegisterPassword.Style.Add("border-color", "#a94442");
                    this.txtRegisterPasswordAgain.Style.Add("border-color", "#a94442");
                    return;
                }
                DashboardUser objCreateUser = new DashboardUser();
                if (this.txtRegisterPassword.Value == this.txtRegisterPasswordAgain.Value)
                {
                    // Hızlı Kayıt Bilgileri
                    objCreateUser.UserName = this.txtRegisterUserName.Value;
                    objCreateUser.Password = CryptoHelper.GetMd5Sum(this.txtRegisterPassword.Value);
                    objCreateUser.Name = this.txtRegisterNameSurname.Value;
                    objCreateUser.Active = 1;
                    bool CreateUserSuccess = objCreateUser.RegisterUser(null, GlobalSettings.OrganizationConnectionString);

                    if (CreateUserSuccess)
                    {
                        this.pnlAlertMessage.Visible = true;
                        dvAlertMessage.Attributes.Add("class", "alert alert-success");
                        this.lblAlertMessage.Text = "Kullanıcı Kaydı Tamamlandı";
                    }
                    else
                    {
                        this.pnlAlertMessage.Visible = true;
                        dvAlertMessage.Attributes.Add("class", "alert alert-danger");
                        this.lblAlertMessage.Text = "Kullanıcı Adı veya Şifre Hatalı";
                    }
                }
                else
                {
                    this.pnlAlertMessage.Visible = true;
                    dvAlertMessage.Attributes.Add("class", "alert alert-danger");
                    this.lblAlertMessage.Text = "Şifre ile Şifre Tekrarı Uyumsuz";
                }
                /// ---------------------------------------------------------------------------------------------------------------
            }
            catch (Exception ex)
            {
                this.pnlAlertMessage.Visible = true;
                dvAlertMessage.Attributes.Add("class", "alert alert-danger");
                this.lblAlertMessage.Text = ex.ToString();
            }
            /// ---------------------------------------------------------------------------------------------------------------
        }
 // *****************************************************************************************
 // Kullanıcı Bilgilerini Getir
 // *****************************************************************************************
 private void constructUserInfo()
 {
     DashboardUser objUser = new DashboardUser();
     objUser.GetAllActiveUserForUserId(GlobalSettings.OrganizationConnectionString, HttpContext.Current.Session["userID"].ToString());
     this.txtName.Value = objUser.Name;
     this.txtSurName.Value = objUser.Surname;
     this.txtEmail.Value = objUser.Email;
     this.txtTelephone.Value = objUser.Telephone;
     this.txtMissions.Value = objUser.Mission;
     this.txtSavedPassword.Value = CryptoHelper.HashString(objUser.Password);
 }
예제 #3
0
        // *****************************************************************************************
        // Kullanıcı Adı Şifre Doğrulama ve Yönlendirme
        // *****************************************************************************************
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                /// ---------------------------------------------------------------------------------------------------------------
                if (String.IsNullOrEmpty(this.txtPassword.Value))
                {
                    this.alertMessage.Attributes.Add("class", "");
                    this.alertMessage.Attributes.Add("class", "alert alert-danger");
                    //ClientScript.RegisterStartupScript(GetType(), "Hata", "alert(\'Lütfen Şirenizi Girin\');", true);
                }
                else if (HttpContext.Current.Session["userName"] == null)
                {
                    Session.RemoveAll();
                    Session.Contents.RemoveAll();
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    var objUser = new DashboardUser();
                    Session.RemoveAll();
                    Session.Contents.RemoveAll();
                    bool Authenticate = objUser.authenticateForLockScreen(GlobalSettings.OrganizationConnectionString, CryptoHelper.GetMd5Sum(txtPassword.Value));
                    if (Authenticate)
                    {
                        HttpContext.Current.Session["userID"] = objUser.UserId.ToString();
                        HttpContext.Current.Session["userName"] = objUser.UserName.ToString();
                        Response.Redirect("Default.aspx");
                    }
                    else
                    {
                        this.alertMessage.Attributes.Add("class", "");
                        this.alertMessage.Attributes.Add("class", "alert alert-danger");
                        return;
                    }

                }
                /// ---------------------------------------------------------------------------------------------------------------
            }
            catch (Exception ex)
            {
                //this.alertMessage.InnerText = ex.Message.ToString();
                //this.lblHata.Text = ex.Message.ToString();
            }
            /// ---------------------------------------------------------------------------------------------------------------
        }
 // *****************************************************************************************
 // Şifre Bilgileri Güncelle
 // *****************************************************************************************
 protected void btnEditPasswordInfo_Click(object sender, EventArgs e)
 {
     try
     {
         DashboardUser objUser = new DashboardUser();
         objUser.UserId = Convert.ToInt32(HttpContext.Current.Session["userID"]);
         objUser.Password = CryptoHelper.GetMd5Sum(this.txtReNewPassword.Value);
         objUser.UpdateUserPassword(null, GlobalSettings.OrganizationConnectionString);
         this.SuccessMessage.Visible = true;
     }
     catch (Exception ex)
     {
         this.SuccessMessage.Visible = false;
         this.FaultMessage.Visible = true;
         this.lblException.Text = ex.Message.ToString();
     }
 }
 // *****************************************************************************************
 // Kullanıcı Bilgilerini Güncelle
 // *****************************************************************************************
 protected void btnSaveUserInfo_Click(object sender, EventArgs e)
 {
     try
     {
         DashboardUser objUser = new DashboardUser();
         objUser.UserId = Convert.ToInt32(HttpContext.Current.Session["userID"]);
         objUser.UserName = HttpContext.Current.Session["userName"].ToString();
         objUser.Email = this.txtEmail.Value;
         objUser.Name = this.txtName.Value;
         objUser.Surname = this.txtSurName.Value;
         objUser.Mission = this.txtMissions.Value;
         objUser.Telephone = this.txtTelephone.Value;
         objUser.ImageName = "";
         objUser.Active = 1;
         objUser.UpdateUserInfo(null, GlobalSettings.OrganizationConnectionString);
         this.SuccessMessage.Visible = true;
     }
     catch (Exception ex)
     {
         this.SuccessMessage.Visible = false;
         this.FaultMessage.Visible = true;
         this.lblException.Text = ex.Message.ToString();
     }
 }
예제 #6
0
        // *****************************************************************************************
        // Servislerin Durumunu Kontrol Et
        // *****************************************************************************************
        // *****************************************************************************************
        // Servisler Stop ise Kullanıcıya Mail Gönder
        // *****************************************************************************************
        private void SendMail(string WindowsServiceName, string Message)
        {
            try
            {
                if (Convert.ToInt32(Session["NotAlert"]) == 0)
                {
                    DashboardUser objUser = new DashboardUser();
                    objUser.GetAllActiveUserForUserId(GlobalSettings.OrganizationConnectionString, HttpContext.Current.Session["userID"].ToString());

                    string ReceiverEmailAddress = objUser.Email;
                    string CCEmailAddress = WebConfigurationManager.AppSettings["CCEmailAddress"];
                    int SuccessSend;

                    string Sender_Address = GlobalSettings.getApplicationSystemSettingsStr(GlobalEnum.AppConfig.EMAIL_SENDER_ADDRESS.ToString());
                    string Password = GlobalSettings.getApplicationSystemSettingsStr(GlobalEnum.AppConfig.EMAIL_PASSWORD.ToString());
                    string MessageBody = Message + WindowsServiceName;
                    MailMessage mesaj = new MailMessage();//mail mesaj nesnesi yarat
                    mesaj.From = new MailAddress(Sender_Address, "Admin", System.Text.Encoding.UTF8);//nesnenin alanlarina gerekli bilgilerin atanmasi
                    SmtpClient smtp = new SmtpClient();
                    mesaj.To.Add(ReceiverEmailAddress);
                    if (!String.IsNullOrEmpty(CCEmailAddress))
                    {
                        mesaj.CC.Add(CCEmailAddress);
                    }
                    mesaj.Subject = "Site Yönetim Dashboard - Servis Durumu Bilgilendirme (ACİL)";
                    mesaj.IsBodyHtml = true;
                    mesaj.BodyEncoding = System.Text.Encoding.UTF8;
                    mesaj.Body = MessageBody;
                    mesaj.Priority = MailPriority.High;
                    smtp.Credentials = new System.Net.NetworkCredential(Sender_Address, Password);//kullanici adi ve sifre
                    smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                    smtp.Port = Convert.ToInt32(GlobalSettings.getApplicationSystemSettingsStr(GlobalEnum.AppConfig.EMAIL_PORT.ToString()));
                    smtp.Host = GlobalSettings.getApplicationSystemSettingsStr(GlobalEnum.AppConfig.EMAIL_HOST.ToString());
                    bool EnableSsl = false;
                    Boolean.TryParse(GlobalSettings.getApplicationSystemSettingsStr(GlobalEnum.AppConfig.EMAIL_USING_SSL.ToString()), out EnableSsl);
                    smtp.EnableSsl = EnableSsl;
                    smtp.Send(mesaj);
                    SuccessSend = 1;
                    if (SuccessSend != 1)
                    {
                        Response.Write(@"<script language='javascript'>alert('Mail Gönderimi Sırasında Hata!');</script>");
                    }
                }
            }
            catch (Exception)
            {
                Response.Write(@"<script language='javascript'>alert('Mail Gönderimi Sırasında Hata!');</script>");
            }
        }
        // *****************************************************************************************
        // Şirketleri Listele
        // *****************************************************************************************
        private void constructUser(int pageIndex)
        {
            DashboardUser objUser = new DashboardUser();
            List<DashboardUser> dtUser = objUser.GetAllActiveUserList(GlobalSettings.OrganizationConnectionString);

            if (!Object.Equals(dtUser, null) && dtUser.Count > 0)
            {
                this.cboUsers.DataSource = dtUser;
                this.cboUsers.DataBind();
            }
            else
            {
                this.cboUsers.DataSource = null;
                this.cboUsers.DataBind();
            }
        }
예제 #8
0
 public List<DashboardUser> GetAllActiveUserList(string connectionString)
 {
     using (System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(connectionString))
     {
         List<DashboardUser> DashboardUserList = new List<DashboardUser>();
         using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand())
         {
             cmd.CommandText = @" SELECT UserId, UserName, Password, Email, Name, Surname,
                                         Mission, Telephone, ImageName, Active
                                  FROM DashboardUser
                                  WHERE Active = 1";
             using (DataTable dt = DB_Gateway.ExecuteDataTable(cmd, connection))
             {
                 if (dt != null)
                 {
                     foreach (DataRow dr in dt.Rows)
                     {
                         DashboardUser objDashboardUser = new DashboardUser();
                         objDashboardUser.TransferToClass(dr);
                         DashboardUserList.Add(objDashboardUser);
                     }
                 }
             }
         }
         if (connection != null) connection.Close();
         return DashboardUserList;
     }
 }
예제 #9
0
        // *****************************************************************************************
        // Kullanıcı Adı Şifre Doğrulama ve Yönlendirme
        // *****************************************************************************************
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                /// ---------------------------------------------------------------------------------------------------------------
                if (String.IsNullOrEmpty(this.txtPassword.Value) || String.IsNullOrEmpty(this.txtUserName.Value))
                {
                    pnlAlertMessage.Visible = true;
                    this.lblAlertMessage.Text = "Zorunlu Alanları Doldurunuz.";
                    this.txtUserName.Style.Add("border-color", "#a94442");
                    this.txtPassword.Style.Add("border-color", "#a94442");
                }
                else
                {
                    var objUser = new  DashboardUser();
                    Session.RemoveAll();
                    Session.Contents.RemoveAll();
                    bool Authenticate = objUser.authenticate(GlobalSettings.OrganizationConnectionString, txtUserName.Value, CryptoHelper.GetMd5Sum(txtPassword.Value));
                    if (Authenticate)
                    {
                        HttpContext.Current.Session["userID"] = objUser.UserId.ToString();
                        HttpContext.Current.Session["userName"] = objUser.UserName.ToString();
                        Response.Redirect("Default.aspx");
                    }
                    else
                    {
                        this.pnlAlertMessage.Visible = true;
                        dvAlertMessage.Attributes.Add("class", "alert alert-danger");
                        this.lblAlertMessage.Text = "Kullanıcı Adı veya Şifre Hatalı";
                        return;
                    }

                }
                /// ---------------------------------------------------------------------------------------------------------------
            }
            catch (Exception ex)
            {
                this.pnlAlertMessage.Visible = true;
                dvAlertMessage.Attributes.Add("class", "alert alert-danger");
                this.lblAlertMessage.Text = ex.ToString();
            }
            /// ---------------------------------------------------------------------------------------------------------------
        }
예제 #10
0
        // *****************************************************************************************
        // Mail adresine şifre gönder
        // *****************************************************************************************
        protected void btnSend_Click(object sender, EventArgs e)
        {
            try
            {
                int SuccessSend = 0;
                /// ---------------------------------------------------------------------------------------------------------------
                DashboardUser objUser = new DashboardUser();
                objUser.GetItForEmailAddress(GlobalSettings.OrganizationConnectionString, this.txtemail.Value);
                if (objUser.Email == this.txtemail.Value)
                {
                    string Sender_Address = GlobalSettings.getApplicationSystemSettingsStr(GlobalEnum.AppConfig.EMAIL_SENDER_ADDRESS.ToString());
                    string Password = GlobalSettings.getApplicationSystemSettingsStr(GlobalEnum.AppConfig.EMAIL_PASSWORD.ToString());
                    string strongPassword = Membership.GeneratePassword(8, 2);
                    string MessageBody = "Yeni Şifreniz Aşağıdadır.<br/><br/><b><u>Şifreniz:</u></b> " + strongPassword;
                    MailMessage mesaj = new MailMessage();//mail mesaj nesnesi yarat
                    mesaj.From = new MailAddress(Sender_Address, "Admin", System.Text.Encoding.UTF8);//nesnenin alanlarina gerekli bilgilerin atanmasi
                    SmtpClient smtp = new SmtpClient();
                    mesaj.To.Add(this.txtemail.Value);
                    mesaj.Subject = "Site Yönetim Dashboard - Şifre Hatırlatması";
                    mesaj.IsBodyHtml = true;
                    mesaj.BodyEncoding = System.Text.Encoding.UTF8;
                    mesaj.Body = MessageBody;
                    mesaj.Priority = MailPriority.High;
                    smtp.Credentials = new System.Net.NetworkCredential(Sender_Address, Password);//kullanici adi ve sifre
                    smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
                    smtp.Port = Convert.ToInt32(GlobalSettings.getApplicationSystemSettingsStr(GlobalEnum.AppConfig.EMAIL_PORT.ToString()));
                    smtp.Host = GlobalSettings.getApplicationSystemSettingsStr(GlobalEnum.AppConfig.EMAIL_HOST.ToString());
                    bool EnableSsl = false;
                    Boolean.TryParse(GlobalSettings.getApplicationSystemSettingsStr(GlobalEnum.AppConfig.EMAIL_USING_SSL.ToString()), out EnableSsl);
                    smtp.EnableSsl = EnableSsl;
                    smtp.Send(mesaj);
                    SuccessSend = 1;
                    if (SuccessSend == 1)
                    {
                        string m_oldPassword = objUser.Password;

                        if (!strongPassword.Equals(m_oldPassword))
                            objUser.Password = CryptoHelper.GetMd5Sum(strongPassword.Trim());

                        objUser.UpdateNewPasswordForForget(null, GlobalSettings.OrganizationConnectionString, objUser.Password, this.txtemail.Value);

                        this.pnlAlertMessage.Visible = true;
                        dvAlertMessage.Attributes.Add("class", "alert alert-success");
                        this.lblAlertMessage.Text = "Şifreniz Mail Adresinize Gönderildi";
                    }
                    else
                    {
                        this.pnlAlertMessage.Visible = true;
                        dvAlertMessage.Attributes.Add("class", "alert alert-danger");
                        this.lblAlertMessage.Text = "Mail Gönderimi Sırasında Hata";
                    }
                }
                else
                {
                    this.pnlAlertMessage.Visible = true;
                    dvAlertMessage.Attributes.Add("class", "alert alert-danger");
                    this.lblAlertMessage.Text = "Mail Adresi Sistemde Kayıtlı Değildir";
                }
                //ClientScript.RegisterStartupScript(GetType(), "Hata", "alert(\'Lütfen Bir E-Mail Adresi Girin\');", true);
                /// ---------------------------------------------------------------------------------------------------------------
            }
            catch (Exception ex)
            {
                this.pnlAlertMessage.Visible = true;
                dvAlertMessage.Attributes.Add("class", "alert alert-danger");
                this.lblAlertMessage.Text = ex.ToString();
            }
            /// ---------------------------------------------------------------------------------------------------------------
        }