コード例 #1
0
    protected void dlOrderList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            var lblorderid = e.Item.FindControl("lblorderid") as Label;
            if (Convert.ToInt32(lblorderid.Text) < 100000)
            {
                e.Item.Visible = false;
            }
            BindSubGrid(e.Item);
            DataTable   dt     = new DataTable();
            DataTable   dt1    = new DataTable();
            DataRowView drv    = (DataRowView)(e.Item.DataItem);
            string      Status = drv.Row["OrderStatus"].ToString();
            if (Status == "NEW")
            {
                Label lbl = (Label)e.Item.FindControl("lblBranchOrderStatus");
                lbl.ForeColor = System.Drawing.Color.Orange;
            }
            if (Status == "COLLECTING")
            {
                Label lbl = (Label)e.Item.FindControl("lblBranchOrderStatus");
                lbl.ForeColor = System.Drawing.Color.BlueViolet;
            }
            if (Status == "BLENDING")
            {
                Label lbl = (Label)e.Item.FindControl("lblBranchOrderStatus");
                lbl.ForeColor = System.Drawing.Color.DarkGreen;
            }
            if (Status == "PACKING")
            {
                Label lbl = (Label)e.Item.FindControl("lblBranchOrderStatus");
                lbl.ForeColor = System.Drawing.Color.OrangeRed;
            }
            if (Status == "DISPATCH")
            {
                Label lbl1 = (Label)e.Item.FindControl("lblBranchOrderStatus");
                lbl1.ForeColor = System.Drawing.ColorTranslator.FromHtml("#d3d3d3");
                Label lblT = (Label)e.Item.FindControl("lblType");
                lblT.ForeColor = System.Drawing.ColorTranslator.FromHtml("#d3d3d3");
                Label lblD = (Label)e.Item.FindControl("lblBranchOrderDate");
                lblD.ForeColor = System.Drawing.ColorTranslator.FromHtml("#d3d3d3");

                Label lbl   = (Label)e.Item.FindControl("lblMSg");
                Label lbtnO = (Label)e.Item.FindControl("lbtnOrderID");
                dt1 = orderObj.GetInvandDispatchDetails(lbtnO.Text);
                if (dt1.Rows.Count > 0)
                {
                    lbl.Visible   = true;
                    lbl.Text      = " Inv :" + dt1.Rows[0]["BOinv"].ToString() + " / " + dt1.Rows[0]["DispatchDate"].ToString();
                    lbl.ForeColor = System.Drawing.Color.Red;
                }
                (e.Item.FindControl("gvOrder") as GridView).Visible = false;
            }
            if (Status == "CANCEL")
            {
                Label lbl1 = (Label)e.Item.FindControl("lblBranchOrderStatus");
                lbl1.ForeColor = System.Drawing.ColorTranslator.FromHtml("#d3d3d3");
                Label lblT = (Label)e.Item.FindControl("lblType");
                lblT.ForeColor = System.Drawing.ColorTranslator.FromHtml("#d3d3d3");
                Label lblD = (Label)e.Item.FindControl("lblBranchOrderDate");
                lblD.ForeColor = System.Drawing.ColorTranslator.FromHtml("#d3d3d3");
            }
            if (Status == "SAMPLE DISPATCH")
            {
                Label lbl1 = (Label)e.Item.FindControl("lblBranchOrderStatus");
                lbl1.ForeColor = System.Drawing.Color.Gray;
                Label lblT = (Label)e.Item.FindControl("lblType");
                lblT.ForeColor = System.Drawing.Color.Gray;
                Label lblD = (Label)e.Item.FindControl("lblBranchOrderDate");
                lblD.ForeColor = System.Drawing.Color.Gray;
                Label  lbl        = (Label)e.Item.FindControl("lblMSg");
                string text       = string.Empty;
                Label  lbtnO      = (Label)e.Item.FindControl("lbtnOrderID");
                Label  lblcourier = (Label)e.Item.FindControl("lblCourier");
                dt1 = orderObj.GetAdminCommentDetails(lbtnO.Text);
                string Msg1 = dt1.Rows[0]["Comments"].ToString();
                if (dt1.Rows[0]["OrderType"].ToString() == "LotSample")
                {
                    if (Msg1.Contains("#"))
                    {
                        lbl.Visible = false;
                    }
                    else
                    {
                        dt = orderObj.GetssampleQtyandMsgAdmin(lbtnO.Text);
                        if (dt.Rows.Count > 0)
                        {
                            lbl.Visible = true;
                            foreach (DataRow item in dt.Rows)
                            {
                                lbl.Text = lbl.Text + item["SampQty"].ToString() + "  " + item["SampDetails"].ToString() + "<br/>";
                            }
                            lbl.ForeColor = System.Drawing.Color.Red;
                        }
                    }
                }
            }
        }
    }