Exemplo n.º 1
0
        private void LoadSidebarItems(int curItem, DataTable dtCommands)
        {
            int _curCommandId = ConvertUtility.ToInt32(curItem);

            DataRow[] _lstCommands = dtCommands.Select("CommandParentID = " + curItem + " AND CommandVisible = 1");
            foreach (DataRow row in _lstCommands)
            {
                if (ConvertUtility.ToBoolean(row["CommandVisible"]) == false || ConvertUtility.ToBoolean(row["CommandEnable"]) == false)
                {
                    continue;
                }
                string name = "";
                string url  = "";

                name = row["CommandName"].ToString();
                //_item.Value = row["CommandID"].ToString();
                if (!String.IsNullOrEmpty(row["CommandUrl"].ToString().Trim()))
                {
                    url = row["CommandUrl"].ToString();
                }
                else if (row["CommandKey"].ToString() != string.Empty)
                {
                    url = AppEnv.AdminUrlParams(row["CommandKey"].ToString()) + row["CommandParams"].ToString();
                }

                curItem      = ConvertUtility.ToInt32(row["CommandID"].ToString());
                _lstCommands = dtCommands.Select("CommandParentID = " + curItem + " AND CommandVisible = 1");

                if (listCmd.Contains(row["CommandID"].ToString()))
                {
                    sb.Append("<li class=\"active\">");
                }
                else
                {
                    sb.Append("<li>");
                }

                if (_lstCommands.Length > 0)
                {
                    sb.Append(string.Format(fmAuS, url, name));
                    sb.Append("<ul class=\"sub-menu\">");
                    LoadSidebarItems(ConvertUtility.ToInt32(row["CommandID"].ToString()), dtCommands);
                    sb.Append("</ul>");
                }
                else
                {
                    sb.Append(string.Format(fmAdS, url, name));
                }
                sb.Append("</li>");
            }
        }
Exemplo n.º 2
0
        public static ContentInfo GetInfo(int content_ID)
        {
            ContentInfo retVal = null;
            var         dbConn = new SqlConnection(AppEnv.ConnectionString);
            var         dbCmd  = new SqlCommand("CMS_Contents_GetInfo", dbConn)
            {
                CommandType = CommandType.StoredProcedure
            };

            dbCmd.Parameters.AddWithValue("@Content_ID", content_ID);
            try
            {
                dbConn.Open();
                var dr = dbCmd.ExecuteReader();
                if (dr.Read())
                {
                    retVal                           = new ContentInfo();
                    retVal.Content_ID                = ConvertUtility.ToInt32(dr["Content_ID"]);
                    retVal.Content_Name              = ConvertUtility.ToString(dr["Content_Name"]);
                    retVal.Content_Teaser            = ConvertUtility.ToString(dr["Content_Teaser"]);
                    retVal.Content_Body              = ConvertUtility.ToString(dr["Content_Body"]);
                    retVal.Content_CreateDate        = ConvertUtility.ToDateTime(dr["Content_CreateDate"]);
                    retVal.Content_ModifiedDate      = ConvertUtility.ToDateTime(dr["Content_ModifiedDate"]);
                    retVal.Content_Status            = ConvertUtility.ToInt32(dr["Content_Status"]);
                    retVal.Content_OriginalZoneID    = ConvertUtility.ToInt32(dr["Content_OriginalZoneID"]);
                    retVal.Content_UserID            = ConvertUtility.ToInt32(dr["Content_UserID"]);
                    retVal.Content_ModifiedUserID    = ConvertUtility.ToInt32(dr["Content_ModifiedUserID"]);
                    retVal.Content_Author            = ConvertUtility.ToString(dr["Content_Author"]);
                    retVal.Content_EventDate         = ConvertUtility.ToDateTime(dr["Content_EventDate"]);
                    retVal.Content_FriendlyUrl       = ConvertUtility.ToString(dr["Content_FriendlyUrl"]);
                    retVal.Content_Comment           = ConvertUtility.ToString(dr["Content_Comment"]);
                    retVal.Content_ExcludeFromSearch = ConvertUtility.ToBoolean(dr["Content_ExcludeFromSearch"]);
                    retVal.Content_IsPhoto           = ConvertUtility.ToBoolean(dr["Content_IsPhoto"]);
                    retVal.Content_IsDownload        = ConvertUtility.ToBoolean(dr["Content_IsDownload"]);
                    retVal.Content_IsVideo           = ConvertUtility.ToBoolean(dr["Content_IsVideo"]);
                    retVal.Content_IsPoll            = ConvertUtility.ToBoolean(dr["Content_IsPoll"]);
                    retVal.Content_IsProduct         = ConvertUtility.ToBoolean(dr["Content_IsProduct"]);
                    retVal.Content_Visible           = ConvertUtility.ToBoolean(dr["Content_Visible"]);
                    retVal.Content_IsTemp            = ConvertUtility.ToBoolean(dr["Content_IsTemp"]);
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
            finally
            {
                dbConn.Close();
            }
            return(retVal);
        }
Exemplo n.º 3
0
        protected void butUpdate_Click(object sender, EventArgs e)
        {
            var info = HocsinhDB.GetInfo(_hocsinhid);

            info.Hocsinh_IsLearning = ConvertUtility.ToBoolean(chkIsLearning.Checked);
            try
            {
                HocsinhDB.Update(info);
                lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
            }
            catch
            {
                lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR;
            }
        }
Exemplo n.º 4
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnInit(e);

            if (CurrentUser.IsSuperAdmin)// || CurrentUser.IsAdmin
            {
                this.Visible = true;
            }
            else
            {
                DataTable dt = CommandController.GetRoleForUserByPortalID(CurrentUser.UserID, ConvertUtility.ToInt32(AppEnv.PortalId()));

                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows.Count > 1)
                    {
                        pmsRole  = ConvertUtility.ToBoolean(dt.Rows[0]["Role_Delete"]);
                        pmsRole1 = ConvertUtility.ToBoolean(dt.Rows[1]["Role_Delete"]);

                        if (!pmsRole && !pmsRole1)
                        {
                            this.Visible = false;
                        }
                        else
                        {
                            this.Visible = true;
                        }
                    }
                    else
                    {
                        pmsRole = ConvertUtility.ToBoolean(dt.Rows[0]["Role_Delete"]);
                        if (!pmsRole)
                        {
                            this.Visible = false;
                        }
                        else
                        {
                            this.Visible = true;
                        }
                    }
                }
                else
                {
                    this.Visible = false;
                }
            }
        }
Exemplo n.º 5
0
        public void ToBooleanTest()
        {
            Assert.AreEqual(true, ConvertUtility.ToBoolean("Y"));
            Assert.AreEqual(true, ConvertUtility.ToBoolean("Yes"));
            Assert.AreEqual(true, ConvertUtility.ToBoolean("T"));
            Assert.AreEqual(true, ConvertUtility.ToBoolean("True"));
            Assert.AreEqual(true, ConvertUtility.ToBoolean("1"));

            Assert.AreEqual(false, ConvertUtility.ToBoolean("N"));
            Assert.AreEqual(false, ConvertUtility.ToBoolean("No"));
            Assert.AreEqual(false, ConvertUtility.ToBoolean("F"));
            Assert.AreEqual(false, ConvertUtility.ToBoolean("False"));
            Assert.AreEqual(false, ConvertUtility.ToBoolean("0"));
            Assert.AreEqual(false, ConvertUtility.ToBoolean("Testing"));

            Assert.AreEqual(true, ConvertUtility.ToBoolean("Testing", true));
        }
