Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Settings");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        switch (Request.QueryString["Mode"])
        {
        case "Styles":
        {
            PanelStyles.Visible = true;
            Page.Title          = "Salestan : تغییر فایل استایل";

            string inputString;
            using (StreamReader streamReader = File.OpenText(Server.MapPath("~") + @"\Styles\Styles.css"))
            {
                inputString = streamReader.ReadLine();
                while (inputString != null)
                {
                    TextBoxStyles.Text += inputString;
                    inputString         = streamReader.ReadLine();
                }
            }

            break;
        }
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Admins");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        //Page Title
        string[]        siteInformation = new string[] { };
        SiteInformation si = new SiteInformation();

        siteInformation = si.getInformation();

        Page.Title = siteInformation[0] + " : مدیریت ادمین ها";

        //insert log
        if (!IsPostBack)
        {
            AdminLogInsert ali = new AdminLogInsert();
            ali.insertAdminLog(Convert.ToInt32(Session["UserId"]), 1100, 0, "0");
        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Credit");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        switch (Request.QueryString["Mode"])
        {
        case "Log":
        {
            PanelLog.Visible = true;
            Page.Title       = "Salestan : تغییر اختیارات ادمین";
            break;
        }

        case "UserLog":
        {
            PanelUserLog.Visible = true;
            Page.Title           = "Salestan : فایل لاگ ادمین";
            break;
        }
        }
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Credit");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        switch (Request.QueryString["Mode"])
        {
            case "Log":
                {
                    PanelLog.Visible = true;
                    Page.Title = "Salestan : تغییر اختیارات ادمین";
                    break;
                }
            case "UserLog":
                {
                    PanelUserLog.Visible = true;
                    Page.Title = "Salestan : فایل لاگ ادمین";
                    break;
                }
        }
    }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Settings");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        switch (Request.QueryString["Mode"])
        {
            case "Styles":
                {
                    PanelStyles.Visible = true;
                    Page.Title = "Salestan : تغییر فایل استایل";

                    string inputString;
                    using (StreamReader streamReader = File.OpenText(Server.MapPath("~") + @"\Styles\Styles.css"))
                    {
                        inputString = streamReader.ReadLine();
                        while (inputString != null)
                        {
                            TextBoxStyles.Text += inputString;
                            inputString = streamReader.ReadLine();
                        }
                    }

                    break;
                }
        }
    }
Exemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Ads");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        //insert log
        if (!IsPostBack)
        {
            AdminLogInsert ali = new AdminLogInsert();
            ali.insertAdminLog(Convert.ToInt32(Session["UserId"]), 1200, 0, "0");
        }

        if (!IsPostBack)
        {
            DataTable     dt      = new DataTable();
            DataSet       ds      = new DataSet();
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

            SqlDataAdapter sda = new SqlDataAdapter("sp_ads", sqlConn);
            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sda.Fill(ds);
            dt = ds.Tables[0];

            //Top
            CheckBoxTop.Checked  = Convert.ToBoolean(dt.Rows[0]["Active"].ToString());
            TextBoxTopLink.Text  = dt.Rows[0]["Link"].ToString();
            TextBoxTopImage.Text = dt.Rows[0]["Image"].ToString();
            //Bottom
            CheckBoxBottom.Checked  = Convert.ToBoolean(dt.Rows[1]["Active"].ToString());
            TextBoxBottomLink.Text  = dt.Rows[1]["Link"].ToString();
            TextBoxBottomImage.Text = dt.Rows[1]["Image"].ToString();
            //Fold
            CheckBoxFold.Checked  = Convert.ToBoolean(dt.Rows[2]["Active"].ToString());
            TextBoxFoldLink.Text  = dt.Rows[2]["Link"].ToString();
            TextBoxFoldImage.Text = dt.Rows[2]["Image"].ToString();
            //Offers
            CheckBoxOffers.Checked  = Convert.ToBoolean(dt.Rows[3]["Active"].ToString());
            TextBoxOffersLink.Text  = dt.Rows[3]["Link"].ToString();
            TextBoxOffersImage.Text = dt.Rows[3]["Image"].ToString();
            //Coupons
            CheckBoxCoupons.Checked  = Convert.ToBoolean(dt.Rows[4]["Active"].ToString());
            TextBoxCouponsLink.Text  = dt.Rows[4]["Link"].ToString();
            TextBoxCouponsImage.Text = dt.Rows[4]["Image"].ToString();
            //Login
            CheckBoxLogin.Checked  = Convert.ToBoolean(dt.Rows[5]["Active"].ToString());
            TextBoxLoginLink.Text  = dt.Rows[5]["Link"].ToString();
            TextBoxLoginImage.Text = dt.Rows[5]["Image"].ToString();

            sda.Dispose();
            sqlConn.Close();
        }
    }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Ads");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        //insert log
        if (!IsPostBack)
        {
            AdminLogInsert ali = new AdminLogInsert();
            ali.insertAdminLog(Convert.ToInt32(Session["UserId"]), 1200, 0, "0");
        }

        if (!IsPostBack)
        {
            DataTable dt = new DataTable();
            DataSet ds = new DataSet();
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

            SqlDataAdapter sda = new SqlDataAdapter("sp_ads", sqlConn);
            sda.SelectCommand.CommandType = CommandType.StoredProcedure;
            sda.Fill(ds);
            dt = ds.Tables[0];

            //Top
            CheckBoxTop.Checked = Convert.ToBoolean(dt.Rows[0]["Active"].ToString());
            TextBoxTopLink.Text = dt.Rows[0]["Link"].ToString();
            TextBoxTopImage.Text = dt.Rows[0]["Image"].ToString();
            //Bottom
            CheckBoxBottom.Checked = Convert.ToBoolean(dt.Rows[1]["Active"].ToString());
            TextBoxBottomLink.Text = dt.Rows[1]["Link"].ToString();
            TextBoxBottomImage.Text = dt.Rows[1]["Image"].ToString();
            //Fold
            CheckBoxFold.Checked = Convert.ToBoolean(dt.Rows[2]["Active"].ToString());
            TextBoxFoldLink.Text = dt.Rows[2]["Link"].ToString();
            TextBoxFoldImage.Text = dt.Rows[2]["Image"].ToString();
            //Offers
            CheckBoxOffers.Checked = Convert.ToBoolean(dt.Rows[3]["Active"].ToString());
            TextBoxOffersLink.Text = dt.Rows[3]["Link"].ToString();
            TextBoxOffersImage.Text = dt.Rows[3]["Image"].ToString();
            //Coupons
            CheckBoxCoupons.Checked = Convert.ToBoolean(dt.Rows[4]["Active"].ToString());
            TextBoxCouponsLink.Text = dt.Rows[4]["Link"].ToString();
            TextBoxCouponsImage.Text = dt.Rows[4]["Image"].ToString();
            //Login
            CheckBoxLogin.Checked = Convert.ToBoolean(dt.Rows[5]["Active"].ToString());
            TextBoxLoginLink.Text = dt.Rows[5]["Link"].ToString();
            TextBoxLoginImage.Text = dt.Rows[5]["Image"].ToString();

            sda.Dispose();
            sqlConn.Close();
        }
    }
Exemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //check premissions
     AdminPremissions ap = new AdminPremissions();
     bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Stats");
     if (!AdminPremission)
     {
         Response.Redirect("~/Error.aspx?Code=404");
     }
 }
Exemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Blog");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }


        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
            case "Edit":
            {
                PanelEdit.Visible = true;
                Page.Title        = "Salestan : بلاگ";

                DataTable     dt      = new DataTable();
                DataSet       ds      = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                SqlDataAdapter sda = new SqlDataAdapter("sp_blogInfo", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@BlogId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["BlogId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                if (dt.Rows.Count == 0)         //news doesn't exist
                {
                    //LabelName.Text = "خبری با این شناسه موجود نمی باشد!";
                }
                else         //news exists
                {
                    TimeClass tc = new TimeClass();
                    LabelDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["SubmitDate"].ToString()));

                    TextBoxTitle.Text     = dt.Rows[0]["Title"].ToString();
                    TextBoxBrief.Text     = dt.Rows[0]["Brief"].ToString();
                    TextBoxBody.Text      = dt.Rows[0]["Body"].ToString();
                    TextBoxPhotoLink.Text = dt.Rows[0]["PhotoLink"].ToString();
                    //Location
                    DropDownListLanguage.SelectedValue = dt.Rows[0]["Language"].ToString();
                }
                sda.Dispose();
                sqlConn.Close();

                break;
            }
            }
        }
    }
Exemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Blog");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }


        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
                case "Edit":
                    {
                        PanelEdit.Visible = true;
                        Page.Title = "Salestan : بلاگ";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_blogInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@BlogId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["BlogId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        if (dt.Rows.Count == 0) //news doesn't exist
                        {
                            //LabelName.Text = "خبری با این شناسه موجود نمی باشد!";
                        }
                        else //news exists
                        {
                            TimeClass tc = new TimeClass();
                            LabelDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["SubmitDate"].ToString()));

                            TextBoxTitle.Text = dt.Rows[0]["Title"].ToString();
                            TextBoxBrief.Text = dt.Rows[0]["Brief"].ToString();
                            TextBoxBody.Text = dt.Rows[0]["Body"].ToString();
                            TextBoxPhotoLink.Text = dt.Rows[0]["PhotoLink"].ToString();
                            //Location
                            DropDownListLanguage.SelectedValue = dt.Rows[0]["Language"].ToString();
                        }
                        sda.Dispose();
                        sqlConn.Close();

                        break;
                    }
            }
        }
    }
Exemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Support");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }
    }
Exemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Newsletter");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        //insert log
        if (!IsPostBack)
        {
            AdminLogInsert ali = new AdminLogInsert();
            ali.insertAdminLog(Convert.ToInt32(Session["UserId"]), 2300, 0, "0");
        }
    }
Exemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Users");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        //insert log
        if (!IsPostBack)
        {
            AdminLogInsert ali = new AdminLogInsert();
            ali.insertAdminLog(Convert.ToInt32(Session["UserId"]), 2000, 0, "0");
        }
    }
Exemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Credit");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        //insert log
        if (!IsPostBack)
        {
            AdminLogInsert ali = new AdminLogInsert();
            ali.insertAdminLog(Convert.ToInt32(Session["UserId"]), 1600, 0, "0");
        }

        DataTable     dt      = new DataTable();
        DataSet       ds      = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);
        SqlCommand    sqlCmd  = new SqlCommand("sp_creditRequestsPendingCount", sqlConn);

        sqlCmd.CommandType = CommandType.StoredProcedure;

        sqlConn.Open();
        int RequestsUnreadCount = (int)sqlCmd.ExecuteScalar();

        sqlCmd.Dispose();
        sqlConn.Dispose();

        if (RequestsUnreadCount == 0)
        {
            LabelRequestsNewCount.Visible = false;
        }
        else
        {
            LabelRequestsNewCount.Visible = true;
            LabelRequestsNewCount.Text    = "(" + RequestsUnreadCount + " درخواست پاسخ داده نشده)";
        }
    }
Exemplo n.º 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Offers");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        //insert log
        if (!IsPostBack)
        {
            AdminLogInsert ali = new AdminLogInsert();
            ali.insertAdminLog(Convert.ToInt32(Session["UserId"]), 1800, 0, "0");
        }

        DataTable dt = new DataTable();
        DataSet ds = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);
        SqlCommand sqlCmd = new SqlCommand("sp_commentsOffersPendingCount", sqlConn);
        sqlCmd.CommandType = CommandType.StoredProcedure;

        sqlConn.Open();
        int CommentsUnreadCount = (int)sqlCmd.ExecuteScalar();

        sqlCmd.Dispose();
        sqlConn.Dispose();

        if (CommentsUnreadCount == 0)
        {
            LabelCommentNewCount.Visible = false;
        }
        else
        {
            LabelCommentNewCount.Visible = true;
            LabelCommentNewCount.Text = "(" + CommentsUnreadCount + " نظر پاسخ داده نشده)";
        }
    }
Exemplo n.º 16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Newsletter");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        DataTable     dt      = new DataTable();
        DataSet       ds      = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

        SqlDataAdapter sda = new SqlDataAdapter("sp_newsletterInfo", sqlConn);

        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.SelectCommand.Parameters.Add("@NewsletterId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["NewsletterId"]);
        sda.Fill(ds);
        dt = ds.Tables[0];

        if (dt.Rows.Count == 0) //admin doesn't exist
        {
            //LabelName.Text = "کاربری با این شناسه موجود نمی باشد!";
        }
        else //user exists
        {
            LabelNewsletterId.Text      = Request.QueryString["NewsletterId"].ToString();
            ImageFormat.ImageUrl        = "~/images/TypesImages/NewsletterFormat" + dt.Rows[0]["Format"].ToString() + ".png";
            LabelReceiversCount.Text    = dt.Rows[0]["ReceiversCount"].ToString();
            ImageReceiversType.ImageUrl = "~/images/TypesImages/NewsletterReceivers" + dt.Rows[0]["ReceiversType"].ToString() + ".png";
            LabelTitle.Text             = dt.Rows[0]["Title"].ToString();
            LiteralBody.Text            = dt.Rows[0]["Body"].ToString();
        }
        sda.Dispose();
        sqlConn.Close();
    }
