示例#1
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            int     pagid        = 0;
            decimal quantity     = 0;
            int     changeqty    = 0;
            int     changeprice  = 0;
            int     addextradesc = 0;

            CommonResource.HomeConfigurationItem item = ((Button)e.OriginalSource).DataContext as CommonResource.HomeConfigurationItem;

            pagid    = item.PagID;
            quantity = item.Quantity;

            if (item.ChangeQuantity)
            {
                changeqty = 1;
            }
            else
            {
                changeqty = 0;
            }
            if (item.ChangePrice)
            {
                changeprice = 1;
            }
            else
            {
                changeprice = 0;
            }

            if (item.AddExtraDesc)
            {
                addextradesc = 1;
            }
            else
            {
                addextradesc = 0;
            }

            cr.UpdatePagForHome(homeid, pagid, quantity, changeqty, changeprice, addextradesc, usercode);
        }
示例#2
0
        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            List <CommonResource.HomeConfigurationItem> HomeExistingPAG = new List <CommonResource.HomeConfigurationItem>();

            if (e.Result != null)
            {
                DataSet ds = (DataSet)e.Result;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    CommonResource.HomeConfigurationItem s = new CommonResource.HomeConfigurationItem();
                    s.HomeID             = homeid;
                    s.PagID              = int.Parse(dr["productareagroupid"].ToString());
                    s.AreaID             = int.Parse(dr["areaid"].ToString());
                    s.AreaName           = dr["areaname"].ToString();
                    s.GroupID            = int.Parse(dr["groupid"].ToString());
                    s.GroupName          = dr["groupname"].ToString();
                    s.ProductID          = dr["productid"].ToString();
                    s.ProductName        = dr["productname"].ToString();
                    s.ProductDescription = dr["productdescription"].ToString();
                    s.Quantity           = decimal.Parse(dr["quantity"].ToString());
                    s.UnitPrice          = decimal.Parse(dr["unitprice"].ToString());
                    if (dr["ChangePrice"].ToString().ToUpper() == "TRUE" || dr["ChangePrice"].ToString() == "1")
                    {
                        s.ChangePrice = true;
                    }
                    else
                    {
                        s.ChangePrice = false;
                    }
                    if (dr["ChangeQty"].ToString().ToUpper() == "TRUE" || dr["ChangeQty"].ToString() == "1")
                    {
                        s.ChangeQuantity = true;
                    }
                    else
                    {
                        s.ChangeQuantity = false;
                    }
                    if (dr["HomeDisplayID"].ToString() == "0")
                    {
                        s.IsDisplayHomeItem = false;
                    }
                    else
                    {
                        s.IsDisplayHomeItem = true;
                    }
                    if (dr["addextradesc"].ToString().ToUpper() == "TRUE" || dr["addextradesc"].ToString() == "1")
                    {
                        s.AddExtraDesc = true;
                    }
                    else
                    {
                        s.AddExtraDesc = false;
                    }
                    HomeExistingPAG.Add(s);
                }

                dataGrid2.DataContext = HomeExistingPAG;
                txttotal.Text         = HomeExistingPAG.Count.ToString();
                imagebox.Visibility   = Visibility.Collapsed;
            }
        }