Exemplo n.º 6
0
        protected void rptdv87_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemIndex < 0)
            {
                return;
            }
            DataRowView curData        = (DataRowView)e.Item.DataItem;
            HyperLink   lnkdv87        = (HyperLink)e.Item.FindControl("lnkdv87");
            Literal     ltrDangCapNhat = (Literal)e.Item.FindControl("ltrDangCapNhat");

            DataSet dtcheck = ThethaoController.GetAll_Sport87_DetailBy_PK_Game87ID(curData["PK_Game87_ID"].ToString());

            if (ConvertUtility.ToBoolean(dtcheck.Tables[0].Rows[0]["IsFull"]))
            {
                if (lang == 1)
                {
                    lnkdv87.Text = "<span class=\"blue\">" + curData["Name"].ToString() + "</span>";
                }
                else
                {
                    lnkdv87.Text = "<span class=\"blue\">" + UnicodeUtility.UnicodeToKoDau(curData["Name"].ToString()) + "</span>";
                }
                //Charging
                //string content = cpid + "&" + Constant.thethao + "9" + curData["Game87_Id"].ToString() + "&" + price + "&" + vmstransactionid;
                //lnkdv87.NavigateUrl = UrlProcess.GetSportDV87Url(lang.ToString(), "support", width, curData["PK_Game87_ID"].ToString());
                //lnkTaive.NavigateUrl = UrlProcess.GetSportDV87Url(lang.ToString(), "support", width, curData["PK_Game87_ID"].ToString());
                //lnkdv87.NavigateUrl = ConfigurationSettings.AppSettings.Get("vms3g") + "?link=" + Server.UrlEncode(EAS.EncryptData(content, ConfigurationSettings.AppSettings.Get("vmskey")));
                lnkdv87.NavigateUrl = "../TuVanDacBiet.aspx?id=" + curData["Game87_Id"].ToString() + "&lang=" + lang + "&w=" + width;
            }
            else
            {
                if (lang == 1)
                {
                    lnkdv87.Text        = curData["Name"].ToString();
                    ltrDangCapNhat.Text = "(đang cập nhật)";
                }
                else
                {
                    ltrDangCapNhat.Text = "(dang cap nhat)";
                    lnkdv87.Text        = UnicodeUtility.UnicodeToKoDau(curData["Name"].ToString());
                }
                lnkdv87.NavigateUrl = null;
            }
        }