Exemplo n.º 17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Admins");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        //Page Title
        string[] siteInformation = new string[] { };
        SiteInformation si = new SiteInformation();
        siteInformation = si.getInformation();

        Page.Title = siteInformation[0] + " : مدیریت ادمین ها";

        //insert log
        if (!IsPostBack)
        {
            AdminLogInsert ali = new AdminLogInsert();
            ali.insertAdminLog(Convert.ToInt32(Session["UserId"]), 1100, 0, "0");
        }
    }
Exemplo n.º 18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Newsletter");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        DataTable dt = new DataTable();
        DataSet ds = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

        SqlDataAdapter sda = new SqlDataAdapter("sp_newsletterInfo", sqlConn);
        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.SelectCommand.Parameters.Add("@NewsletterId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["NewsletterId"]);
        sda.Fill(ds);
        dt = ds.Tables[0];

        if (dt.Rows.Count == 0) //admin doesn't exist
        {
            //LabelName.Text = "کاربری با این شناسه موجود نمی باشد!";
        }
        else //user exists
        {
            LabelNewsletterId.Text = Request.QueryString["NewsletterId"].ToString();
            ImageFormat.ImageUrl = "~/images/TypesImages/NewsletterFormat" + dt.Rows[0]["Format"].ToString() + ".png";
            LabelReceiversCount.Text = dt.Rows[0]["ReceiversCount"].ToString();
            ImageReceiversType.ImageUrl = "~/images/TypesImages/NewsletterReceivers" + dt.Rows[0]["ReceiversType"].ToString() + ".png";
            LabelTitle.Text = dt.Rows[0]["Title"].ToString();
            LiteralBody.Text = dt.Rows[0]["Body"].ToString();
        }
        sda.Dispose();
        sqlConn.Close();
    }
Exemplo n.º 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Admins");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
                case "Edit":
                    {
                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_adminInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["UserId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        if (dt.Rows.Count == 0) //admin doesn't exist
                        {
                            LabelName.Text = "کاربری با این شناسه موجود نمی باشد!";
                        }
                        else //user exists
                        {
                            LabelUserId.Text = Request.QueryString["UserId"].ToString();
                            LabelName.Text = dt.Rows[0]["FullName"].ToString();
                            DropDownListStatus.SelectedValue = dt.Rows[0]["Status"].ToString();
                            CheckBoxListPremissions.Items[0].Selected = Convert.ToBoolean(dt.Rows[0]["PremAdmins"].ToString());
                            CheckBoxListPremissions.Items[1].Selected = Convert.ToBoolean(dt.Rows[0]["PremAds"].ToString());
                            CheckBoxListPremissions.Items[2].Selected = Convert.ToBoolean(dt.Rows[0]["PremAgencies"].ToString());
                            CheckBoxListPremissions.Items[3].Selected = Convert.ToBoolean(dt.Rows[0]["PremBlog"].ToString());
                            CheckBoxListPremissions.Items[4].Selected = Convert.ToBoolean(dt.Rows[0]["PremCharity"].ToString());
                            CheckBoxListPremissions.Items[5].Selected = Convert.ToBoolean(dt.Rows[0]["PremCompanies"].ToString());
                            CheckBoxListPremissions.Items[6].Selected = Convert.ToBoolean(dt.Rows[0]["PremContent"].ToString());
                            CheckBoxListPremissions.Items[7].Selected = Convert.ToBoolean(dt.Rows[0]["PremCoupons"].ToString());
                            CheckBoxListPremissions.Items[8].Selected = Convert.ToBoolean(dt.Rows[0]["PremCredit"].ToString());
                            CheckBoxListPremissions.Items[9].Selected = Convert.ToBoolean(dt.Rows[0]["PremCurrencies"].ToString());
                            CheckBoxListPremissions.Items[10].Selected = Convert.ToBoolean(dt.Rows[0]["PremLocations"].ToString());
                            CheckBoxListPremissions.Items[11].Selected = Convert.ToBoolean(dt.Rows[0]["PremNewsletter"].ToString());
                            CheckBoxListPremissions.Items[12].Selected = Convert.ToBoolean(dt.Rows[0]["PremOffers"].ToString());
                            CheckBoxListPremissions.Items[13].Selected = Convert.ToBoolean(dt.Rows[0]["PremSettings"].ToString());
                            CheckBoxListPremissions.Items[14].Selected = Convert.ToBoolean(dt.Rows[0]["PremStats"].ToString());
                            CheckBoxListPremissions.Items[15].Selected = Convert.ToBoolean(dt.Rows[0]["PremSupport"].ToString());
                            CheckBoxListPremissions.Items[16].Selected = Convert.ToBoolean(dt.Rows[0]["PremUsers"].ToString());
                            HyperLinkEditLog.NavigateUrl = "~/AdminPages/Admins.aspx?Mode=Log&UserId=" + Request.QueryString["UserId"].ToString();
                        }
                        sda.Dispose();
                        sqlConn.Close();
                        PanelEdit.Visible = true;
                        Page.Title = "Salestan : تغییر اختیارات ادمین";
                        break;
                    }
                case "Log":
                    {
                        PanelLog.Visible = true;
                        Page.Title = "Salestan : فایل لاگ ادمین";
                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_adminInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["UserId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        if (dt.Rows.Count == 0) //admin doesn't exist
                        {
                            LabelLogName.Text = "کاربری با این شناسه موجود نمی باشد!";
                        }
                        else //user exists
                        {
                            LabelLogUserId.Text = Request.QueryString["UserId"].ToString();
                            LabelLogName.Text = dt.Rows[0]["FullName"].ToString();
                            HyperLinkLogEdit.NavigateUrl = "~/AdminPages/Admins.aspx?Mode=Edit&UserId=" + Request.QueryString["UserId"].ToString();
                        }
                        sda.Dispose();
                        sqlConn.Close();
                        break;
                    }
            }
        }
    }
