示例#1
0
    protected void RpAdv_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        string strCommand = e.CommandName;
        int nID = ConvertData.ConvertToInt(e.CommandArgument);
        Adv objAdv = new Adv();
        switch (strCommand)
        {
            case "Delete":
                objAdv.LoadById(nID);
                Support.DeleteFile("adv", objAdv.Data.AdvFile);
                int nDelete = objAdv.DeleteById(nID);
                BindDataToRpAdv(1);
                break;

            case "Edit":
                string sEdit = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_ADV_ADD + "&" + Constants.ACTION + "=" + Constants.ACTION_EDIT + "&" + Constants.ACTION_ID + "=" + nID;
                Response.Redirect(sEdit);
                break;

            case "Active":
                int nActive = objAdv.UpdateStatus(nID, EnumeType.INACTIVE);

                BindDataToRpAdv(1);
                break;

            case "Inactive":
                int nInactive = objAdv.UpdateStatus(nID, EnumeType.ACTIVE);

                BindDataToRpAdv(1);
                break;
        }
    }
示例#2
0
 private void BindData()
 {
     int nPageCount = 0;
     Adv obj = new Adv();
     DataTable dtb = new DataTable();
     dtb = obj.Search(0, "", 1, 1, 1, 1, 20, ref nPageCount);
     rptAgent.DataSource = dtb;
     rptAgent.DataBind();
 }
示例#3
0
    protected void btnSave_Click1(object sender, EventArgs e)
    {
        string sContent = ConvertData.ConvertToString(txtcontent.Text);
        if (sContent != "")
        {
            int nActionResult = 0;

            Adv objAdv = new Adv();
            objAdv.Data = this.SetData();
            string sAction = GetQuerryString(Constants.ACTION);
            if (sAction == Constants.ACTION_EDIT)
            {
                //Is Edit
                int nItemID = ConvertData.ConvertToInt(Request.QueryString[Constants.ACTION_ID]);
                nActionResult = objAdv.Update(nItemID);
                if (nActionResult > 0)
                {

                    if (objAdv.Data.AdvFile.ToString() != "")
                    {
                        imgImage.ImageUrl = Constants.ROOT + Constants.IMAGE_ADV_DEFAULT_UPLOAD + objAdv.Data.AdvFile.ToString();
                        lbimg.Text = ConvertData.ConvertToString(objAdv.Data.AdvFile);
                        urlImg.NavigateUrl = Constants.ROOT + Constants.IMAGE_ADV_DEFAULT_UPLOAD + objAdv.Data.AdvFile;
                    }
                    MessageBoxss.Show(MessagesAlert.UPDATE_SUCCESSFUL);

                }
                else
                    MessageBoxss.Show(MessagesAlert.UPDATE_UNSUCCESSFUL);

            }
            else
            {
                // Is Insert
                nActionResult = objAdv.Insert();

                if (nActionResult > 0)
                {
                   string sURL= Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_ADV + "&" + Constants.MESS_ID + "=" + Constants.MESSAGE_INSERT;
                    Response.Redirect(sURL);
                }

            }
        }
        else
        {
            txtcontent.Focus();
            MessageBoxss.Show(MessagesValidate.NEWS_CONTENT_EMPTY);
        }
    }
    private void LoadData()
    {
        try
        {

            int nItemID = ConvertData.ConvertToInt(Request.QueryString["aid"]);

            Adv objNews = new Adv();
            objNews.LoadById(nItemID);

            lblTitle.Text = objNews.Data.PartnerName;

            ltrContent.Text = objNews.Data.Description;

        }
        catch
        {
            Response.Redirect("~/Default.aspx");
        }
    }
示例#5
0
    private eAdv SetData()
    {
        eAdv eAdvEntity = this.AdvEntity ();
        Adv objAdv = new Adv();
        if (iptImage.Value != "")
        {
            Support.DeleteFile("adv", eAdvEntity.AdvFile);
            objAdv.Data.AdvFile = Support.UploadFile(iptImage, "adv");
        }
        else
        {
            if (eAdvEntity.AdvFile != null)
            {
                objAdv.Data.AdvFile = eAdvEntity.AdvFile;
            }
            else
            {
                objAdv.Data.AdvFile = "";
                MessageBoxss.Show(MessagesAlert.ADV_FILE_EMPTY);
            }
        }
        objAdv.Data.PartnerName = ConvertData.ConvertToString(txtClient.Text  );
        objAdv.Data.Description  = ConvertData.ConvertToString(txtcontent.Text);
        objAdv.Data.AdvTypeID = 1;
        objAdv.Data.AdvPositionID = 1;

        if (chkActive.Checked) objAdv.Data.Status = 1;
        else objAdv.Data.Status = 0;

        if (chkDisplayOrder.Checked) { objAdv.Data.Priority = ConvertData.ConvertToInt(txtPriority.Text); }
        else { objAdv.Data.Priority = 0; }

        objAdv.Data.Priority = ConvertData.ConvertToInt(txtPriority.Text);

        objAdv.Data.AdvURL  = "#";
        objAdv.Data.CreatedDate  = ConvertData.ConvertDatetimeToInt(DateTime.Today );
        objAdv.Data.ExpiredDate = 20990101 ;

        return objAdv.Data;
    }
