Exemplo n.º 1
0
    private string uploadFile()
    {
        string res = "";

        try
        {
            HttpFileCollection httpFileCollection = Request.Files;
            HttpPostedFile     file = null;
            if (httpFileCollection.Count <= 0)
            {
                res = "文件上传未成功";
            }
            else
            {
                file = httpFileCollection[0];

                //Excel读取
                DataTable dt    = ExcelHelperV2_0.Import(file.InputStream);
                UserInfo  user  = (UserInfo)Session["user"];
                DataTable newDt = EnterStockInfoManage.InsertInfos(dt, user.companyId.ToString());

                res = JsonHelper.DataTableToJsonForEasyUiDataGridLoadDataMethod(newDt.Rows.Count, newDt);
            }
        }
        catch (Exception ex)
        {
            res = ex.ToString();
        }

        return(res);
    }
Exemplo n.º 2
0
    private string getData(string start, string end, string company)
    {
        string   json      = "F";
        DateTime dateStart = Convert.ToDateTime(start);
        DateTime dateEnd   = Convert.ToDateTime(end);
        DataSet  ds        = EnterStockInfoManage.GetInfos(dateStart, dateEnd, company);

        if (ds != null)
        {
            json = JsonHelper.DataTableToJsonForEasyUiDataGridLoadDataMethod(ds.Tables[0].Rows.Count, ds.Tables[0]);
        }
        return(json);
    }