Exemplo n.º 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Charity");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }


        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
                case "NewsAdd":
                    {
                        PanelNews.Visible = true;
                        Page.Title = "Salestan : اخبار خیریه";
                        ImageButtonNewsSubmit.ImageUrl = "~/images/Buttons/add-off.png";

                        LabelDate.Text = DateTime.Now.ToShortDateString();
                        break;
                    }
                case "OrganizationsAdd":
                    {
                        PanelOrganizations.Visible = true;
                        Page.Title = "Salestan : موسسات خیریه";
                        ImageButtonOrganizations.ImageUrl = "~/images/Buttons/add-off.png";
                        break;
                    }
                case "NewsEdit":
                    {
                        PanelNews.Visible = true;
                        Page.Title = "Salestan : اخبار خیریه";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_charityNewsInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@NewsId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["NewsId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        if (dt.Rows.Count == 0) //news doesn't exist
                        {
                            //LabelName.Text = "خبری با این شناسه موجود نمی باشد!";
                        }
                        else //news exists
                        {
                            TimeClass tc = new TimeClass();
                            LabelDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["SubmitDate"].ToString()));

                            TextBoxNewsSubject.Text = dt.Rows[0]["Subject"].ToString();
                            TextBoxNewsBrief.Text = dt.Rows[0]["Brief"].ToString();
                            TextBoxNewsBody.Text = dt.Rows[0]["Body"].ToString();
                            //Location
                            DropDownListLanguage.SelectedValue = dt.Rows[0]["Language"].ToString();
                            ImageButtonNewsSubmit.ImageUrl = "~/images/Buttons/edit-off.png";
                        }
                        sda.Dispose();
                        sqlConn.Close();

                        break;
                    }
                case "OrganizationsEdit":
                    {
                        PanelOrganizations.Visible = true;
                        Page.Title = "Salestan : موسسات خیریه";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_charityOrganizationsInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@OrganizationId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["OrganizationId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        if (dt.Rows.Count == 0) //news doesn't exist
                        {
                            //LabelName.Text = "موسسه ای با این شناسه موجود نمی باشد!";
                        }
                        else //news exists
                        {
                            TextBoxName.Text = dt.Rows[0]["Name"].ToString();
                            TextBoxAbout.Text = dt.Rows[0]["About"].ToString();
                            TextBoxEmail.Text = dt.Rows[0]["Email"].ToString();
                            TextBoxWebsite.Text = dt.Rows[0]["Website"].ToString();
                            TextBoxPhone.Text = dt.Rows[0]["Phone"].ToString();
                            TextBoxFax.Text = dt.Rows[0]["Fax"].ToString();
                            TextBoxAddress.Text = dt.Rows[0]["Address"].ToString();
                            ImageButtonOrganizations.ImageUrl = "~/images/Buttons/edit-off.png";
                            //Location
                        }
                        sda.Dispose();
                        sqlConn.Close();

                        break;
                    }
            }
        }
    }
Exemplo n.º 21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Companies");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
                case "Edit":
                    {
                        PanelEdit.Visible = true;
                        Page.Title = "Salestan : تغییر مشخصات مشاغل";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_companyInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@CompanyId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["CompanyId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        TextBoxOwnerId.Text = dt.Rows[0]["OwnerId"].ToString();
                        TextBoxName.Text = dt.Rows[0]["Name"].ToString();
                        TextBoxAbout.Text = dt.Rows[0]["About"].ToString();
                        DropDownListType.SelectedValue = dt.Rows[0]["TypeId"].ToString();
                        DropDownListField.SelectedValue = dt.Rows[0]["FieldId"].ToString();
                        TextBoxPhone.Text = dt.Rows[0]["Tel"].ToString();
                        TextBoxFax.Text = dt.Rows[0]["Fax"].ToString();
                        TextBoxMobile.Text = dt.Rows[0]["Mobile"].ToString();
                        TextBoxEmail.Text = dt.Rows[0]["Email"].ToString();
                        TextBoxWebsite.Text = dt.Rows[0]["Website"].ToString();
                        TextBoxAddress.Text = dt.Rows[0]["Address"].ToString();
                        TextBoxGoogleMap.Text = dt.Rows[0]["GoogleMap"].ToString();


                        break;
                    }
                case "Info":
                    {
                        PanelInfo.Visible = true;
                        Page.Title = "Salestan : مشخصات مشاغل";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_companyInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@CompanyId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["CompanyId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        if (dt.Rows.Count == 0) //admin doesn't exist
                        {
                            LabelMessage.Text = "شغلی با این شناسه موجود نمی باشد!";
                            LabelMessage.CssClass = "ErrorMessage";
                            LabelMessage.Visible = true;
                            PanelInfo.Visible = false;
                        }
                        else //user exists
                        {

                            LabelMessage.Visible = false;
                            PanelInfo.Visible = true;

                            LabelInfoOwner.Text = dt.Rows[0]["OwnerName"].ToString();
                            LabelInfoName.Text = dt.Rows[0]["Name"].ToString();
                            LabelInfoType.Text = dt.Rows[0]["TypeName"].ToString();
                            LabelInfoField.Text = dt.Rows[0]["FieldName"].ToString();
                            LabelInfoAbout.Text = dt.Rows[0]["About"].ToString();
                            LabelInfoPhone.Text = dt.Rows[0]["Tel"].ToString();
                            LabelInfoFax.Text = dt.Rows[0]["Fax"].ToString();
                            LabelInfoMobile.Text = dt.Rows[0]["Mobile"].ToString();
                            LabelInfoEmail.Text = dt.Rows[0]["Email"].ToString();
                            HyperLinkInfoWebsite.Text = dt.Rows[0]["Website"].ToString();
                            HyperLinkInfoWebsite.NavigateUrl = dt.Rows[0]["Website"].ToString();
                            LabelInfoAddress.Text = dt.Rows[0]["Address"].ToString();
                            LabelInfoGoogleMap.Text = dt.Rows[0]["GoogleMap"].ToString();
                            if (Convert.ToBoolean(dt.Rows[0]["Photo"].ToString()))
                            {
                                ImageInfoLogo.ImageUrl = "~/Files/companies/" + Request.QueryString["CompanyId"].ToString() + ".png";
                                ImageInfoLogo.Visible = true;
                            }
                        }
                        sda.Dispose();
                        sqlConn.Close();

                        HyperLinkInfoChange.NavigateUrl = "~/AdminPages/Companies.aspx?Mode=Edit&CompanyId=" + Request.QueryString["CompanyId"];

                        break;
                    }
            }
        }
    }
