Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int    pgNow;
        int    pgSize = 5;
        string BirthDateS;
        string BirthDateE;
        int    SearchKind;
        int    OrgID = 0;

        BirthDateS = Request.Form["BirthDateS"] ?? "";
        BirthDateE = Request.Form["BirthDateE"] ?? "";
        if (BirthDateS != "")
        {
            BirthDateS = (Convert.ToInt32(BirthDateS.Substring(0, 3)) + 1911).ToString() + "/" + BirthDateS.Substring(3, 2) + "/" + BirthDateS.Substring(5, 2);
        }
        if (BirthDateE != "")
        {
            BirthDateE = (Convert.ToInt32(BirthDateE.Substring(0, 3)) + 1911).ToString() + "/" + BirthDateE.Substring(3, 2) + "/" + BirthDateE.Substring(5, 2);
        }



        int.TryParse(Request.Form["pgNow"], out pgNow);
        int.TryParse(Request.Form["SearchKind"], out SearchKind);
        int.TryParse(Request.Form["OrgID"], out OrgID);



        DataTableCollection dtc = (DataTableCollection)DBUtil.DBOp("ConnDB"
                                                                   , "exec dbo.usp_CaseUser_xGetMergeUserList {0},{1},{2},{3},{4},{5} "
                                                                   , new string[] { pgNow.ToString()
                                                                                    , pgSize.ToString()
                                                                                    , BirthDateS
                                                                                    , BirthDateE
                                                                                    , OrgID.ToString()
                                                                                    , SearchKind.ToString() }, NSDBUtil.CmdOpType.ExecuteReaderReturnDataTableCollection);



        List <MergeCheckListVM> list = new List <MergeCheckListVM>();
        PageVM rtn = new PageVM();

        EntityS.FillModel(list, dtc[0]);
        EntityS.FillModel(rtn, dtc[1]);
        rtn.message = list;

        Response.ContentType = "application/json; charset=utf-8";
        Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rtn));
        Response.End();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //base.AllowHttpMethod("POST");

        string BirthDateS;
        string BirthDateE;
        int    SearchKind = 1;

        BirthDateS = Request.Form["BirthDateS"] ?? "";
        BirthDateE = Request.Form["BirthDateE"] ?? "";
        if (BirthDateS != "")
        {
            BirthDateS = (Convert.ToInt32(BirthDateS.Substring(0, 3)) + 1911).ToString() + "/" + BirthDateS.Substring(3, 2) + "/" + BirthDateS.Substring(5, 2);
        }
        if (BirthDateE != "")
        {
            BirthDateE = (Convert.ToInt32(BirthDateE.Substring(0, 3)) + 1911).ToString() + "/" + BirthDateE.Substring(3, 2) + "/" + BirthDateE.Substring(5, 2);
        }

        int.TryParse(Request["SearchKind"], out SearchKind);



        SqlCommand cmd = new SqlCommand("dbo.usp_CaseUser_xGetMergeUserListToExport");

        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@BirthDateS", BirthDateS);
        cmd.Parameters.AddWithValue("@BirthDateE", BirthDateE);
        cmd.Parameters.AddWithValue("@Area", 0);
        cmd.Parameters.AddWithValue("@SearchKind", SearchKind);
        DataTable dt = DB.GetDataTable(cmd, "ConnDB");


        DataTableToCSV.DownloadCSV(dt, "MyCsv.csv");
        // DataTableToCSV.ExportToCSVFile(dt);
        //Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(dt));
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //base.AllowHttpMethod("POST");

        int    pgNow;
        int    pgSize;
        string BirthDateS;
        string BirthDateE;
        int    SearchKind;

        BirthDateS = Request.Form["BirthDateS"] ?? "";
        BirthDateE = Request.Form["BirthDateE"] ?? "";
        if (BirthDateS != "")
        {
            BirthDateS = (Convert.ToInt32(BirthDateS.Substring(0, 3)) + 1911).ToString() + "/" + BirthDateS.Substring(3, 2) + "/" + BirthDateS.Substring(5, 2);
        }
        if (BirthDateE != "")
        {
            BirthDateE = (Convert.ToInt32(BirthDateE.Substring(0, 3)) + 1911).ToString() + "/" + BirthDateE.Substring(3, 2) + "/" + BirthDateE.Substring(5, 2);
        }



        int.TryParse(Request.Form["pgNow"], out pgNow);
        int.TryParse(Request.Form["pgSize"], out pgSize);
        int.TryParse(Request.Form["SearchKind"], out SearchKind);



        DataSet ds = new DataSet();

        using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
        {
            using (SqlCommand cmd = new SqlCommand("dbo.usp_CaseUser_xGetMergeUserList", sc))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@pgNow", pgNow == 0 ? 1 : pgNow);
                cmd.Parameters.AddWithValue("@pgSize", pgSize == 0 ? 10 : pgSize);
                cmd.Parameters.AddWithValue("@BirthDateS", BirthDateS);
                cmd.Parameters.AddWithValue("@BirthDateE", BirthDateE);
                cmd.Parameters.AddWithValue("@Area", 0);
                cmd.Parameters.AddWithValue("@SearchKind", SearchKind);

                using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                {
                    sc.Open();
                    da.Fill(ds);
                }
            }
        }

        List <UserProfileListVM> list = new List <UserProfileListVM>();
        PageVM rtn = new PageVM();

        EntityS.FillModel(list, ds.Tables[0]);
        EntityS.FillModel(rtn, ds.Tables[1]);
        rtn.message = list;

        Response.ContentType = "application/json; charset=utf-8";
        Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rtn));
        Response.End();
    }