コード例 #1
0
ファイル: NhomXe.aspx.cs プロジェクト: sonnnqbh/demo_proj
    protected void GvgroupUser_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int ID = Convert.ToInt32(e.CommandArgument.ToString());

        if (e.CommandName.Equals("editRecord"))
        {
            hfPopupUpdate.Value = ID.ToString();
            List <Nhomxe> lskh = obj.GetNhomXe(ID);
            txttennhom.Text = lskh[0].TenNhom.Trim();
            //DrpCauHinh.SelectedIndex = DrpCauHinh.Items.IndexOf(DrpCauHinh.Items.FindByValue(lskh[0].IDCauHinh.ToString()));
            DrpDoanhNghiep.SelectedIndex = DrpDoanhNghiep.Items.IndexOf(DrpDoanhNghiep.Items.FindByValue(lskh[0].IDDoanhNghiep.ToString()));
            CheckBox1.Checked            = bool.Parse(lskh[0].TrangThai.ToString());
            txtghichu.Text = lskh[0].Ghichu.Trim();
            //ShowData(index);
        }
        else if (e.CommandName.Equals("deleteRecord"))
        {
            hfPopupDelete.Value = ID.ToString();

            lbxacnhanxoa.Text = "Đồng ý xóa bản ghi?";

            mpeDelete.Show();
        }
        else if (e.CommandName.Equals("detailRecord"))
        {
            hfPopUpDetail.Value = ID.ToString();
            List <KhachHang> lskh = obj.GetKhachHang(int.Parse(AppSessionInfo.CurrentUser.DoanhNghiepID.ToString()), true, ID);
            GvKhachHang.DataSource = lskh;
            GvKhachHang.DataBind();
            mpeDetail.Show();
        }
    }
コード例 #2
0
ファイル: KhacHangDN.aspx.cs プロジェクト: sonnnqbh/demo_proj
    private void LoadGrid(int index)
    {
        try
        {
            List <KhachHang> lsnhantin = null;
            DataSet          dsKH      = new DataSet();
            if (AppSessionInfo.CurrentUser.DoanhNghiepID != null)
            {
                if (!AppSessionInfo.CurrentUser.DoanhNghiepID.ToString().Equals(""))
                {
                    int doanhnghiepid = int.Parse(AppSessionInfo.CurrentUser.DoanhNghiepID.ToString());
                    if (doanhnghiepid != 0)
                    {
                        dsKH = obj.GetDsKhachHang(doanhnghiepid, true);
                    }
                    else
                    {
                        dsKH = obj.GetDsKhachHang(true);
                    }
                }
            }
            else
            {
                lsnhantin = obj.GetKhachHang(true);
            }
            if (lsnhantin != null)
            {
                if (lsnhantin.Count > 0)
                {
                    //lbnhomid0.Text = lsnhantin.Count.ToString();
                }
                //else
                //    lbnhomid0.Text = "0";
            }
            //else
            //    lbnhomid0.Text = "0";

            GvgroupUser.DataSource = dsKH;
            GvgroupUser.PageIndex  = index;
            GvgroupUser.DataBind();
        }
        catch (Exception ex)
        {
            return;
        }
    }
コード例 #3
0
ファイル: NhanTin.aspx.cs プロジェクト: sonnnqbh/demo_proj
    public static string XuatNhanTinQC(string idNodes)
    {
        //khoi tao header
        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.ClearContent();
        HttpContext.Current.Response.ClearHeaders();
        HttpContext.Current.Response.Buffer      = true;
        HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
        HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=DachSachNT.xls");

        HttpContext.Current.Response.Charset = "UTF-8";
        // HttpContext.Current.Response.ContentEncoding = System.Text.ASCIIEncoding.Unicode;
        HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
        //sets font
        HttpContext.Current.Response.Write("<font style='font-size:10.0pt; font-family:Arial;'>");
        HttpContext.Current.Response.Write("<BR><BR><BR>");
        //sets the table border, cell spacing, border color, font of the text, background, foreground, font height
        HttpContext.Current.Response.Write("<Table border='1' bgColor='#ffffff' " +
                                           "borderColor='#000000' cellSpacing='0' cellPadding='0' " +
                                           "style='font-size:10.0pt; font-family:Arial; background:white;'> <TR>");
        //am getting my grid's column headers
        int columnscount = 2;// GridView_Result.Columns.Count;

        //write in new column
        HttpContext.Current.Response.Write("<Td>");
        //Get column headers  and make it as bold in excel columns
        HttpContext.Current.Response.Write("<B>");
        HttpContext.Current.Response.Write("So dien thoai");
        HttpContext.Current.Response.Write("</B>");
        HttpContext.Current.Response.Write("</Td>");
        //HttpContext.Current.Response.Write("<Td>");
        ////Get column headers  and make it as bold in excel columns
        //HttpContext.Current.Response.Write("<B>");
        //HttpContext.Current.Response.Write("ten");
        //HttpContext.Current.Response.Write("</B>");
        //HttpContext.Current.Response.Write("</Td>");
        HttpContext.Current.Response.Write("</TR>");

        string[] nodes = idNodes.Split(',');
        for (int i = 0; i < nodes.Length; i++)
        {
            int index = nodes[i].IndexOf("_KH");
            if (index != -1)
            {
                string           node = nodes[i].Remove(index, 3);
                List <KhachHang> lskh = objbn.GetKhachHang(int.Parse(node));
                string           sdt  = lskh[0].DienThoai;
                sdt = "84" + sdt.Remove(0, 1);
                HttpContext.Current.Response.Write("<TR>");

                HttpContext.Current.Response.Write("<Td>");
                HttpContext.Current.Response.Write(sdt.ToString().Trim());
                HttpContext.Current.Response.Write("</Td>");

                //HttpContext.Current.Response.Write("<Td>");
                //HttpContext.Current.Response.Write(lskh[0].TenKhachHang);
                //HttpContext.Current.Response.Write("</Td>");
                //HttpContext.Current.Response.Write("</TR>");
            }
        }
        HttpContext.Current.Response.Write("</Table>");
        HttpContext.Current.Response.Write("</font>");
        HttpContext.Current.Response.Flush();
        HttpContext.Current.Response.End();

        return("Export thành công");
    }