Ejemplo n.º 1
0
 /// <summary>
 /// saveOrder
 /// </summary>
 private void SaveOrder()
 {
     foreach (RepeaterItem item in rptResult.Items)
     {
         if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
         {
             HtmlInputButton  btId       = (HtmlInputButton)item.FindControl("btId");
             PNK_ExchangeRate productCat = new PNK_ExchangeRate();
             productCat.Id = DBConvert.ParseInt(btId.Value);
             productCat    = genericBLL.Load(productCat, new string[] { "Id" });
             HtmlInputText txtOrder = (HtmlInputText)item.FindControl("txtOrder");
             if (txtOrder != null)
             {
                 try
                 {
                     productCat.Ordering = DBConvert.ParseInt(txtOrder.Value);
                     if (productCat.Ordering > 0)
                     {
                         genericBLL.Update(productCat, productCat, new string[] { "Id" });
                     }
                 }
                 catch { }
             }
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// get data for insert update
        /// </summary>
        /// <param name="userObj"></param>
        /// <returns></returns>
        private PNK_ExchangeRate GetDataObjectParent(PNK_ExchangeRate productcatObj)
        {
            productcatObj.CategoryId = 1;
            productcatObj.Published  = chkPublished.Checked ? "1" : "0";
            productcatObj.UpdateDate = DateTime.Now;

            HtmlControl hddImageName = block_baseimage.FindControl("hddImageName") as HtmlControl;

            if (hddImageName != null && hddImageName.Attributes["value"] != null)
            {
                productcatObj.Image = hddImageName.Attributes["value"].ToString();
            }
            else
            {
                productcatObj.Image = "";
            }
            return(productcatObj);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Save location
        /// </summary>
        private void SaveExchangeRateCategory()
        {
            PNK_ExchangeRate     productcatObj   = new PNK_ExchangeRate();
            PNK_ExchangeRateDesc productcatObjVn = new PNK_ExchangeRateDesc();
            PNK_ExchangeRateDesc productcatObjEn = new PNK_ExchangeRateDesc();

            if (this.productcategoryId == int.MinValue)
            {
                //get data insert
                productcatObj          = this.GetDataObjectParent(productcatObj);
                productcatObj.PostDate = DateTime.Now;
                productcatObj.Ordering = genericBLL.getOrdering();
                productcatObjVn        = this.GetDataObjectChild(productcatObjVn, Constant.DB.LangId);
                productcatObjEn        = this.GetDataObjectChild(productcatObjEn, Constant.DB.LangId_En);

                List <PNK_ExchangeRateDesc> lst = new List <PNK_ExchangeRateDesc>();
                lst.Add(productcatObjVn);
                lst.Add(productcatObjEn);
                //excute
                this.productcategoryId = generic2CBLL.Insert(productcatObj, lst);
            }
            else
            {
                string[] fields = { "Id" };
                productcatObj.Id = this.productcategoryId;

                productcatObj = genericBLL.Load(productcatObj, fields);
                //string publisheddOld = productcatObj.Published;
                //get data update
                productcatObj   = this.GetDataObjectParent(productcatObj);
                productcatObjVn = this.GetDataObjectChild(productcatObjVn, Constant.DB.LangId);
                productcatObjEn = this.GetDataObjectChild(productcatObjEn, Constant.DB.LangId_En);
                List <PNK_ExchangeRateDesc> lst = new List <PNK_ExchangeRateDesc>();
                lst.Add(productcatObjVn);
                lst.Add(productcatObjEn);
                //excute
                generic2CBLL.Update(productcatObj, lst, fields);
                //neu ve Published oo thay doi thi chay ham ChangeWithTransaction de doi Published cac con va cac product
                //if (publisheddOld != productcatObj.Published)
                //    PNK_ExchangeRate.ChangeWithTransaction(DBConvert.ParseString(this.productcategoryId), productcatObj.Published);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Show location
        /// </summary>
        private void ShowProductcategory()
        {
            if (this.productcategoryId != int.MinValue)
            {
                PNK_ExchangeRate productcatObj = new PNK_ExchangeRate();
                string[]         fields        = { "Id" };
                productcatObj.Id          = this.productcategoryId;
                productcatObj             = generic2CBLL.Load(productcatObj, fields, Constant.DB.LangId);
                this.chkPublished.Checked = productcatObj.Published == "1" ? true : false;
                block_baseimage.ImageName = productcatObj.Image;

                IList <PNK_ExchangeRateDesc> lst = genericDescBLL.GetAllBy(new PNK_ExchangeRateDesc(), string.Format(" where mainid = {0}", this.productcategoryId), null);
                foreach (PNK_ExchangeRateDesc item in lst)
                {
                    switch (item.LangId)
                    {
                    case 1:
                        this.txtName.Value    = item.Title;
                        this.txtIntro.Text    = item.Brief;
                        this.editBriefVi.Text = item.Detail;

                        this.txtAmount.Value = item.Amount.ToString();
                        //this.txtFromCurrency.Value = item.FromCurrency;
                        //this.txtToCurrency.Value = item.ToCurrency;
                        break;

                    case 2:
                        this.txtNameEng.Value = item.Title;
                        this.txtIntroEn.Text  = item.Brief;
                        this.editBriefEn.Text = item.Detail;
                        //this.editDetailEn.Text = item.Detail;
                        //editDetailEn.Text = item.Intro;
                        break;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// ItemDataBound
        /// </summary>
        protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string        img, alt, publishedTask;
                HtmlTableRow  tr  = (HtmlTableRow)e.Item.FindControl("trList");
                HtmlInputText txt = null;
                if (e.Item.ItemIndex % 2 == 0)
                {
                    tr.Attributes.Add("class", "even");
                }
                else
                {
                    tr.Attributes.Add("class", "old");
                }

                try
                {
                    PNK_ExchangeRate data = (PNK_ExchangeRate)e.Item.DataItem;

                    //Role
                    Literal ltr = null;
                    ltr      = (Literal)e.Item.FindControl("ltrchk");
                    ltr.Text = string.Format(@"<INPUT class='txt' TYPE='checkbox' ID='cb{0}' NAME='cid[]' value='{1}' onclick='isChecked(this.checked);' >",
                                             e.Item.ItemIndex, data.Id);

                    //ltrNewsCategory
                    ltr = (Literal)e.Item.FindControl("ltrNewsCategory");


                    //image
                    if (data.Published == "1")
                    {
                        img           = "tick.png";
                        alt           = LocalizationUtility.GetText(ltrAdminPublish.Text);
                        publishedTask = "unpublish";
                    }
                    else
                    {
                        img           = "publish_x.png";
                        alt           = LocalizationUtility.GetText(ltrAdminPublish.Text);
                        publishedTask = "publish";
                    }

                    //Order
                    txt       = (HtmlInputText)e.Item.FindControl("txtOrder");
                    txt.Value = DBConvert.ParseString(data.Ordering);

                    //Id
                    HtmlInputButton btId = (HtmlInputButton)e.Item.FindControl("btId");
                    btId.Value = DBConvert.ParseString(data.Id);

                    //Base img
                    HtmlImage Image = (HtmlImage)e.Item.FindControl("Image");
                    Image.Src = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ExchangeRateUpload"], data.Image);
                    HtmlAnchor hypImage = (HtmlAnchor)e.Item.FindControl("hypImage");

                    //set link
                    HyperLink hdflink = new HyperLink();
                    hdflink       = (HyperLink)e.Item.FindControl("hdflink");
                    hypImage.HRef = hdflink.NavigateUrl = template_path + LinkHelper.GetAdminLink("edit_exchangerate", data.Id);
                    ImageButton imgctr = (ImageButton)e.Item.FindControl("btnPublish");
                    imgctr.ImageUrl = string.Format("/Admin/images/{0}", img);
                    imgctr.Attributes.Add("alt", alt);
                    HtmlTableCell btn = (HtmlTableCell)e.Item.FindControl("tdbtn");
                    btn.Attributes.Add("onclick", string.Format(" return listItemTask('cb{0}', '{1}')", e.Item.ItemIndex, publishedTask));

                    //Name
                    ltr            = (Literal)e.Item.FindControl("ltrName");
                    hypImage.Title = ltr.Text = data.ExchangeRateDesc.Title;
                }
                catch { }
            }
        }