Exemplo n.º 22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Offers");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
                case "Edit":
                    {
                        PanelEdit.Visible = true;
                        Page.Title = "Salestan : تغییر مشخصات پیشنهاد";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_offerInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@OfferId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["OfferId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        //Descriptions
                        StringBuilder sbDescriptions = new StringBuilder(HttpUtility.HtmlEncode(dt.Rows[0]["Descriptions"].ToString()));
                        sbDescriptions.Replace("<", "&lt;");
                        sbDescriptions.Replace(">", "&gt;");
                        string descriptions = sbDescriptions.ToString();
                        //Highlights
                        StringBuilder sbHighlights = new StringBuilder(HttpUtility.HtmlEncode(dt.Rows[0]["Highlights"].ToString()));
                        sbHighlights.Replace("<", "&lt;");
                        sbHighlights.Replace(">", "&gt;");
                        string highlights = sbHighlights.ToString();
                        //Details
                        StringBuilder sbDetails = new StringBuilder(HttpUtility.HtmlEncode(dt.Rows[0]["Details"].ToString()));
                        sbDetails.Replace("<", "&lt;");
                        sbDetails.Replace(">", "&gt;");
                        string details = sbDetails.ToString();


                        DropDownListCompany.SelectedValue = dt.Rows[0]["CompanyId"].ToString();
                        TextBoxTitle.Text = dt.Rows[0]["Title"].ToString();
                        TextBoxBrowserTitle.Text = dt.Rows[0]["BrowserTitle"].ToString();
                        DropDownListCategory.SelectedValue = dt.Rows[0]["CategoryId"].ToString();
                        TextBoxHighlights.Text = highlights;
                        TextBoxDetails.Text = details;
                        TextBoxDescriptions.Text = descriptions;
                        TextBoxPriceOffer.Text = dt.Rows[0]["PriceOffer"].ToString();
                        TextBoxPriceNormal.Text = dt.Rows[0]["PriceNormal"].ToString();
                        TextBoxPriceGift.Text = dt.Rows[0]["PriceGift"].ToString();
                        TextBoxPriceOurs.Text = dt.Rows[0]["PriceOurs"].ToString();
                        TextBoxPricePercent.Text = dt.Rows[0]["PriceDiscountPercent"].ToString();
                        TextBoxMinBuy.Text = dt.Rows[0]["MinBuy"].ToString();
                        TextBoxMaxBuy.Text = dt.Rows[0]["MaxBuy"].ToString();
                        TextBoxMinUser.Text = dt.Rows[0]["MinUser"].ToString();
                        TextBoxMaxUser.Text = dt.Rows[0]["MaxUser"].ToString();
                        LabelShowDateValue.Text = dt.Rows[0]["ShowDate"].ToString();
                        LabelEndDateValue.Text = dt.Rows[0]["EndDate"].ToString();
                        DropDownListLanguage.SelectedValue = dt.Rows[0]["Language"].ToString();
                        TextBoxLink1Name.Text = dt.Rows[0]["Link1Name"].ToString();
                        TextBoxLink1Url.Text = dt.Rows[0]["Link1Url"].ToString();
                        TextBoxLink2Name.Text = dt.Rows[0]["Link2Name"].ToString();
                        TextBoxLink2Url.Text = dt.Rows[0]["Link2Url"].ToString();
                        //locations
                        for (int i = 0; i < CheckBoxListLocations.Items.Count; i++)
                        {
                            if (dt.Rows[0]["Locations"].ToString().Contains(CheckBoxListLocations.Items[i].Value + ","))
                            {
                                CheckBoxListLocations.Items[i].Selected = true;
                            }
                        }

                        sda.Dispose();
                        sqlConn.Dispose();

                        break;
                    }
                case "Buyers":
                    {
                        PanelBuyers.Visible = true;
                        Page.Title = "Salestan : فهرست خریداران پیشنهاد";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_offerBuyers", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@OfferId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["OfferId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        LabelBuyersCompanyName.Text = dt.Rows[0]["Name"].ToString();
                        LabelBuyersCompanyId.Text = dt.Rows[0]["CompanyId"].ToString();
                        LabelBuyersOfferId.Text = Request.QueryString["OfferId"];
                        LabelBuyersTitle.Text = dt.Rows[0]["Title"].ToString();
                        LabelBuyersSold.Text = dt.Rows[0]["PurchasedCount"].ToString();

                        TimeClass tc = new TimeClass();
                        LabelBuyersDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["ShowDate"].ToString()));

                        sda.Dispose();
                        sqlConn.Dispose();

                        break;
                    }
                case "Photos":
                    {
                        PanelPhotos.Visible = true;
                        Page.Title = "Salestan : تصاویر پیشنهاد";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_offersPhotos", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@OfferId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["OfferId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        LabelPhotosCompanyName.Text = dt.Rows[0]["Name"].ToString();
                        LabelPhotosCompanyId.Text = dt.Rows[0]["CompanyId"].ToString();
                        LabelPhotosOfferId.Text = Request.QueryString["OfferId"];
                        LabelPhotosOfferTitle.Text = dt.Rows[0]["Title"].ToString();

                        if (dt.Rows[0]["MainPhoto"].ToString() == "0")
                        {
                            ImageMainPhoto.ImageUrl = "NoPhoto.jpg"; 
                        }
                        else
                        {
                            ImageMainPhoto.ImageUrl = "~/Files/Photos/" + dt.Rows[0]["MainPhoto"].ToString() + ".jpg";
                        }

                        sda.Dispose();
                        sqlConn.Dispose();

                        break;
                    }
            }
        }
    }
Exemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Companies");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
            case "Edit":
            {
                PanelEdit.Visible = true;
                Page.Title        = "Salestan : تغییر مشخصات مشاغل";

                DataTable     dt      = new DataTable();
                DataSet       ds      = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                SqlDataAdapter sda = new SqlDataAdapter("sp_companyInfo", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@CompanyId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["CompanyId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                TextBoxOwnerId.Text             = dt.Rows[0]["OwnerId"].ToString();
                TextBoxName.Text                = dt.Rows[0]["Name"].ToString();
                TextBoxAbout.Text               = dt.Rows[0]["About"].ToString();
                DropDownListType.SelectedValue  = dt.Rows[0]["TypeId"].ToString();
                DropDownListField.SelectedValue = dt.Rows[0]["FieldId"].ToString();
                TextBoxPhone.Text               = dt.Rows[0]["Tel"].ToString();
                TextBoxFax.Text       = dt.Rows[0]["Fax"].ToString();
                TextBoxMobile.Text    = dt.Rows[0]["Mobile"].ToString();
                TextBoxEmail.Text     = dt.Rows[0]["Email"].ToString();
                TextBoxWebsite.Text   = dt.Rows[0]["Website"].ToString();
                TextBoxAddress.Text   = dt.Rows[0]["Address"].ToString();
                TextBoxGoogleMap.Text = dt.Rows[0]["GoogleMap"].ToString();


                break;
            }

            case "Info":
            {
                PanelInfo.Visible = true;
                Page.Title        = "Salestan : مشخصات مشاغل";

                DataTable     dt      = new DataTable();
                DataSet       ds      = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                SqlDataAdapter sda = new SqlDataAdapter("sp_companyInfo", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@CompanyId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["CompanyId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                if (dt.Rows.Count == 0)         //admin doesn't exist
                {
                    LabelMessage.Text     = "شغلی با این شناسه موجود نمی باشد!";
                    LabelMessage.CssClass = "ErrorMessage";
                    LabelMessage.Visible  = true;
                    PanelInfo.Visible     = false;
                }
                else         //user exists
                {
                    LabelMessage.Visible = false;
                    PanelInfo.Visible    = true;

                    LabelInfoOwner.Text              = dt.Rows[0]["OwnerName"].ToString();
                    LabelInfoName.Text               = dt.Rows[0]["Name"].ToString();
                    LabelInfoType.Text               = dt.Rows[0]["TypeName"].ToString();
                    LabelInfoField.Text              = dt.Rows[0]["FieldName"].ToString();
                    LabelInfoAbout.Text              = dt.Rows[0]["About"].ToString();
                    LabelInfoPhone.Text              = dt.Rows[0]["Tel"].ToString();
                    LabelInfoFax.Text                = dt.Rows[0]["Fax"].ToString();
                    LabelInfoMobile.Text             = dt.Rows[0]["Mobile"].ToString();
                    LabelInfoEmail.Text              = dt.Rows[0]["Email"].ToString();
                    HyperLinkInfoWebsite.Text        = dt.Rows[0]["Website"].ToString();
                    HyperLinkInfoWebsite.NavigateUrl = dt.Rows[0]["Website"].ToString();
                    LabelInfoAddress.Text            = dt.Rows[0]["Address"].ToString();
                    LabelInfoGoogleMap.Text          = dt.Rows[0]["GoogleMap"].ToString();
                    if (Convert.ToBoolean(dt.Rows[0]["Photo"].ToString()))
                    {
                        ImageInfoLogo.ImageUrl = "~/Files/companies/" + Request.QueryString["CompanyId"].ToString() + ".png";
                        ImageInfoLogo.Visible  = true;
                    }
                }
                sda.Dispose();
                sqlConn.Close();

                HyperLinkInfoChange.NavigateUrl = "~/AdminPages/Companies.aspx?Mode=Edit&CompanyId=" + Request.QueryString["CompanyId"];

                break;
            }
            }
        }
    }
Exemplo n.º 24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Users");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
            case "Info":
            {
                PanelInfo.Visible = true;
                Page.Title        = "Salestan : مشخصات کاربر";

                DataTable     dt      = new DataTable();
                DataSet       ds      = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                SqlDataAdapter sda = new SqlDataAdapter("sp_userInfo", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["UserId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                if (dt.Rows.Count == 0)         //admin doesn't exist
                {
                    LabelMessage.Text     = "کاربری با این شناسه موجود نمی باشد!";
                    LabelMessage.CssClass = "ErrorMessage";
                    LabelMessage.Visible  = true;
                    PanelUserInfo.Visible = false;
                }
                else         //user exists
                {
                    LabelMessage.Visible  = false;
                    PanelUserInfo.Visible = true;

                    LabelUserIdValue.Text            = Request.QueryString["UserId"].ToString();
                    LabelEmailValue.Text             = dt.Rows[0]["Email"].ToString();
                    LabelFirstNameValue.Text         = dt.Rows[0]["FirstName"].ToString();
                    LabelLastNameValue.Text          = dt.Rows[0]["LastName"].ToString();
                    LabelBirthValue.Text             = dt.Rows[0]["BirthDate"].ToString();
                    ImageGender.ImageUrl             = "~/images/icons/gender24" + dt.Rows[0]["Gender"].ToString() + ".png";
                    LabelJobValue.Text               = dt.Rows[0]["Job"].ToString();
                    LabelEducationValue.Text         = dt.Rows[0]["Education"].ToString();
                    LabelHomePhoneValue.Text         = dt.Rows[0]["HomeTel"].ToString();
                    LabelWorkPhoneValue.Text         = dt.Rows[0]["WorkTel"].ToString();
                    LabelMobileValue.Text            = dt.Rows[0]["Mobile"].ToString();
                    LabelAddressValue.Text           = dt.Rows[0]["Address"].ToString();
                    LabelCredit.Text                 = dt.Rows[0]["Credit"].ToString();
                    LabelGiftCredit.Text             = dt.Rows[0]["GiftCredit"].ToString();
                    LabelSpentCredit.Text            = dt.Rows[0]["SpentCredit"].ToString();
                    LabelSpendGift.Text              = dt.Rows[0]["SpentGift"].ToString();
                    LabelStatsOffersPurchased.Text   = dt.Rows[0]["PurchasedOffersCount"].ToString();
                    LabelStatsUsersInvite.Text       = dt.Rows[0]["InvitedUsersCount"].ToString();
                    DropDownListStatus.SelectedValue = dt.Rows[0]["Status"].ToString();

                    TimeClass tc = new TimeClass();
                    LabelMemberSinceValue.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["MemberSince"].ToString()));
                    LabelLastLoginValue.Text   = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["LastLogin"].ToString()));
                }
                sda.Dispose();
                sqlConn.Close();

                break;
            }
            }
        }
    }
