コード例 #1
0
        private bool Delete()
        {
            bool   boRetValue = false;
            string stIDs      = "";

            foreach (DataListItem item in lstStuff.Items)
            {
                HtmlInputCheckBox chkList = (HtmlInputCheckBox)item.FindControl("chkList");
                if (chkList != null)
                {
                    if (chkList.Checked == true)
                    {
                        stIDs     += chkList.Value + ",";
                        boRetValue = true;
                    }
                }
            }
            if (boRetValue)
            {
                PromoBySupplierItems clsPromoBySupplierItems = new PromoBySupplierItems();
                clsPromoBySupplierItems.Delete(stIDs.Substring(0, stIDs.Length - 1));
                clsPromoBySupplierItems.CommitAndDispose();
            }

            return(boRetValue);
        }
コード例 #2
0
        private void LoadList()
        {
            Int64 PromoBySupplierID = Convert.ToInt64(lblPromoBySupplierID.Text);
            PromoBySupplierItems clsPromoBySupplierItems = new PromoBySupplierItems();

            lstStuff.DataSource = clsPromoBySupplierItems.ListAsDataTable(PromoBySupplierID).DefaultView;
            lstStuff.DataBind();
            clsPromoBySupplierItems.CommitAndDispose();
        }
コード例 #3
0
        private void lstItem_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Header)
            {
                LoadSortFieldOptions(e);
            }
            else if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView dr = (DataRowView)e.Item.DataItem;

                HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");
                chkList.Value = dr["PromoBySupplierID"].ToString();

                Label lblPromoBySupplierCode = (Label)e.Item.FindControl("lblPromoBySupplierCode");
                lblPromoBySupplierCode.Text = dr["PromoBySupplierCode"].ToString();

                Label lblPromoBySupplierName = (Label)e.Item.FindControl("lblPromoBySupplierName");
                lblPromoBySupplierName.Text = dr["PromoBySupplierName"].ToString();

                Label lblPromoLevel = (Label)e.Item.FindControl("lblPromoLevel");
                lblPromoLevel.Text = ((PromoLevel)Enum.Parse(typeof(PromoLevel), dr["PromoLevel"].ToString())).ToString("G");

                Label lblStartDate = (Label)e.Item.FindControl("lblStartDate");
                lblStartDate.Text = Convert.ToDateTime(dr["StartDate"].ToString()).ToString("MM/dd/yyyy HH:mm:ss");

                Label lblEndDate = (Label)e.Item.FindControl("lblEndDate");
                lblEndDate.Text = Convert.ToDateTime(dr["EndDate"].ToString()).ToString("MM/dd/yyyy HH:mm:ss");

                Label lblStatus = (Label)e.Item.FindControl("lblStatus");
                PromoBySupplierStatus Status = (PromoBySupplierStatus)Enum.Parse(typeof(PromoBySupplierStatus), dr["Status"].ToString());
                lblStatus.Text = Status.ToString("G");

                Int64                PromoBySupplierID       = Convert.ToInt64(dr["PromoBySupplierID"].ToString());
                DataList             lstStuff                = (DataList)e.Item.FindControl("lstStuff");
                PromoBySupplierItems clsPromoBySupplierItems = new PromoBySupplierItems();
                DataClass            clsDataClass            = new DataClass();

                lstStuff.ItemDataBound += new System.Web.UI.WebControls.DataListItemEventHandler(this.lstStuff_ItemDataBound);
                lstStuff.DataSource     = clsPromoBySupplierItems.ListAsDataTable(PromoBySupplierID).DefaultView;
                lstStuff.DataBind();
                clsPromoBySupplierItems.CommitAndDispose();

                //For anchor
                HtmlGenericControl divExpCollAsst = (HtmlGenericControl)e.Item.FindControl("divExpCollAsst");

                HtmlAnchor anchorDown = (HtmlAnchor)e.Item.FindControl("anchorDown");
                anchorDown.HRef = "javascript:ToggleDiv('" + divExpCollAsst.ClientID + "')";
            }
        }
コード例 #4
0
        protected void lstStuff_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
        {
            HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");

            switch (e.CommandName)
            {
            case "imgItemDelete":
            {
                PromoBySupplierItems clsPromoBySupplierItems = new PromoBySupplierItems();
                clsPromoBySupplierItems.Delete(chkList.Value);
                clsPromoBySupplierItems.CommitAndDispose();
                LoadList();
            }
            break;
            }
        }
コード例 #5
0
        private void SaveRecord()
        {
            PromoBySupplierItemsDetails clsDetails = new PromoBySupplierItemsDetails();

            clsDetails.PromoBySupplierID    = Convert.ToInt64(lblPromoBySupplierID.Text);
            clsDetails.ContactID            = Convert.ToInt64(cboContact.SelectedItem.Value);
            clsDetails.ProductGroupID       = Convert.ToInt64(cboProductGroup.SelectedItem.Value);
            clsDetails.ProductSubGroupID    = Convert.ToInt64(cboSubGroup.SelectedItem.Value);
            clsDetails.ProductID            = Convert.ToInt64(cboProducts.SelectedItem.Value);
            clsDetails.VariationMatrixID    = Convert.ToInt64(cboProductVariation.SelectedItem.Value);
            clsDetails.PromoBySupplierValue = Convert.ToDecimal(txtPromoBySupplierValue.Text);
            clsDetails.CouponRemarks        = txtCouponRemarks.Text;

            PromoBySupplierItems clsPromoBySupplierItems = new PromoBySupplierItems();

            clsPromoBySupplierItems.Insert(clsDetails);
            clsPromoBySupplierItems.CommitAndDispose();

            LoadList();
        }