protected void LoadStringVatTuToControls(string sVatTu, PlaceHolder dsVatTu)
 {
     if (sVatTu != "")
     {
         string[] aVatTu = sVatTu.Substring(1, sVatTu.Length - 2).Split(new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries);
         foreach (string VatTuGroup in aVatTu)
         {
             string[] aVatTuGroup = VatTuGroup.Split(new char[] { '/' });
             Control  txtVatTu    = dsVatTu.FindControl(aVatTuGroup[0]);
             if (txtVatTu != null)
             {
                 ((TextBox)txtVatTu).Text = aVatTuGroup[1];
             }
         }
     }
 }
Exemplo n.º 2
0
        protected void grvDanhSach_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataRow r             = ((DataRowView)e.Row.DataItem).Row;
                Button  btnXemThayDoi = (Button)(e.Row.FindControl("btnXemThayDoi"));
                btnXemThayDoi.CommandArgument = r["IDGMCCT"].ToString();
                btnXemThayDoi.CommandName     = ddlRowStatus.SelectedValue;
                Label lblSTT = (Label)(e.Row.FindControl("lblSTT"));
                int   stt    = e.Row.RowIndex + 1;
                lblSTT.Text = stt.ToString();
                CheckBox chkDau = (CheckBox)(e.Row.FindControl("chkDau"));
                chkDau.Checked = Convert.ToBoolean(r["Dau"]);
                HyperLink lnkCaSau            = (HyperLink)(e.Row.FindControl("lnkCaSau"));
                Label     lblDa_TrongLuong    = (Label)(e.Row.FindControl("lblDa_TrongLuong"));
                Label     lblTrongLuongHoi    = (Label)(e.Row.FindControl("lblTrongLuongHoi"));
                Label     lblTrongLuongMocHam = (Label)(e.Row.FindControl("lblTrongLuongMocHam"));
                lnkCaSau.Attributes["onclick"] = "openwindow('" + DotNetNuke.Common.Globals.NavigateURL(int.Parse(hdGietMoCaChonCaPage.Value), "", "gmcct/" + r["IDGMCCT"].ToString(), "gietmoca/" + lblGMC.Text) + "','',800,600);";
                lnkCaSau.Attributes["style"]   = "cursor:pointer;";
                tongHoi    += decimal.Parse(r["TrongLuongHoi"].ToString());
                tongMocHam += decimal.Parse(r["TrongLuongMocHam"].ToString());
                CheckBox chkDiTat = (CheckBox)(e.Row.FindControl("chkDiTat"));
                chkDiTat.Checked = false;
                int Status = Convert.ToInt32(r["Status"]);
                if (Status == -4)
                {
                    chkDiTat.Checked = true;
                }

                if (!afterKhoaSo)
                {
                    lnkCaSau.Attributes["onclick"] = "";
                }
                else
                {
                    if (!isAdmin)
                    {
                        lnkCaSau.Attributes["onclick"] = "";
                    }
                }
                //lblDa_TrongLuong.Text = Convert.ToDecimal(r["Da_TrongLuong"]).ToString("0.#####");
                //lblTrongLuongHoi.Text = Convert.ToDecimal(r["TrongLuongHoi"]).ToString("0.#####");
                //lblTrongLuongMocHam.Text = Convert.ToDecimal(r["TrongLuongMocHam"]).ToString("0.#####");
                lblDa_TrongLuong.Text             = Config.ToXVal2(r["Da_TrongLuong"], 0);
                lblTrongLuongHoi.Text             = Config.ToXVal2(r["TrongLuongHoi"], 1);
                lblTrongLuongMocHam.Text          = Config.ToXVal2(r["TrongLuongMocHam"], 1);
                btnXemThayDoi.Attributes["style"] = "background-image:url('" + ModulePath + "images/log.gif');border:none;background-color:transparent;background-repeat:no-repeat;cursor:pointer;vertical-align:middle;width:16px;";
                e.Row.Attributes["id"]            = "row_" + btnXemThayDoi.ClientID;
                e.Row.Attributes["onclick"]       = "setSelectedRow(this,'" + btnXemThayDoi.ClientID + "')";

                Label  lblVatTu = (Label)(e.Row.FindControl("lblVatTu"));
                string sVatTu   = r["VatTu"].ToString();
                string sRes     = "";
                if (sVatTu != "")
                {
                    string[] aVatTu = sVatTu.Substring(1, sVatTu.Length - 2).Split(new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string VatTuGroup in aVatTu)
                    {
                        string[] aVatTuGroup = VatTuGroup.Split(new char[] { '/' });
                        sRes += dicVatTu[aVatTuGroup[0]] + ": " + aVatTuGroup[1] + ", ";
                    }
                }
                if (sRes != "")
                {
                    sRes = sRes.Substring(0, sRes.Length - 2);
                }
                lblVatTu.Text = sRes;
            }
        }