Exemplo n.º 25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Users");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
                case "Info":
                    {
                        PanelInfo.Visible = true;
                        Page.Title = "Salestan : مشخصات کاربر";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_userInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["UserId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        if (dt.Rows.Count == 0) //admin doesn't exist
                        {
                            LabelMessage.Text = "کاربری با این شناسه موجود نمی باشد!";
                            LabelMessage.CssClass = "ErrorMessage";
                            LabelMessage.Visible = true;
                            PanelUserInfo.Visible = false;
                        }
                        else //user exists
                        {

                            LabelMessage.Visible = false;
                            PanelUserInfo.Visible = true;

                            LabelUserIdValue.Text = Request.QueryString["UserId"].ToString();
                            LabelEmailValue.Text = dt.Rows[0]["Email"].ToString();
                            LabelFirstNameValue.Text = dt.Rows[0]["FirstName"].ToString();
                            LabelLastNameValue.Text = dt.Rows[0]["LastName"].ToString();
                            LabelBirthValue.Text = dt.Rows[0]["BirthDate"].ToString();
                            ImageGender.ImageUrl = "~/images/icons/gender24" + dt.Rows[0]["Gender"].ToString() + ".png";
                            LabelJobValue.Text = dt.Rows[0]["Job"].ToString();
                            LabelEducationValue.Text = dt.Rows[0]["Education"].ToString();
                            LabelHomePhoneValue.Text = dt.Rows[0]["HomeTel"].ToString();
                            LabelWorkPhoneValue.Text = dt.Rows[0]["WorkTel"].ToString();
                            LabelMobileValue.Text = dt.Rows[0]["Mobile"].ToString();
                            LabelAddressValue.Text = dt.Rows[0]["Address"].ToString();
                            LabelCredit.Text = dt.Rows[0]["Credit"].ToString();
                            LabelGiftCredit.Text = dt.Rows[0]["GiftCredit"].ToString();
                            LabelSpentCredit.Text = dt.Rows[0]["SpentCredit"].ToString();
                            LabelSpendGift.Text = dt.Rows[0]["SpentGift"].ToString();
                            LabelStatsOffersPurchased.Text = dt.Rows[0]["PurchasedOffersCount"].ToString();
                            LabelStatsUsersInvite.Text = dt.Rows[0]["InvitedUsersCount"].ToString();
                            DropDownListStatus.SelectedValue = dt.Rows[0]["Status"].ToString();

                            TimeClass tc = new TimeClass();
                            LabelMemberSinceValue.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["MemberSince"].ToString()));
                            LabelLastLoginValue.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["LastLogin"].ToString()));
                        }
                        sda.Dispose();
                        sqlConn.Close();

                        break;
                    }
            }
        }
    }