Exemplo n.º 7
0
        public static MemberInfo GetInfo(int member_ID)
        {
            MemberInfo retVal = null;
            var        dbConn = new SqlConnection(AppEnv.ConnectionString);
            var        dbCmd  = new SqlCommand("Main_Members_GetInfo", dbConn)
            {
                CommandType = CommandType.StoredProcedure
            };

            dbCmd.Parameters.AddWithValue("@Member_ID", member_ID);
            try
            {
                dbConn.Open();
                var dr = dbCmd.ExecuteReader();
                if (dr.Read())
                {
                    retVal                         = new MemberInfo();
                    retVal.Member_ID               = ConvertUtility.ToInt32(dr["Member_ID"]);
                    retVal.Member_Email            = ConvertUtility.ToString(dr["Member_Email"]);
                    retVal.Member_Password         = ConvertUtility.ToString(dr["Member_Password"]);
                    retVal.Member_Fullname         = ConvertUtility.ToString(dr["Member_Fullname"]);
                    retVal.Member_Gender           = ConvertUtility.ToInt32(dr["Member_Gender"]);
                    retVal.Member_Avatar           = ConvertUtility.ToString(dr["Member_Avatar"]);
                    retVal.Member_Tel              = ConvertUtility.ToString(dr["Member_Tel"]);
                    retVal.Member_Address          = ConvertUtility.ToString(dr["Member_Address"]);
                    retVal.Member_District         = ConvertUtility.ToString(dr["Member_District"]);
                    retVal.Member_City             = ConvertUtility.ToString(dr["Member_City"]);
                    retVal.Member_Rank             = ConvertUtility.ToInt32(dr["Member_Rank"]);
                    retVal.Member_Birthday         = ConvertUtility.ToDateTime(dr["Member_Birthday"]);
                    retVal.Member_Active           = ConvertUtility.ToBoolean(dr["Member_Active"]);
                    retVal.Member_ActiveCode       = ConvertUtility.ToString(dr["Member_ActiveCode"]);
                    retVal.Member_IsForgotPassword = ConvertUtility.ToBoolean(dr["Member_IsForgotPassword"]);
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
            finally
            {
                dbConn.Close();
            }
            return(retVal);
        }
Exemplo n.º 8
0
        public static VideoInfo GetInfo(int video_ID)
        {
            VideoInfo retVal = null;
            var       dbConn = new SqlConnection(AppEnv.ConnectionString);
            var       dbCmd  = new SqlCommand("CMS_Videos_GetInfo", dbConn)
            {
                CommandType = CommandType.StoredProcedure
            };

            dbCmd.Parameters.AddWithValue("@Video_ID", video_ID);
            try
            {
                dbConn.Open();
                var dr = dbCmd.ExecuteReader();
                if (dr.Read())
                {
                    retVal                   = new VideoInfo();
                    retVal.Video_ID          = ConvertUtility.ToInt32(dr["Video_ID"]);
                    retVal.Video_Name        = ConvertUtility.ToString(dr["Video_Name"]);
                    retVal.Video_Description = ConvertUtility.ToString(dr["Video_Description"]);
                    retVal.Video_Type        = ConvertUtility.ToString(dr["Video_Type"]);
                    retVal.Video_File        = ConvertUtility.ToString(dr["Video_File"]);
                    retVal.Video_YouTube     = ConvertUtility.ToString(dr["Video_YouTube"]);
                    retVal.Video_Width       = ConvertUtility.ToInt32(dr["Video_Width"]);
                    retVal.Video_Height      = ConvertUtility.ToInt32(dr["Video_Height"]);
                    retVal.Video_CreateDate  = ConvertUtility.ToDateTime(dr["Video_CreateDate"]);
                    retVal.Video_View        = ConvertUtility.ToInt32(dr["Video_View"]);
                    retVal.User_ID           = ConvertUtility.ToInt32(dr["User_ID"]);
                    retVal.Video_Visible     = ConvertUtility.ToBoolean(dr["Video_Visible"]);
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
            finally
            {
                dbConn.Close();
            }
            return(retVal);
        }
Exemplo n.º 9
0
        protected void rptdv87_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemIndex < 0)
            {
                return;
            }
            DataRowView curData        = (DataRowView)e.Item.DataItem;
            HyperLink   lnkdv87        = (HyperLink)e.Item.FindControl("lnkdv87");
            Literal     ltrDangCapNhat = (Literal)e.Item.FindControl("ltrDangCapNhat");

            DataSet dtcheck = ThethaoController.GetAll_Sport87_DetailBy_PK_Game87ID(curData["PK_Game87_ID"].ToString());

            if (ConvertUtility.ToBoolean(dtcheck.Tables[0].Rows[0]["IsFull"]))
            {
                //if (lang == 1)
                //{
                lnkdv87.Text = "<span class=\"blue\">" + curData["Name"].ToString() + "</span>";
                //}
                //else
                //{
                //    lnkdv87.Text = "<span class=\"blue\">" + UnicodeUtility.UnicodeToKoDau(curData["Name"].ToString()) + "</span>";
                //}

                //lnkdv87.NavigateUrl = "../TuVanDacBiet.aspx?id=" + curData["Game87_Id"].ToString() + "&lang=" + lang + "&w=" + width;
                lnkdv87.NavigateUrl = UrlProcess.TheThaoTranCauVang(curData["Game87_Id"].ToString());
            }
            else
            {
                //if (lang == 1)
                //{
                lnkdv87.Text        = curData["Name"].ToString();
                ltrDangCapNhat.Text = "(đang cập nhật)";
                //}
                //else
                //{
                //    ltrDangCapNhat.Text = "(dang cap nhat)";
                //    lnkdv87.Text = UnicodeUtility.UnicodeToKoDau(curData["Name"].ToString());
                //}
                lnkdv87.NavigateUrl = null;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string httpMethod = Request.HttpMethod;
                string estateId   = ConvertUtility.Trim(Request.QueryString["id"]);

                if (httpMethod.Equals("get", StringComparison.OrdinalIgnoreCase))
                {
                    EstateFwService estateService = new EstateFwService();
                    this.Estate = estateService.GetEstateById(estateId);
                }
                else
                {
                    //AddData
                    string buildName = ConvertUtility.Trim(Request.Form["buildName"]);
                    string address   = ConvertUtility.Trim(Request.Form["address"]);
                    int    x_cnt     = ConvertUtility.ToInt(Request.Form["x_cnt"]);
                    bool   x_except  = ConvertUtility.ToBoolean(Request.Form["x_except"]);
                    int    y_cnt_b   = ConvertUtility.ToInt(Request.Form["y_cnt_b"]);
                    int    y_cnt_e   = ConvertUtility.ToInt(Request.Form["y_cnt_e"]);
                    bool   y_except  = ConvertUtility.ToBoolean(Request.Form["y_except"]);

                    BuildFwService buildService = new BuildFwService();
                    if (buildService.AddBuild(estateId, buildName, address, x_cnt, x_except, y_cnt_b, y_cnt_e, y_except))
                    {
                        Response.Write("true");
                    }
                    else
                    {
                        Response.Write("false");
                    }
                    Response.End();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 11
0
        public static ImageInfo GetCover(int contentId)
        {
            ImageInfo retVal = null;
            var       dbConn = new SqlConnection(AppEnv.ConnectionString);
            var       dbCmd  = new SqlCommand("CMS_Images_GetCover", dbConn)
            {
                CommandType = CommandType.StoredProcedure
            };

            dbCmd.Parameters.AddWithValue("@Content_ID", contentId);
            try
            {
                dbConn.Open();
                var dr = dbCmd.ExecuteReader();
                if (dr.Read())
                {
                    retVal                   = new ImageInfo();
                    retVal.Image_ID          = ConvertUtility.ToInt32(dr["Image_ID"]);
                    retVal.Image_Name        = ConvertUtility.ToString(dr["Image_Name"]);
                    retVal.Image_Description = ConvertUtility.ToString(dr["Image_Description"]);
                    retVal.Image_File        = ConvertUtility.ToString(dr["Image_File"]);
                    retVal.Image_CreateDate  = ConvertUtility.ToDateTime(dr["Image_CreateDate"]);
                    retVal.Image_FileSize    = ConvertUtility.ToDouble(dr["Image_FileSize"]);
                    retVal.Image_Width       = ConvertUtility.ToInt32(dr["Image_Width"]);
                    retVal.Image_Height      = ConvertUtility.ToInt32(dr["Image_Height"]);
                    retVal.Image_View        = ConvertUtility.ToInt32(dr["Image_View"]);
                    retVal.User_ID           = ConvertUtility.ToInt32(dr["User_ID"]);
                    retVal.Image_Visible     = ConvertUtility.ToBoolean(dr["Image_Visible"]);
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
            finally
            {
                dbConn.Close();
            }
            return(retVal);
        }
Exemplo n.º 12
0
        public static HocsinhInfo GetInfo(int hocsinh_ID)
        {
            HocsinhInfo retVal = null;
            var         dbConn = new SqlConnection(AppEnv.ConnectionString);
            var         dbCmd  = new SqlCommand("Solart_Hocsinh_GetInfo", dbConn)
            {
                CommandType = CommandType.StoredProcedure
            };

            dbCmd.Parameters.AddWithValue("@Hocsinh_ID", hocsinh_ID);
            try
            {
                dbConn.Open();
                var dr = dbCmd.ExecuteReader();
                if (dr.Read())
                {
                    retVal                    = new HocsinhInfo();
                    retVal.Hocsinh_ID         = ConvertUtility.ToInt32(dr["Hocsinh_ID"]);
                    retVal.Hocsinh_Name       = ConvertUtility.ToString(dr["Hocsinh_Name"]);
                    retVal.Hocsinh_Parent     = ConvertUtility.ToString(dr["Hocsinh_Parent"]);
                    retVal.Hocsinh_Email      = ConvertUtility.ToString(dr["Hocsinh_Email"]);
                    retVal.Hocsinh_Tel        = ConvertUtility.ToString(dr["Hocsinh_Tel"]);
                    retVal.Hocsinh_Address    = ConvertUtility.ToString(dr["Hocsinh_Address"]);
                    retVal.Hocsinh_Birthday   = ConvertUtility.ToString(dr["Hocsinh_Birthday"]);
                    retVal.Hocsinh_Note       = ConvertUtility.ToString(dr["Hocsinh_Note"]);
                    retVal.Hocsinh_CreateDate = ConvertUtility.ToDateTime(dr["Hocsinh_CreateDate"]);
                    retVal.Hocsinh_IsLearning = ConvertUtility.ToBoolean(dr["Hocsinh_IsLearning"]);
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
            finally
            {
                dbConn.Close();
            }
            return(retVal);
        }
Exemplo n.º 13
0
        public static DownloadInfo GetInfo(int download_ID)
        {
            DownloadInfo retVal = null;
            var          dbConn = new SqlConnection(AppEnv.ConnectionString);
            var          dbCmd  = new SqlCommand("CMS_Download_GetInfo", dbConn)
            {
                CommandType = CommandType.StoredProcedure
            };

            dbCmd.Parameters.AddWithValue("@Download_ID", download_ID);
            try
            {
                dbConn.Open();
                var dr = dbCmd.ExecuteReader();
                if (dr.Read())
                {
                    retVal                      = new DownloadInfo();
                    retVal.Download_ID          = ConvertUtility.ToInt32(dr["Download_ID"]);
                    retVal.Download_Name        = ConvertUtility.ToString(dr["Download_Name"]);
                    retVal.Download_Description = ConvertUtility.ToString(dr["Download_Description"]);
                    retVal.Download_File        = ConvertUtility.ToString(dr["Download_File"]);
                    retVal.Download_Extension   = ConvertUtility.ToString(dr["Download_Extension"]);
                    retVal.Download_Visible     = ConvertUtility.ToBoolean(dr["Download_Visible"]);
                    retVal.Download_CreateDate  = ConvertUtility.ToDateTime(dr["Download_CreateDate"]);
                    retVal.Download_FileSize    = ConvertUtility.ToDouble(dr["Download_FileSize"]);
                    retVal.Download_View        = ConvertUtility.ToInt32(dr["Download_View"]);
                    retVal.User_ID              = ConvertUtility.ToInt32(dr["User_ID"]);
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
            finally
            {
                dbConn.Close();
            }
            return(retVal);
        }
Exemplo n.º 14
0
        public static DistributionInfo GetInfo(int distribution_ID)
        {
            DistributionInfo retVal = null;
            var dbConn = new SqlConnection(AppEnv.ConnectionString);
            var dbCmd  = new SqlCommand("CMS_Distributions_GetInfo", dbConn)
            {
                CommandType = CommandType.StoredProcedure
            };

            dbCmd.Parameters.AddWithValue("@Distribution_ID", distribution_ID);
            try
            {
                dbConn.Open();
                var dr = dbCmd.ExecuteReader();
                if (dr.Read())
                {
                    retVal = new DistributionInfo();
                    retVal.Distribution_ID            = ConvertUtility.ToInt32(dr["Distribution_ID"]);
                    retVal.Distribution_ContentID     = ConvertUtility.ToInt32(dr["Distribution_ContentID"]);
                    retVal.Distribution_ZoneID        = ConvertUtility.ToInt32(dr["Distribution_ZoneID"]);
                    retVal.Distribution_CreateDate    = ConvertUtility.ToDateTime(dr["Distribution_CreateDate"]);
                    retVal.Distribution_Rank          = ConvertUtility.ToInt32(dr["Distribution_Rank"]);
                    retVal.Distribution_View          = ConvertUtility.ToInt32(dr["Distribution_View"]);
                    retVal.Distribution_Priority      = ConvertUtility.ToInt32(dr["Distribution_Priority"]);
                    retVal.Distribution_Layout        = ConvertUtility.ToString(dr["Distribution_Layout"]);
                    retVal.Distribution_DisableTeaser = ConvertUtility.ToBoolean(dr["Distribution_DisableTeaser"]);
                    retVal.Distribution_DisableAvatar = ConvertUtility.ToBoolean(dr["Distribution_DisableAvatar"]);
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
            finally
            {
                dbConn.Close();
            }
            return(retVal);
        }
Exemplo n.º 15
0
        protected void butUpdateAll_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (DataGridItem item in dtgOrder.Items)
                {
                    int         id   = ConvertUtility.ToInt32(item.Cells[0].Text);
                    HocsinhInfo info = HocsinhDB.GetInfo(id);

                    var chkIsLearning = (CheckBox)item.FindControl("chkIsLearning");

                    info.Hocsinh_IsLearning = ConvertUtility.ToBoolean(chkIsLearning.Checked);

                    HocsinhDB.Update(info);
                }
                lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
            }
            catch
            {
                lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR; //ex.ToString();
            }
        }
Exemplo n.º 16
0
        public static KhoahocInfo GetInfo(int contentId)
        {
            KhoahocInfo retVal = null;
            var         dbConn = new SqlConnection(AppEnv.ConnectionString);
            var         dbCmd  = new SqlCommand("Solart_Khoahoc_GetInfo", dbConn)
            {
                CommandType = CommandType.StoredProcedure
            };

            dbCmd.Parameters.AddWithValue("@Content_ID", contentId);
            try
            {
                dbConn.Open();
                var dr = dbCmd.ExecuteReader();
                if (dr.Read())
                {
                    retVal                    = new KhoahocInfo();
                    retVal.Khoahoc_ID         = ConvertUtility.ToInt32(dr["Khoahoc_ID"]);
                    retVal.Content_ID         = ConvertUtility.ToInt32(dr["Content_ID"]);
                    retVal.Zone_ID            = ConvertUtility.ToInt32(dr["Zone_ID"]);
                    retVal.Khoehoc_NoiDungHoc = ConvertUtility.ToString(dr["Khoehoc_NoiDungHoc"]);
                    retVal.Khoahoc_DoTuoi     = ConvertUtility.ToString(dr["Khoahoc_DoTuoi"]);
                    retVal.Khoahoc_DoTuoiText = ConvertUtility.ToString(dr["Khoahoc_DoTuoiText"]);
                    retVal.Khoahoc_GioHoc     = ConvertUtility.ToString(dr["Khoahoc_GioHoc"]);
                    retVal.Khoahoc_KhaiGiang  = ConvertUtility.ToString(dr["Khoahoc_KhaiGiang"]);
                    retVal.Khoahoc_Avaiable   = ConvertUtility.ToBoolean(dr["Khoahoc_Avaiable"]);
                }
                if (dr != null)
                {
                    dr.Close();
                }
            }
            finally
            {
                dbConn.Close();
            }
            return(retVal);
        }
Exemplo n.º 17
0
 protected void butDelAll_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (DataGridItem item in dtgMail.Items)
         {
             //					CheckBox chkSelect = (CheckBox)item.FindControl("chkSelect");
             //					if(chkSelect.Checked)
             //					{
             int      id        = ConvertUtility.ToInt32(item.Cells[0].Text);
             MailInfo info      = MailDB.GetInfo(id);
             CheckBox chkAnswer = (CheckBox)item.FindControl("chkAnswer");
             info.Mail_Answer = ConvertUtility.ToBoolean(chkAnswer.Checked);
             MailDB.Update(info);
             //					}
         }
         lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
     }
     catch
     {
         lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR; //ex.ToString();
     }
 }
Exemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (ConvertUtility.ToBoolean(AppEnv.AdvInZone))
                {
                    ZoneUtility.LoadZones(lstZones.Items); lstZones.Enabled = true;
                }
                else
                {
                    lstZones.Enabled = false;
                }
                lstZones.Items.Insert(0, new ListItem("Root 0", "0"));
                lstZones.SelectedIndex = 0;

                lstPositions.DataSource     = PositionDB.GetAll();
                lstPositions.DataTextField  = "Pos_Name";
                lstPositions.DataValueField = "Pos_ID";
                lstPositions.DataBind();
                lstPositions.SelectedIndex = -1;
                MiscUtility.SetSelected(lstPositions.Items, PosSelected.ToString());
            }
            lblUpdateStatus.Text = string.Empty;
        }
Exemplo n.º 19
0
        protected void dtgProduct_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                int id = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                try
                {
                    HocsinhDB.Delete(id);
                    lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch
                {
                    lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR;
                }
            }
            if (e.CommandName == "updaterow")
            {
                try
                {
                    int         id   = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                    HocsinhInfo info = HocsinhDB.GetInfo(id);

                    var chkIsLearning = (CheckBox)e.Item.FindControl("chkIsLearning");

                    info.Hocsinh_IsLearning = ConvertUtility.ToBoolean(chkIsLearning.Checked);

                    HocsinhDB.Update(info);

                    lblUpdateStatus.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch
                {
                    lblUpdateStatus.Text = MiscUtility.UPDATE_ERROR; //ex.ToString();
                }
            }
        }
Exemplo n.º 20
0
        public List <UserInfo> GetListUser(int pageIndex, int pageSize, out int totalrow)
        {
            List <UserInfo> list  = null;
            var             param = new[]
            {
                new SqlParameter("@pageIndex", pageIndex),
                new SqlParameter("@pageSize", pageSize),
                new SqlParameter("@totalrow", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output
                }
            };
            SqlCommand cmd;
            var        r = DataHelper.ExecuteReader(Config.ConnectionString, "usp_User_GetList", param, out cmd);

            list = new List <UserInfo>();
            while (r.Read())
            {
                list.Add(new UserInfo
                {
                    id         = (int)r["id"],
                    sUsername  = ConvertUtility.ToString(r["sUsername"]),
                    sFullName  = r["sFullName"].ToString(),
                    sEmail     = r["sEmail"].ToString(),
                    sAddress   = r["sAddress"].ToString(),
                    sMobile    = r["sMobile"].ToString(),
                    sCompany   = r["sCompany"].ToString(),
                    sHomepage  = r["sHomepage"].ToString(),
                    CreateDate = System.Convert.ToDateTime(r["CreateDate"]),
                    active     = ConvertUtility.ToBoolean(r["active"])
                });
            }
            r.Close(); r.Dispose();
            totalrow = (int)cmd.Parameters[2].Value;
            return(list);
        }
Exemplo n.º 21
0
        private static MemberInfo CreateEntityFromReader(IDataReader reader)
        {
            var item = new MemberInfo();

            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_ID")))
                  {
                      item.Member_ID = ConvertUtility.ToInt32(reader["Member_ID"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_Email")))
                  {
                      item.Member_Email = ConvertUtility.ToString(reader["Member_Email"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_Password")))
                  {
                      item.Member_Password = ConvertUtility.ToString(reader["Member_Password"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_Fullname")))
                  {
                      item.Member_Fullname = ConvertUtility.ToString(reader["Member_Fullname"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_Gender")))
                  {
                      item.Member_Gender = ConvertUtility.ToInt32(reader["Member_Gender"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_Avatar")))
                  {
                      item.Member_Avatar = ConvertUtility.ToString(reader["Member_Avatar"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_Tel")))
                  {
                      item.Member_Tel = ConvertUtility.ToString(reader["Member_Tel"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_Address")))
                  {
                      item.Member_Address = ConvertUtility.ToString(reader["Member_Address"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_District")))
                  {
                      item.Member_District = ConvertUtility.ToString(reader["Member_District"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_City")))
                  {
                      item.Member_City = ConvertUtility.ToString(reader["Member_City"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_Rank")))
                  {
                      item.Member_Rank = ConvertUtility.ToInt32(reader["Member_Rank"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_Birthday")))
                  {
                      item.Member_Birthday = ConvertUtility.ToDateTime(reader["Member_Birthday"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_Active")))
                  {
                      item.Member_Active = ConvertUtility.ToBoolean(reader["Member_Active"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_ActiveCode")))
                  {
                      item.Member_ActiveCode = ConvertUtility.ToString(reader["Member_ActiveCode"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Member_IsForgotPassword")))
                  {
                      item.Member_IsForgotPassword = ConvertUtility.ToBoolean(reader["Member_IsForgotPassword"]);
                  }
            }
            catch { }
            return(item);
        }
Exemplo n.º 22
0
        private static ZoneInfo CreateEntityFromReader(IDataReader reader)
        {
            var item = new ZoneInfo();

            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_ID")))
                  {
                      item.Zone_ID = ConvertUtility.ToInt32(reader["Zone_ID"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_ParentID")))
                  {
                      item.Zone_ParentID = ConvertUtility.ToInt32(reader["Zone_ParentID"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_Name")))
                  {
                      item.Zone_Name = ConvertUtility.ToString(reader["Zone_Name"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_Description")))
                  {
                      item.Zone_Description = ConvertUtility.ToString(reader["Zone_Description"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_FriendlyUrl")))
                  {
                      item.Zone_FriendlyUrl = ConvertUtility.ToString(reader["Zone_FriendlyUrl"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_RealUrl")))
                  {
                      item.Zone_RealUrl = ConvertUtility.ToString(reader["Zone_RealUrl"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_Avatar")))
                  {
                      item.Zone_Avatar = ConvertUtility.ToString(reader["Zone_Avatar"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_Priority")))
                  {
                      item.Zone_Priority = ConvertUtility.ToInt32(reader["Zone_Priority"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_MetaDescription")))
                  {
                      item.Zone_MetaDescription = ConvertUtility.ToString(reader["Zone_MetaDescription"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_MetaKeywords")))
                  {
                      item.Zone_MetaKeywords = ConvertUtility.ToString(reader["Zone_MetaKeywords"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_Layout")))
                  {
                      item.Zone_Layout = ConvertUtility.ToString(reader["Zone_Layout"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_SubcategoryDisplay")))
                  {
                      item.Zone_SubcategoryDisplay = ConvertUtility.ToString(reader["Zone_SubcategoryDisplay"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_ContentListingDisplay")))
                  {
                      item.Zone_ContentListingDisplay = ConvertUtility.ToString(reader["Zone_ContentListingDisplay"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_VisibleInMainNav")))
                  {
                      item.Zone_VisibleInMainNav = ConvertUtility.ToBoolean(reader["Zone_VisibleInMainNav"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_VisibleInLeftNav")))
                  {
                      item.Zone_VisibleInLeftNav = ConvertUtility.ToBoolean(reader["Zone_VisibleInLeftNav"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_VisibleInTopNav")))
                  {
                      item.Zone_VisibleInTopNav = ConvertUtility.ToBoolean(reader["Zone_VisibleInTopNav"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_VisibleInFooterNav")))
                  {
                      item.Zone_VisibleInFooterNav = ConvertUtility.ToBoolean(reader["Zone_VisibleInFooterNav"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_ExcludeFromNav")))
                  {
                      item.Zone_ExcludeFromNav = ConvertUtility.ToBoolean(reader["Zone_ExcludeFromNav"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_Visible")))
                  {
                      item.Zone_Visible = ConvertUtility.ToBoolean(reader["Zone_Visible"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_Disable")))
                  {
                      item.Zone_Disable = ConvertUtility.ToBoolean(reader["Zone_Disable"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_Lang")))
                  {
                      item.Zone_Lang = ConvertUtility.ToString(reader["Zone_Lang"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Zone_IsStandAloneBox")))
                  {
                      item.Zone_IsStandAloneBox = ConvertUtility.ToBoolean(reader["Zone_IsStandAloneBox"]);
                  }
            }
            catch { }
            return(item);
        }
Exemplo n.º 23
0
        protected void dtgPix_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                int          id   = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                DownloadInfo info = DownloadDB.GetInfo(id);
                try
                {
                    string file = info.Download_File;
                    if (file.Length > 0)
                    {
                        int      lengUploadFile = AppEnv.UploadDocument.Length;
                        string   filenameVideo  = file.Substring(lengUploadFile);
                        FileInfo file5          = new FileInfo(Server.MapPath(AppEnv.UploadDocument) + filenameVideo);
                        if (file5.Exists)
                        {
                            file5.Delete();
                        }
                    }

                    ContentDownloadDB.Delete(_contentId, id);

                    DownloadDB.Delete(id);

                    lblStatusUpdate.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch
                {
                    lblStatusUpdate.Text = MiscUtility.UPDATE_ERROR;
                }
            }
            if (e.CommandName == "updaterow")
            {
                try
                {
                    int          id   = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                    DownloadInfo info = DownloadDB.GetInfo(id);

                    TextBox  txtPriority = (TextBox)e.Item.FindControl("txtPriority");
                    CheckBox chkVisible  = (CheckBox)e.Item.FindControl("chkVisible");

                    info.Download_Visible = ConvertUtility.ToBoolean(chkVisible.Checked);

                    DownloadDB.Update(info);

                    var ctinfo = ContentDownloadDB.GetInfo(_contentId, id);

                    ctinfo.Priority = ConvertUtility.ToInt32(txtPriority.Text);

                    ContentDownloadDB.Update(ctinfo);

                    lblStatusUpdate.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch
                {
                    lblStatusUpdate.Text = MiscUtility.UPDATE_ERROR; //ex.ToString();
                }
            }
            if (e.CommandName == "editrow")
            {
                lblStatusUpdate.Text = lblStatusUpdate2.Text = string.Empty;

                var id   = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                var info = DownloadDB.GetInfo(id);

                chkVisible.Checked = info.Download_Visible;
                txtName.Text       = info.Download_Name;
                txtTeaser.Text     = info.Download_Description;
                txtID.Text         = id.ToString();
            }
        }
Exemplo n.º 24
0
        protected void dtgData_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                var id = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                try
                {
                    ContentVideoDB.Delete(_contentId, id);

                    VideoDB.Delete(id);

                    lblStatusUpdate.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch
                {
                    lblStatusUpdate.Text = MiscUtility.UPDATE_ERROR;
                }
            }
            if (e.CommandName == "updaterow")
            {
                try
                {
                    var id   = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                    var info = VideoDB.GetInfo(id);

                    var txtPriority = (TextBox)e.Item.FindControl("txtPriority");
                    var chkVisible  = (CheckBox)e.Item.FindControl("chkVisible");

                    info.Video_Visible = ConvertUtility.ToBoolean(chkVisible.Checked);

                    VideoDB.Update(info);

                    var ctinfo = ContentVideoDB.GetInfo(_contentId, id);

                    ctinfo.Priority = ConvertUtility.ToInt32(txtPriority.Text);

                    ContentVideoDB.Update(ctinfo);

                    lblStatusUpdate.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch
                {
                    lblStatusUpdate.Text = MiscUtility.UPDATE_ERROR; //ex.ToString();
                }
            }
            if (e.CommandName == "editrow")
            {
                lblStatusUpdate.Text = lblStatusUpdate2.Text = string.Empty;

                var id   = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                var info = VideoDB.GetInfo(id);

                dropType.ClearSelection();
                MiscUtility.SetSelected(dropType.Items, info.Video_Type);
                chkVisible.Checked = info.Video_Visible;
                txtFile.Text       = info.Video_File;
                txtYoutube.Text    = info.Video_YouTube;
                txtName.Text       = info.Video_Name;
                txtTeaser.Text     = info.Video_Description;
                txtID.Text         = id.ToString();
            }
        }
Exemplo n.º 25
0
        private object TryConvert(object value, string toType, ref bool succes)
        {
            object retval = null;

            if (toType == typeof(Object).Name)
            {
                succes = true;
                return((object)value);
            }

            if (toType == typeof(Guid?).Name)
            {
                succes = true;
                return(ConvertUtility.ToGuidNullable(value));
            }

            if (toType == typeof(Guid).Name)
            {
                succes = true;
                return(ConvertUtility.ToGuid(value, Guid.Empty));
            }

            if (toType == typeof(Byte?).Name)
            {
                succes = true;
                return(ConvertUtility.ToByteNullable(value));
            }
            if (toType == typeof(Byte).Name)
            {
                succes = true;
                return(ConvertUtility.ToByte(value, 0));
            }
            if (toType == typeof(int?).Name)
            {
                succes = true;
                return(ConvertUtility.ToInt32Nullable(value));
            }
            if (toType == typeof(int).Name)
            {
                succes = true;
                return(ConvertUtility.ToInt32(value, 0));
            }
            if (toType == typeof(decimal?).Name)
            {
                succes = true;
                return(ConvertUtility.ToDecimalNullable(value));
            }
            if (toType == typeof(decimal).Name)
            {
                succes = true;
                return(ConvertUtility.ToDecimal(value, 0));
            }

            if (toType == typeof(Int16?).Name)
            {
                succes = true;
                return(ConvertUtility.ToInt16Nullable(value));
            }
            if (toType == typeof(Int16).Name)
            {
                succes = true;
                return(ConvertUtility.ToInt16(value, 0));
            }
            if (toType == typeof(Int32?).Name)
            {
                succes = true;
                return(ConvertUtility.ToInt32Nullable(value));
            }
            if (toType == typeof(Int32).Name)
            {
                succes = true;
                return(ConvertUtility.ToInt32(value, 0));
            }
            if (toType == typeof(Int64?).Name)
            {
                succes = true;
                return(ConvertUtility.ToInt64Nullable(value));
            }
            if (toType == typeof(Int64).Name)
            {
                succes = true;
                return(ConvertUtility.ToInt64(value, 0));
            }
            if (toType == typeof(float?).Name)
            {
                succes = true;
                return(ConvertUtility.ToSingleNullable(value));
            }
            if (toType == typeof(float).Name)
            {
                succes = true;
                return(ConvertUtility.ToSingle(value, 0));
            }
            if (toType == typeof(Single?).Name)
            {
                succes = true;
                return(ConvertUtility.ToSingleNullable(value));
            }
            if (toType == typeof(Single).Name)
            {
                succes = true;
                return(ConvertUtility.ToSingle(value, 0));
            }
            if (toType == typeof(double?).Name)
            {
                succes = true;
                return(ConvertUtility.ToDoubleNullable(value));
            }
            if (toType == typeof(double).Name)
            {
                succes = true;
                return(ConvertUtility.ToDouble(value, 0));
            }
            if (toType == typeof(Double?).Name)
            {
                succes = true;
                return(ConvertUtility.ToDoubleNullable(value));
            }
            if (toType == typeof(Double).Name)
            {
                succes = true;
                return(ConvertUtility.ToDouble(value, 0));
            }

            if (toType == typeof(bool?).Name)
            {
                succes = true;
                return(ConvertUtility.ToBooleanNullable(value));
            }
            if (toType == typeof(bool).Name)
            {
                succes = true;
                return(ConvertUtility.ToBoolean(value, false));
            }

            if (toType == typeof(DateTime).Name)
            {
                DateTime DateTimeValue = DateTime.Now;
                succes = DateTime.TryParse(ConvertUtility.HandleNull(value, string.Empty).ToString(), out DateTimeValue);
                retval = DateTimeValue;
            }
            if (toType == typeof(DateTime?).Name)
            {
                DateTime DateTimeValue = DateTime.Now;
                succes = DateTime.TryParse(ConvertUtility.HandleNull(value, string.Empty).ToString(), out DateTimeValue);
                if (!succes)
                {
                    retval = null;
                }
                retval = DateTimeValue;
            }

            return(retval);
        }
Exemplo n.º 26
0
        protected void butSend_Click(object sender, EventArgs e)
        {
            var contactEmail = AppEnv.ContactEmail;

            if (txtName.Text.Trim().Length == 0 || txtEmail.Text.Trim().Length == 0 || txtContent.Text.Trim().Length == 0)
            {
                MessageBox.Show("Bạn phải điền tất cả các ô có dấu (*)");
                return;
            }
            //if(txtCode.Text.Trim() != FormShield1.GetText())
            //{
            //    MessageBox.Show("Bạn nhập không đúng mã bảo vệ");
            //    return;
            //}

            const string matchEmailPattern = @"^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@"
                                             + @"((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?
				[0-9]{1,2}|25[0-5]|2[0-4][0-9])\."
                                             + @"([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?
				[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|"
                                             + @"([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$";

            if (Regex.IsMatch(txtEmail.Text.Trim(), matchEmailPattern) == false)
            {
                MessageBox.Show("Email không đúng !!!");
                return;
            }

            var sb = new StringBuilder();

            sb.Append("<b>Ho ten</b>: ");
            sb.Append(txtName.Text);
            sb.Append("<br><b>Email</b>: ");
            sb.Append(txtEmail.Text);
            sb.Append("<br><b>Dien thoai</b>:<br>");
            sb.Append(txtPhone.Text);
            sb.Append("<br><b>Gioi tinh</b>:<br>");
            sb.Append(rdolGender.SelectedValue);
            sb.Append("<br><b>Tieu de</b>:<br>");
            sb.Append(txtSubject.Text);
            sb.Append("<br><b>Content</b>:<br>");
            sb.Append(txtContent.Text);


            // new email solution start
            var email = new MailMessage(txtEmail.Text, contactEmail)
            {
                Subject    = "Lien he tu khach hang ghe tham website",
                IsBodyHtml = true,
                Body       = sb.ToString()
            };

            var smtp = new SmtpClient
            {
                Host = AppEnv.MailServer.Length == 0 ? "localhost" : AppEnv.MailServer,
                Port =
                    AppEnv.MailServerPort.Length == 0 ? 25 : ConvertUtility.ToInt32(AppEnv.MailServerPort)
            };



            // if authentication
            if (AppEnv.MailUsername.Length > 0 && AppEnv.MailPassword.Length > 0)
            {
                smtp.Credentials    = new NetworkCredential(AppEnv.MailUsername, AppEnv.MailPassword);
                smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
            }
            // if authentication end

            var info = new MailInfo
            {
                Mail_Kind     = "lienhe",
                Mail_Name     = HTMLUtility.SecureHTML(txtName.Text),
                Mail_Email    = HTMLUtility.SecureHTML(txtEmail.Text),
                Mail_Phone    = HTMLUtility.SecureHTML(txtPhone.Text),
                Mail_Address  = "",
                Mail_Content  = HTMLUtility.SecureHTML(txtContent.Text),
                Pix_ID        = 0,
                Mail_Answer   = ConvertUtility.ToBoolean(false),
                Mail_Datetime = DateTime.Now
            };

            MailDB.Insert(info);

            try
            {
                smtp.Send(email);
                notice.InnerHtml = "<br><br><br><font color=red><b>Email đã được gửi tới " + contactEmail + "...</b></font>";
            }
            catch (Exception ex)
            {
                notice.InnerHtml = "<br><br><br><font color=red><b>Email đã được gửi đi... Xin chân thành cảm ơn.</b></font>";
                ErrorReportDB.NewReport(Request.RawUrl, ex.ToString());
                //notice.InnerHtml = "<br><br><br><font color=red><b>Lỗi trong quá trình gửi mail...</b></font><br>" + ex.Message;
            }
            finally
            {
                pnform.Visible = false;
                notice.Visible = true;
            }
        }
Exemplo n.º 27
0
        private void LoadSidebar()
        {
            radmMenu.Text = "";
            //GetPath();
            try
            {
                cmd = ConvertUtility.ToString(Request.QueryString["cmd"]);
            }
            catch
            {
                cmd = "";
            }
            portalid = ConvertUtility.ToInt32(Request.QueryString["portalid"]);
            DataTable dtCommands = null;

            if (!CurrentUser.IsSuperAdmin)
            {
                dtCommands = CommandController.GetCommandsForUserByPortalID(CurrentUser.UserID, portalid);
            }
            else
            {
                dtCommands = CommandController.GetCommands();
            }


            if (cmd != "")
            {
                DataRow[] _lstCommands = dtCommands.Select("CommandKey = '" + cmd + "' AND CommandVisible = 1");
                foreach (DataRow row in _lstCommands)
                {
                    listCmd.Add(row["CommandID"].ToString());
                    if (row["CommandParentID"].ToString() != "0")
                    {
                        LoadParentCommand(ConvertUtility.ToInt32(row["CommandParentID"].ToString()), dtCommands, ref listCmd);
                    }
                    break;
                }
            }

            DataRow[] drRoots = dtCommands.Select("CommandParentID = 0");
            int       _count  = 0;

            if (ConvertUtility.ToString(Request.QueryString["cmd"]) == "")
            {
                sb.Append("<li class=\"start active\"><a href=\"/\"><i class=\"icon-home\"></i><span class=\"title\">Home</span><span class=\"selected\"></span></a></li>");
            }
            else
            {
                sb.Append("<li><a href=\"/\"><i class=\"icon-home\"></i><span class=\"title\">Home</span><span class=\"selected\"></span></a></li>");
            }

            foreach (DataRow row in drRoots)
            {
                string name = "";
                string url  = "";
                name = row["CommandName"].ToString();
                //_item.Value = row["CommandID"].ToString();

                int       curItem      = ConvertUtility.ToInt32(row["CommandID"].ToString());
                DataRow[] _lstCommands = dtCommands.Select("CommandParentID = " + curItem + " AND CommandVisible = 1");

                if (!string.IsNullOrEmpty(row["CommandUrl"].ToString().Trim()))
                {
                    url = row["CommandUrl"].ToString();
                }
                else if (!string.IsNullOrEmpty(row["CommandKey"].ToString().Trim()))
                {
                    url = AppEnv.AdminUrlParams(row["CommandKey"].ToString()) + row["CommandParams"].ToString();
                }
                if (ConvertUtility.ToBoolean(row["CommandVisible"]) == false || ConvertUtility.ToBoolean(row["CommandEnable"]) == false)
                {
                    continue;
                }
                if (listCmd.Contains(row["CommandID"].ToString()))
                {
                    if (_count == 0)
                    {
                        sb.Append("<li class=\"start active\">");
                    }
                    else
                    {
                        sb.Append("<li class=\"active\">");
                    }
                }
                else
                {
                    if (_count == 0)
                    {
                        sb.Append("<li class=\"\">");
                    }
                    else
                    {
                        sb.Append("<li>");
                    }
                }

                if (_lstCommands.Length > 0)
                {
                    if (_count == 0)
                    {
                        sb.Append(string.Format(fmAu, url, name, "icon-gift"));
                    }
                    else
                    {
                        sb.Append(string.Format(fmAu, url, name, "icon-gift"));
                    }
                    sb.Append("<ul class=\"sub-menu\">");
                    LoadSidebarItems(ConvertUtility.ToInt32(row["CommandID"].ToString()), dtCommands);
                    sb.Append("</ul>");
                }
                else
                {
                    if (_count == 0)
                    {
                        sb.Append(string.Format(fmAd, url, name, "icon-home"));
                    }
                    else
                    {
                        sb.Append(string.Format(fmAd, url, name, "icon-gift"));
                    }
                }
                sb.Append("</li>");
                _count++;
            }
            radmMenu.Text = sb.ToString();
        }
Exemplo n.º 28
0
        protected void dtgPix_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                int       id   = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                ImageInfo info = ImageDB.GetInfo(id);
                try
                {
                    string avatarsource = info.Image_File;
                    if (avatarsource.Length > 0)
                    {
                        int      lengUploadString3 = AppEnv.UploadImagesThumbDir.Length;
                        string   filename3         = avatarsource.Substring(lengUploadString3);
                        FileInfo file3             = new FileInfo(Server.MapPath(AppEnv.UploadImagesThumbDir) + filename3);
                        if (file3.Exists)
                        {
                            file3.Delete();
                        }
                        FileInfo file4 = new FileInfo(Server.MapPath(AppEnv.UploadImagesNormalDir) + filename3);
                        if (file4.Exists)
                        {
                            file4.Delete();
                        }
                        FileInfo file5 = new FileInfo(Server.MapPath(AppEnv.UploadImagesOriginalDir) + filename3);
                        if (file5.Exists)
                        {
                            file5.Delete();
                        }
                    }

                    ContentImageDB.Delete(_contentId, id);

                    ImageDB.Delete(id);

                    lblStatusUpdate.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch
                {
                    lblStatusUpdate.Text = MiscUtility.UPDATE_ERROR;
                }
            }
            if (e.CommandName == "updaterow")
            {
                try
                {
                    int       id   = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                    ImageInfo info = ImageDB.GetInfo(id);

                    TextBox  txtPriority = (TextBox)e.Item.FindControl("txtPriority");
                    CheckBox chkVisible  = (CheckBox)e.Item.FindControl("chkVisible");
                    CheckBox chkCover    = (CheckBox)e.Item.FindControl("chkCover");

                    info.Image_Visible = ConvertUtility.ToBoolean(chkVisible.Checked);

                    ImageDB.Update(info);

                    ContentImageInfo ctinfo = ContentImageDB.GetInfo(_contentId, id);

                    ctinfo.Priority = ConvertUtility.ToInt32(txtPriority.Text);
                    ctinfo.IsCover  = ConvertUtility.ToBoolean(chkCover.Checked);

                    ContentImageDB.Update(ctinfo);

                    lblStatusUpdate.Text = MiscUtility.UPDATE_SUCCESS;
                }
                catch
                {
                    lblStatusUpdate.Text = MiscUtility.UPDATE_ERROR; //ex.ToString();
                }
            }
            if (e.CommandName == "editrow")
            {
                lblStatusUpdate.Text = lblStatusUpdate2.Text = string.Empty;

                var id   = ConvertUtility.ToInt32(e.Item.Cells[0].Text);
                var info = ImageDB.GetInfo(id);

                chkVisible.Checked = info.Image_Visible;
                txtName.Text       = info.Image_Name;
                txtTeaser.Text     = info.Image_Description;
                txtID.Text         = id.ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            lang       = Request.QueryString["lang"];
            width      = ConvertUtility.ToInt32(Request.QueryString["w"]);
            price      = ConfigurationSettings.AppSettings.Get("goldprice");
            telCo      = Session["telco"].ToString();
            linkStr    = "<a href=\"../" + UrlProcess.GetSportHomeUrlNew(lang, "home", width.ToString()).Replace("~/", "") + "\" >BÓNG ĐÁ<a>";
            linkStr_KD = "<a href=\"../" + UrlProcess.GetSportHomeUrlNew(lang, "home", width.ToString()).Replace("~/", "") + "\" >BONG DA<a>";

            if (!IsPostBack)
            {
                if (width == 0)
                {
                    width = (int)Constant.DefaultScreen.Standard;
                }
                ltrWidth.Text = "<meta content=\"width=" + width.ToString() + "; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;\" name=\"viewport\" />";

                gameid = ThethaoController.GetAll_Sport87DetailByGame87ID(ConvertUtility.ToInt32(Request.QueryString["id"])).Rows[0]["PK_Game87_ID"].ToString();
                DataSet ds87detail = ThethaoController.GetAll_Sport87_DetailBy_PK_Game87ID(gameid);
                if (!ConvertUtility.ToBoolean(ds87detail.Tables[0].Rows[0]["IsFull"]))
                {
                    pnlThongBao.Visible = true;
                    if (lang == "1")
                    {
                        ltrTitle.Text = linkStr + " » " + Resources.Resource.wThongBao;
                        //ltrThongBao.Text = Resources.Resource.wXacNhanDichVu.Replace("xxx", price);
                        ltrThongBao.Text = ds87detail.Tables[1].Rows[0]["ContentValue"].ToString();
                        btnCo.Visible    = false;
                        btnKhong.Visible = false;
                    }
                    else
                    {
                        ltrTitle.Text = linkStr_KD + " » " + Resources.Resource.wThongBao_KD;
                        //ltrThongBao.Text = Resources.Resource.wXacNhanDichVu_KD.Replace("xxx", price);
                        ltrThongBao.Text = UnicodeUtility.UnicodeToKoDau(ds87detail.Tables[1].Rows[0]["ContentValue"].ToString());
                        btnCo.Visible    = false;
                        btnKhong.Visible = false;
                    }
                }
                else
                {
                    if (WapController.W4A_Subscriber_IsActive(ConvertUtility.ToString(Session["msisdn"]), 2))
                    {
                        HienThiNoiDung(true, false);
                        return;
                    }

                    // Nếu có transactionid_old >> thuê bao mobifone đã thực hiện thanh toán
                    if (Session["transactionid_old"] != null)
                    {
                        messageReturn = ConvertUtility.ToString(Session["debit_status"]);
                        if (ConvertUtility.ToString(Session["debit_status"]) == "0")
                        {// Thanh toán thành công >> trả nội dung
                            HienThiNoiDung(true, true);
                        }
                        else
                        {// Thanh toán không thành công >> thông báo lỗi
                            HienThiNoiDung(false, true);
                        }
                        Session["transactionid_old"] = null;
                    }
                    else
                    {
                        //gameid = ThethaoController.GetAll_Sport87DetailByGame87ID(ConvertUtility.ToInt32(Request.QueryString["id"])).Rows[0]["PK_Game87_ID"].ToString();
                        if (telCo == Constant.T_Mobifone)
                        {
                            string content = Session["cpid"].ToString() + "&" + Constant.thethao + "9" + Request.QueryString["id"] + "&" + price + "&" + Session["transactionid"].ToString();
                            Response.Redirect(ConfigurationSettings.AppSettings.Get("vms3g") + "?link=" + Server.UrlEncode(EAS.EncryptData(content, ConfigurationSettings.AppSettings.Get("vmskey"))));
                        }
                        //
                        if (telCo == "Undefined")
                        {
                            pnlSMS.Visible = true;
                            if (lang == "1")
                            {
                                ltrHuongdan.Text = linkStr + " » " + Resources.Resource.wHuongDan;
                                //Xiên
                                if (Request.QueryString["id"] == "2")
                                {
                                    ltrSMS.Text = "Soạn tin <b>" + ConfigurationSettings.AppSettings.Get("xiencode") + "</b> gửi <b>" + ConfigurationSettings.AppSettings.Get("xiencommandcode") + "</b> để nhận chuỗi kèo xiên sáng nhất" + Resources.Resource.wChon3G;
                                }
                                //Trận cầu vàng
                                if (Request.QueryString["id"] == "4")
                                {
                                    ltrSMS.Text = "Soạn tin <b>" + ConfigurationSettings.AppSettings.Get("goldcode") + "</b> gửi <b>" + ConfigurationSettings.AppSettings.Get("goldcommandcode") + "</b> để nhận thông tin về trận cầu ngon ăn nhất" + Resources.Resource.wChon3G;
                                }
                                //Tài Xỉu sáng nhất
                                if (Request.QueryString["id"] == "5")
                                {
                                    ltrSMS.Text = "Soạn tin <b>" + ConfigurationSettings.AppSettings.Get("tvtxcode") + "</b> gửi <b>" + ConfigurationSettings.AppSettings.Get("tvtxcommandcode") + "</b> để nhận thông tin Tài Xỉu sáng nhất" + Resources.Resource.wChon3G;
                                }
                                //Trên dưới sáng nhất
                                if (Request.QueryString["id"] == "6")
                                {
                                    ltrSMS.Text = "Soạn tin <b>" + ConfigurationSettings.AppSettings.Get("tvtdcode") + "</b> gửi <b>" + ConfigurationSettings.AppSettings.Get("tvtdcommandcode") + "</b> để nhận thông tin Trên Dưới sáng nhất" + Resources.Resource.wChon3G;
                                }
                                //Sáng nhất giải
                                if (",1,3,7,8,9,10,11,12,".LastIndexOf("," + Request.QueryString["id"] + ",") >= 0)
                                {
                                    ltrSMS.Text = "Soạn tin <b>" + ConfigurationSettings.AppSettings.Get("sangcode") + " &lt;ma tran&gt;</b> gửi <b>" + ConfigurationSettings.AppSettings.Get("sangcommandcode") + "</b> để nhận thông tin Kèo sáng nhất giải" + Resources.Resource.wChon3G;
                                }
                            }
                            else
                            {
                                ltrHuongdan.Text = linkStr_KD + " » " + Resources.Resource.wHuongDan_KD;
                                if (Request.QueryString["id"] == "2")
                                {
                                    ltrSMS.Text = "Soan tin <b>" + ConfigurationSettings.AppSettings.Get("xiencode") + "</b> gui <b>" + ConfigurationSettings.AppSettings.Get("xiencommandcode") + "</b> de nhan chuoi keo xien sang nhat" + Resources.Resource.wChon3G;
                                }
                                if (Request.QueryString["id"] == "4")
                                {
                                    ltrSMS.Text = "Soan tin <b>" + ConfigurationSettings.AppSettings.Get("goldcode") + "</b> gui <b>" + ConfigurationSettings.AppSettings.Get("goldcommandcode") + "</b> de nhan thong tin ve tran cau ngon an nhat" + Resources.Resource.wChon3G_KD;
                                }
                                if (Request.QueryString["id"] == "5")
                                {
                                    ltrSMS.Text = "Soan tin <b>" + ConfigurationSettings.AppSettings.Get("tvtxcode") + "</b> gui <b>" + ConfigurationSettings.AppSettings.Get("tvtxcommandcode") + "</b> de nhan thong tin Tai Xiu sang nhat" + Resources.Resource.wChon3G_KD;
                                }
                                if (Request.QueryString["id"] == "6")
                                {
                                    ltrSMS.Text = "Soan tin <b>" + ConfigurationSettings.AppSettings.Get("tvtdcode") + "</b> gui <b>" + ConfigurationSettings.AppSettings.Get("tvtdcommandcode") + "</b> de nhan thong tin Tren Duoi sang nhat" + Resources.Resource.wChon3G_KD;
                                }
                                if (",1,3,7,8,9,10,11,12,".LastIndexOf("," + Request.QueryString["id"] + ",") >= 0)
                                {
                                    ltrSMS.Text = "Soan tin <b>" + ConfigurationSettings.AppSettings.Get("sangcode") + " &lt;ma tran&gt;</b> gui <b>" + ConfigurationSettings.AppSettings.Get("sangcommandcode") + "</b> de nhan thong tin Keo sang nhat giai" + Resources.Resource.wChon3G_KD;
                                }
                            }
                        }
                        else
                        {
                            //pnlThongBao.Visible = true;
                            //if (lang == "1")
                            //{
                            //    ltrTitle.Text = linkStr + " » " + Resources.Resource.wThongBao;
                            //    //ltrThongBao.Text = Resources.Resource.wXacNhanDichVu.Replace("xxx", price);
                            //    ltrThongBao.Text = Resources.Resource.wXacNhanDichVu + "dịch vụ tư vấn đặc biệt " + ds87detail.Tables[0].Rows[0]["Name"].ToString();
                            //    btnCo.Text = Resources.Resource.btnCo;
                            //    btnKhong.Text = Resources.Resource.btnKhong;
                            //}
                            //else
                            //{
                            //    ltrTitle.Text = linkStr_KD + " » " + Resources.Resource.wThongBao_KD;
                            //    //ltrThongBao.Text = Resources.Resource.wXacNhanDichVu_KD.Replace("xxx", price);
                            //    ltrThongBao.Text = Resources.Resource.wXacNhanDichVu + "dich vu tu van dac biet " + ds87detail.Tables[0].Rows[0]["Name"].ToString();
                            //    btnCo.Text = Resources.Resource.btnCo_KD;
                            //    btnKhong.Text = Resources.Resource.btnKhong_KD;
                            //}
                            pnlThongBao.Visible = false;
                            switch (Session["telco"].ToString())
                            {
                            case "Vietnamobile":
                                WapXzone_VNM.Library.VNMCharging.VNMChargingGW charging = new WapXzone_VNM.Library.VNMCharging.VNMChargingGW();

                                //messageReturn = charging.PaymentVNM(Session["msisdn"].ToString(), price, "D", "GAME87", Request.QueryString["id"].ToString());

                                //messageReturn = charging.PaymentVNM(Session["msisdn"].ToString(), "GAMEDOWN", "GAME_DOWN");
                                messageReturn = charging.NavigatePaymentVnm(Session["msisdn"].ToString(), "GAMEDOWN", "GAME_DOWN", price, "D", "GAME87", Request.QueryString["id"]);

                                if (!string.IsNullOrEmpty(messageReturn) && messageReturn == "1")
                                {    // Thanh toán thành công >> trả nội dung
                                    HienThiNoiDung(true, true);
                                }
                                else
                                {    // Thanh toán không thành công >> thông báo lỗi
                                    HienThiNoiDung(false, true);
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 30
0
        private static ImageInfo CreateEntityFromReader(IDataReader reader)
        {
            var item = new ImageInfo();

            try { if (!reader.IsDBNull(reader.GetOrdinal("Image_ID")))
                  {
                      item.Image_ID = ConvertUtility.ToInt32(reader["Image_ID"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Image_Name")))
                  {
                      item.Image_Name = ConvertUtility.ToString(reader["Image_Name"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Image_Description")))
                  {
                      item.Image_Description = ConvertUtility.ToString(reader["Image_Description"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Image_File")))
                  {
                      item.Image_File = ConvertUtility.ToString(reader["Image_File"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Image_CreateDate")))
                  {
                      item.Image_CreateDate = ConvertUtility.ToDateTime(reader["Image_CreateDate"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Image_FileSize")))
                  {
                      item.Image_FileSize = ConvertUtility.ToDouble(reader["Image_FileSize"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Image_Width")))
                  {
                      item.Image_Width = ConvertUtility.ToInt32(reader["Image_Width"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Image_Height")))
                  {
                      item.Image_Height = ConvertUtility.ToInt32(reader["Image_Height"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Image_View")))
                  {
                      item.Image_View = ConvertUtility.ToInt32(reader["Image_View"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("User_ID")))
                  {
                      item.User_ID = ConvertUtility.ToInt32(reader["User_ID"]);
                  }
            }
            catch { }
            try { if (!reader.IsDBNull(reader.GetOrdinal("Image_Visible")))
                  {
                      item.Image_Visible = ConvertUtility.ToBoolean(reader["Image_Visible"]);
                  }
            }
            catch { }
            return(item);
        }