public bool Checker()
    {
        bool rtnValue = false;

        if (!string.IsNullOrEmpty(txtCaptcha.Text.Trim()))
        {
            if (txtCaptcha.Text.Trim() == clsSecurity.Decrypt(hidCaptcha.Value))
            {
                rtnValue = true;
            }
        }

        return(rtnValue);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string id = clsDefault.URLRouting("id");

            if (!string.IsNullOrEmpty(id))
            {
                string idDecrypt = clsSecurity.Decrypt(id);
                string active    = clsSQL.Return(
                    "SELECT Active FROM [User] WHERE UID=" + parameterChar + "UID",
                    new string[, ] {
                    { parameterChar + "UID", idDecrypt }
                },
                    dbType,
                    cs);

                if (!string.IsNullOrEmpty(active))
                {
                    if (active == "0")
                    {
                        string outSQL;
                        if (clsSQL.Update(
                                "[User]",
                                new string[, ] {
                            { "Active", "'1'" }, { "MWhen", "GETDATE()" }
                        },
                                new string[, ] {
                            { "@UID", idDecrypt }
                        },
                                "UID=@UID",
                                dbType,
                                cs,
                                out outSQL))
                        {
                            #region Mail to Admin
                            string outMessage;
                            string Name = clsSQL.Return(
                                "SELECT Username FROM [User] WHERE UID=" + parameterChar + "UID",
                                new string[, ] {
                                { parameterChar + "UID", idDecrypt }
                            },
                                dbType,
                                cs);
                            clsMail clsMail = new clsMail();

                            if (!clsMail.SendTemplate(
                                    "UserRegisterConfirmAdmin",
                                    clsMail.GetEmailList("AutoSystemFrom"),
                                    clsMail.GetEmailList("AdminTo"),
                                    new string[, ] {
                                { "[Username]", Name }
                            },
                                    out outMessage))
                            {
                                ucColorBox1.Alert("เกิดข้อผิดพลาดขณะบันทึกข้อมูล", "เกิดข้อผิดพลาดขณะส่งเมล์ยืนยัน<br/>" + outMessage, AlertImage: ucColorBox.Alerts.Fail);
                                return;
                            }
                            #endregion
                            ucColorBox1.Redirect(
                                "/",
                                "ดำเนินการเสร็จสิ้น",
                                "ระบบยืนยันสถานะสมาชิกของคุณเรียบร้อยแล้ว");
                        }
                        else
                        {
                            ucColorBox1.Redirect(
                                "/",
                                "เกิดข้อผิดพลาด",
                                "ไม่พบรหัสยืนยันของคุณ");
                        }
                    }
                    else
                    {
                        ucColorBox1.Redirect(
                            "/",
                            "ดำเนินการเสร็จสิ้น",
                            "คุณเคยทำการยืนยันอีเมล์ไว้แล้ว");
                    }
                }
                else
                {
                    ucColorBox1.Redirect(
                        "/",
                        "เกิดข้อผิดพลาด",
                        "ไม่พบรหัสยืนยันของคุณ");
                }
            }
            else
            {
                ucColorBox1.Redirect(
                    "/",
                    "เกิดข้อผิดพลาด",
                    "ไม่พบรหัสยืนยันของคุณ");
            }
        }
    }
예제 #3
0
 private void setDefault()
 {
     #region Variable
     var clsSQL = new clsSQL();
     #endregion
     #region Procedure
     lblHeader.Text = clsGlobal.ApplicationName+" v."+clsGlobal.ApplicationVersion;
     lblSubHeader.Text = "ศูนย์รวมบริหารและจัดการเซิฟเวอร์สำหรับรีโมท";
     lblFooterDetail.Text = string.Format("Server : {0}", clsSQL.getAppSettingServerName(clsGlobal.cs));
     ttDefault.SetToolTip(btMinimize, "ย่อหน้าต่าง");
     ttDefault.SetToolTip(btClose, "ออกจากโปรแกรม");
     ttDefault.SetToolTip(btMove, "ย้ายตำแหน่งหน้าต่าง");
     ttDefault.SetToolTip(btReport, "ดูรายงาน");
     if (!getAdminChecker()) btReport.Visible = false;
     txtUsername.Text = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName+@"\"+clsGlobal.WindowsLogonBuilder();
     var savePassword = System.Configuration.ConfigurationManager.AppSettings["savePassword"];
     if (savePassword.Trim() != "")
     {
         var clsSecurity = new clsSecurity();
         txtPassword.Text = clsSecurity.Decrypt(savePassword);
     }
     if (clsGlobal.ServerMode)
     {
         try
         {
             txtUsername.Enabled = false; txtPassword.Enabled = false;
             lvServerList.Visible = false;
             tbContent.RowStyles[1].Height = 0;
             tmDefault.Enabled = true;
             tmDefault.Start();
         }
         catch(Exception ex)
         {
             try
             {
                 wsDefault.ServiceSoapClient wsDefault = new wsDefault.ServiceSoapClient();
                 wsDefault.MailSend(System.Configuration.ConfigurationManager.AppSettings["mailTo"],
                     clsGlobal.ApplicationName,
                     "<h2>" + clsGlobal.IPAddress() + "</h2>" + ex.Message,
                     "*****@*****.**",
                     System.Configuration.ConfigurationManager.AppSettings["siteCode"] + " : " + clsGlobal.ApplicationName,
                     "", "", "", false);
             }
             catch (Exception) { }
         }
     }
     else
     {
         lvSession.Visible = false;
         tbContent.RowStyles[0].Height = 0;
         tmClient.Enabled = true;
         tmClient.Start();
     }
     #endregion
 }