Exemplo n.º 26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Coupons");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
            case "Edit":
            {
                PanelEdit.Visible = true;
                Page.Title        = "Salestan : تغییر مشخصات کوپن";

                DataTable     dt      = new DataTable();
                DataSet       ds      = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                SqlDataAdapter sda = new SqlDataAdapter("sp_couponInfo", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@CouponId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["CouponId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                //Descriptions
                StringBuilder sbDescriptions = new StringBuilder(HttpUtility.HtmlEncode(dt.Rows[0]["Descriptions"].ToString()));
                sbDescriptions.Replace("<", "&lt;");
                sbDescriptions.Replace(">", "&gt;");
                string descriptions = sbDescriptions.ToString();
                //Highlights
                StringBuilder sbHighlights = new StringBuilder(HttpUtility.HtmlEncode(dt.Rows[0]["Highlights"].ToString()));
                sbHighlights.Replace("<", "&lt;");
                sbHighlights.Replace(">", "&gt;");
                string highlights = sbHighlights.ToString();
                //Details
                StringBuilder sbDetails = new StringBuilder(HttpUtility.HtmlEncode(dt.Rows[0]["Details"].ToString()));
                sbDetails.Replace("<", "&lt;");
                sbDetails.Replace(">", "&gt;");
                string details = sbDetails.ToString();


                DropDownListCompany.SelectedValue = dt.Rows[0]["CompanyId"].ToString();
                TextBoxTitle.Text = dt.Rows[0]["Title"].ToString();
                DropDownListCategory.SelectedValue = dt.Rows[0]["CategoryId"].ToString();
                TextBoxHighlights.Text             = highlights;
                TextBoxDetails.Text                = details;
                TextBoxDescriptions.Text           = descriptions;
                LabelShowDateValue.Text            = dt.Rows[0]["ShowDate"].ToString();
                LabelEndDateValue.Text             = dt.Rows[0]["EndDate"].ToString();
                DropDownListLanguage.SelectedValue = dt.Rows[0]["Language"].ToString();
                DropDownListLink1.SelectedValue    = dt.Rows[0]["Link1Type"].ToString();
                TextBoxLink1.Text = dt.Rows[0]["Link1Url"].ToString();
                DropDownListLink2.SelectedValue = dt.Rows[0]["Link2Type"].ToString();
                TextBoxLink2.Text      = dt.Rows[0]["Link2Url"].ToString();
                TextBoxLink3.Text      = dt.Rows[0]["Link3Url"].ToString();
                TextBoxLink3Image.Text = dt.Rows[0]["Link3Image"].ToString();
                //locations
                for (int i = 0; i < CheckBoxListLocations.Items.Count; i++)
                {
                    if (dt.Rows[0]["Locations"].ToString().Contains(CheckBoxListLocations.Items[i].Value + ","))
                    {
                        CheckBoxListLocations.Items[i].Selected = true;
                    }
                }

                sda.Dispose();
                sqlConn.Dispose();

                break;
            }

            case "Photos":
            {
                PanelPhotos.Visible = true;
                Page.Title          = "Salestan : تصاویر کوپن";

                DataTable     dt      = new DataTable();
                DataSet       ds      = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                SqlDataAdapter sda = new SqlDataAdapter("sp_couponsPhotos", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@CouponId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["CouponId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                LabelPhotosCompanyName.Text = dt.Rows[0]["Name"].ToString();
                LabelPhotosCompanyId.Text   = dt.Rows[0]["CompanyId"].ToString();
                LabelPhotosCouponId.Text    = Request.QueryString["CouponId"];
                LabelPhotosCouponTitle.Text = dt.Rows[0]["Title"].ToString();

                if (dt.Rows[0]["MainPhoto"].ToString() == "0")
                {
                    ImageMainPhoto.ImageUrl = "NoPhoto.jpg";
                }
                else
                {
                    ImageMainPhoto.ImageUrl = "~/Files/Photos/" + dt.Rows[0]["MainPhoto"].ToString() + ".jpg";
                }

                sda.Dispose();
                sqlConn.Dispose();

                break;
            }
            }
        }
    }
Exemplo n.º 27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Admins");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
            case "Edit":
            {
                DataTable     dt      = new DataTable();
                DataSet       ds      = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                SqlDataAdapter sda = new SqlDataAdapter("sp_adminInfo", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["UserId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                if (dt.Rows.Count == 0)         //admin doesn't exist
                {
                    LabelName.Text = "کاربری با این شناسه موجود نمی باشد!";
                }
                else         //user exists
                {
                    LabelUserId.Text = Request.QueryString["UserId"].ToString();
                    LabelName.Text   = dt.Rows[0]["FullName"].ToString();
                    DropDownListStatus.SelectedValue           = dt.Rows[0]["Status"].ToString();
                    CheckBoxListPremissions.Items[0].Selected  = Convert.ToBoolean(dt.Rows[0]["PremAdmins"].ToString());
                    CheckBoxListPremissions.Items[1].Selected  = Convert.ToBoolean(dt.Rows[0]["PremAds"].ToString());
                    CheckBoxListPremissions.Items[2].Selected  = Convert.ToBoolean(dt.Rows[0]["PremAgencies"].ToString());
                    CheckBoxListPremissions.Items[3].Selected  = Convert.ToBoolean(dt.Rows[0]["PremBlog"].ToString());
                    CheckBoxListPremissions.Items[4].Selected  = Convert.ToBoolean(dt.Rows[0]["PremCharity"].ToString());
                    CheckBoxListPremissions.Items[5].Selected  = Convert.ToBoolean(dt.Rows[0]["PremCompanies"].ToString());
                    CheckBoxListPremissions.Items[6].Selected  = Convert.ToBoolean(dt.Rows[0]["PremContent"].ToString());
                    CheckBoxListPremissions.Items[7].Selected  = Convert.ToBoolean(dt.Rows[0]["PremCoupons"].ToString());
                    CheckBoxListPremissions.Items[8].Selected  = Convert.ToBoolean(dt.Rows[0]["PremCredit"].ToString());
                    CheckBoxListPremissions.Items[9].Selected  = Convert.ToBoolean(dt.Rows[0]["PremCurrencies"].ToString());
                    CheckBoxListPremissions.Items[10].Selected = Convert.ToBoolean(dt.Rows[0]["PremLocations"].ToString());
                    CheckBoxListPremissions.Items[11].Selected = Convert.ToBoolean(dt.Rows[0]["PremNewsletter"].ToString());
                    CheckBoxListPremissions.Items[12].Selected = Convert.ToBoolean(dt.Rows[0]["PremOffers"].ToString());
                    CheckBoxListPremissions.Items[13].Selected = Convert.ToBoolean(dt.Rows[0]["PremSettings"].ToString());
                    CheckBoxListPremissions.Items[14].Selected = Convert.ToBoolean(dt.Rows[0]["PremStats"].ToString());
                    CheckBoxListPremissions.Items[15].Selected = Convert.ToBoolean(dt.Rows[0]["PremSupport"].ToString());
                    CheckBoxListPremissions.Items[16].Selected = Convert.ToBoolean(dt.Rows[0]["PremUsers"].ToString());
                    HyperLinkEditLog.NavigateUrl = "~/AdminPages/Admins.aspx?Mode=Log&UserId=" + Request.QueryString["UserId"].ToString();
                }
                sda.Dispose();
                sqlConn.Close();
                PanelEdit.Visible = true;
                Page.Title        = "Salestan : تغییر اختیارات ادمین";
                break;
            }

            case "Log":
            {
                PanelLog.Visible = true;
                Page.Title       = "Salestan : فایل لاگ ادمین";
                DataTable     dt      = new DataTable();
                DataSet       ds      = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                SqlDataAdapter sda = new SqlDataAdapter("sp_adminInfo", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["UserId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                if (dt.Rows.Count == 0)         //admin doesn't exist
                {
                    LabelLogName.Text = "کاربری با این شناسه موجود نمی باشد!";
                }
                else         //user exists
                {
                    LabelLogUserId.Text          = Request.QueryString["UserId"].ToString();
                    LabelLogName.Text            = dt.Rows[0]["FullName"].ToString();
                    HyperLinkLogEdit.NavigateUrl = "~/AdminPages/Admins.aspx?Mode=Edit&UserId=" + Request.QueryString["UserId"].ToString();
                }
                sda.Dispose();
                sqlConn.Close();
                break;
            }
            }
        }
    }
Exemplo n.º 28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Charity");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }


        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
            case "NewsAdd":
            {
                PanelNews.Visible = true;
                Page.Title        = "Salestan : اخبار خیریه";
                ImageButtonNewsSubmit.ImageUrl = "~/images/Buttons/add-off.png";

                LabelDate.Text = DateTime.Now.ToShortDateString();
                break;
            }

            case "OrganizationsAdd":
            {
                PanelOrganizations.Visible = true;
                Page.Title = "Salestan : موسسات خیریه";
                ImageButtonOrganizations.ImageUrl = "~/images/Buttons/add-off.png";
                break;
            }

            case "NewsEdit":
            {
                PanelNews.Visible = true;
                Page.Title        = "Salestan : اخبار خیریه";

                DataTable     dt      = new DataTable();
                DataSet       ds      = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                SqlDataAdapter sda = new SqlDataAdapter("sp_charityNewsInfo", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@NewsId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["NewsId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                if (dt.Rows.Count == 0)         //news doesn't exist
                {
                    //LabelName.Text = "خبری با این شناسه موجود نمی باشد!";
                }
                else         //news exists
                {
                    TimeClass tc = new TimeClass();
                    LabelDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["SubmitDate"].ToString()));

                    TextBoxNewsSubject.Text = dt.Rows[0]["Subject"].ToString();
                    TextBoxNewsBrief.Text   = dt.Rows[0]["Brief"].ToString();
                    TextBoxNewsBody.Text    = dt.Rows[0]["Body"].ToString();
                    //Location
                    DropDownListLanguage.SelectedValue = dt.Rows[0]["Language"].ToString();
                    ImageButtonNewsSubmit.ImageUrl     = "~/images/Buttons/edit-off.png";
                }
                sda.Dispose();
                sqlConn.Close();

                break;
            }

            case "OrganizationsEdit":
            {
                PanelOrganizations.Visible = true;
                Page.Title = "Salestan : موسسات خیریه";

                DataTable     dt      = new DataTable();
                DataSet       ds      = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                SqlDataAdapter sda = new SqlDataAdapter("sp_charityOrganizationsInfo", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@OrganizationId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["OrganizationId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                if (dt.Rows.Count == 0)         //news doesn't exist
                {
                    //LabelName.Text = "موسسه ای با این شناسه موجود نمی باشد!";
                }
                else         //news exists
                {
                    TextBoxName.Text    = dt.Rows[0]["Name"].ToString();
                    TextBoxAbout.Text   = dt.Rows[0]["About"].ToString();
                    TextBoxEmail.Text   = dt.Rows[0]["Email"].ToString();
                    TextBoxWebsite.Text = dt.Rows[0]["Website"].ToString();
                    TextBoxPhone.Text   = dt.Rows[0]["Phone"].ToString();
                    TextBoxFax.Text     = dt.Rows[0]["Fax"].ToString();
                    TextBoxAddress.Text = dt.Rows[0]["Address"].ToString();
                    ImageButtonOrganizations.ImageUrl = "~/images/Buttons/edit-off.png";
                    //Location
                }
                sda.Dispose();
                sqlConn.Close();

                break;
            }
            }
        }
    }