示例#6
0
    private void GetData(int ItemID)
    {
        // Get data to view on UI Controls
        int nStatus = 0;
        Adv objAdv = new Adv();
        objAdv.LoadById(ItemID);

        txtClient.Text = objAdv.Data.PartnerName;

        txtcontent.Text=(ConvertData.ConvertToString(objAdv.Data.Description ));
        //txtLink.Text = ConvertData.ConvertToString(objAdv.Data.AdvURL);
        nStatus = ConvertData.ConvertToInt(objAdv.Data.Status);
        //ddlPosition.SelectedValue = ConvertData.ConvertToString(objAdv.Data.AdvPositionID);
        //ddlAdvType.SelectedValue = ConvertData.ConvertToString(objAdv.Data.AdvTypeID);

        if (nStatus > 0)
            chkActive.Checked = true;
        else
            chkActive.Checked = false;

        int nDisplayOrder = 0;
        nDisplayOrder = ConvertData.ConvertToInt(objAdv.Data.Priority);
        if (nDisplayOrder > 0)
            chkDisplayOrder.Checked = true;
        else
            chkDisplayOrder.Checked = false;
        int nPriority = ConvertData.ConvertToInt(objAdv.Data.Priority);

        string sImage = ConvertData.ConvertToString(objAdv.Data.AdvFile );
        lbimg.Text = ConvertData.ConvertToString(objAdv.Data.AdvFile);
        urlImg.NavigateUrl = Constants.ROOT + Constants.IMAGE_ADV_DEFAULT_UPLOAD + objAdv.Data.AdvFile;
        if (sImage != "")
            imgImage.ImageUrl = Constants.ROOT + Constants.IMAGE_ADV_DEFAULT_UPLOAD  + objAdv.Data.AdvFile ;
        else imgImage.ImageUrl = Constants.IMAGE_NO_IMAGE;
    }
示例#7
0
    private void BindDataPriorityText()
    {
        DataTable dtbNews = new DataTable();
        Adv objNews = new Adv();

        dtbNews = objNews.SearchAll();
        int nCount = dtbNews.Rows.Count;
        string sAction = GetQuerryString(Constants.ACTION);//Lay Thong tin Edit, Insert
        int nRealValue = 0;
        if (sAction == Constants.ACTION_EDIT)//Kiem tra dieu kien
        {
            nRealValue = nCount;

            eAdv eProductsEntity = this.AdvEntity();
            string sPriority = ConvertData.ConvertToString(eProductsEntity.Priority);

            txtPriority.Text = sPriority;
        }
        else
        {
            nRealValue = nCount + 1;

            txtPriority.Text = ConvertData.ConvertToString(nRealValue);
        }
    }
示例#8
0
 private eAdv AdvEntity()
 {
     eAdv entityAdv = new eAdv();
     int nItemID = ConvertData.ConvertToInt(Request.QueryString[Constants.ACTION_ID]);
     string sQueery = ConvertData.ConvertToString(Request.QueryString[Constants.ACTION]);
     if (nItemID > 0 && sQueery == Constants.ACTION_EDIT)
     {
         Adv obj = new Adv();
         obj.LoadById(nItemID);
         entityAdv = obj.Data;
     }
     return entityAdv;
 }
示例#9
0
 private void BindDataToRpAdv(int CurrentPageIndex)
 {
     int nPageCount = 0;
     int nPosition = ConvertData.ConvertToInt(ddlPosition.SelectedValue);
     int nStatus = -1;
     int nItemView = 0;
     int nType = 0;
     string sTitle = "";
     Adv objAdv = new Adv();
     DataTable dtbAdv = new DataTable();
     dtbAdv = objAdv.Search(nItemView, sTitle, nPosition, nType, nStatus, CurrentPageIndex, Constants.PAGESIZE_MAX, ref nPageCount);
     //lblTotalRecord.Text = "Có"[nDefLang - 1] + nPageCount + "Bản ghi được tìm thấy"[nDefLang - 1];
     RpAdv.DataSource = dtbAdv;
     RpAdv.DataBind();
 }