Exemplo n.º 1
0
        public string order(Int32 UserID)
        {
            DataTable dt   = a.order(UserID);
            string    json = DataTableConvertJson.DataTableToJson("order", dt);

            return(json);
        }
Exemplo n.º 2
0
        public string browse(string scenicspotID)
        {
            DataTable dt   = td.browse(scenicspotID);
            string    json = DataTableConvertJson.DataTableToJson("browse", dt);

            return(json);
        }
Exemplo n.º 3
0
        //调用
        public string Information(Int32 UserID)
        {
            DataTable dt   = a.Information(UserID);
            string    json = DataTableConvertJson.DataTableToJson("Information", dt);

            return(json);
        }
        public string GetUser(int id)
        {
            string    sqlStr = @"select operatorName,[role],lastLoginDate from dbo.tOperator where active='1' and enterpriseid=" + id;
            DataTable dt     = SqlHelper.GetDataTable(sqlStr, null);

            return(DataTableConvertJson.DataTableToJson1(dt));
        }
Exemplo n.º 5
0
        public string  BuyTickets(string AttractionsID)
        {
            DataTable dt   = Ticket.BuyTicket();
            string    json = DataTableConvertJson.DataTableToJson("buyticket", dt);

            return(json);
        }
Exemplo n.º 6
0
        public string browse(string GetimgID)
        {
            DataTable dt   = td.browse(GetimgID);
            string    json = DataTableConvertJson.DataTableToJson("browse", dt);

            return(json);
        }
        public string BtnSearch(string carCode)
        {
            string    sqlStr = @"select (select enterprise from tenterprise where id=enterpriseID) as 'enterprise', carcode as 'carCode', jobid as 'jobId', cast(datepart(yy, startDate)as nvarchar)+'年'+cast(datepart(mm,startDate) as nvarchar)+ '月'+cast(datepart(dd,startDate) as nvarchar)+'日' as 'startDate', cast(datepart(yy, endDate)as nvarchar)+'年'+cast(datepart(mm,endDate) as nvarchar)+ '月'+cast(datepart(dd,endDate) as nvarchar)+'日' as 'endDate', startzone as 'startZone', endzone as 'endZone', jobdate as 'jobDate', printNumber as 'printNumber',driver1Name as 'driver1Name',driver2Name as 'driver2Name' from tjobs_travel where carcode like '%" + carCode + "%' order by jobdate desc";
            DataTable dt     = SqlHelper.GetDataTable(sqlStr, null);

            return(DataTableConvertJson.DataTableToJson1(dt));
        }
Exemplo n.º 8
0
        public string Index()
        {
            DataTable dt   = ID.Index();
            string    json = DataTableConvertJson.DataTableToJson("index", dt);

            return(json);
        }
Exemplo n.º 9
0
        //
        // GET: /DB/

        /// <summary>
        /// 表列表
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            DataTable dt   = DBManage.SqlDbHelper.ExecuteDataTable("select * from db_talbe_list order by tableName");
            string    Json = DataTableConvertJson.DataTable2Json(dt);

            ViewBag.PageData = Json;
            return(View());
        }
        public string GetIndexById(int id)
        {
            string sqlStr = @"select top 100 (select enterprise from tenterprise where id=enterpriseID) as 'enterprise', carcode as 'carCode', jobid as 'jobId', cast(datepart(yy, startDate)as nvarchar)+'年'+cast(datepart(mm,startDate) as nvarchar)+ '月'+cast(datepart(dd,startDate) as nvarchar)+'日' as 'startDate', cast(datepart(yy, endDate)as nvarchar)+'年'+cast(datepart(mm,endDate) as nvarchar)+ '月'+cast(datepart(dd,endDate) as nvarchar)+'日' as 'endDate', startzone as 'startZone', endzone as 'endZone', jobdate as 'jobDate', case when printNumber is NULL then '(未打印)' else printNumber end as 'printNumber',driver1Name as 'driver1Name',driver2Name as 'driver2Name' from tjobs_travel where enterpriseID=" + id + "order by jobdate desc";
            //string sqlStr = @"select (select enterprise from tenterprise where id=enterpriseID) as 'enterprise', carcode as 'carCode', jobid as 'jobId', cast(datepart(yy, startDate)as nvarchar)+'年'+cast(datepart(mm,startDate) as nvarchar)+ '月'+cast(datepart(dd,startDate) as nvarchar)+'日' as 'startDate', cast(datepart(yy, endDate)as nvarchar)+'年'+cast(datepart(mm,endDate) as nvarchar)+ '月'+cast(datepart(dd,endDate) as nvarchar)+'日' as 'endDate', startzone as 'startZone', endzone as 'endZone', jobdate as 'jobDate', printNumber as 'printNumber',driver1Name as 'driver1Name',driver2Name as 'driver2Name' from tjobs_travel where enterpriseID="+id;
            DataTable dt = SqlHelper.GetDataTable(sqlStr, null);

            return(DataTableConvertJson.DataTableToJson1(dt));
        }
        public string GetValid(int id)
        {
            string    sqlStr = @"select enterprise,cast(datepart(yy, useEndDate)as nvarchar)+'年'+cast(datepart(mm,useEndDate) as nvarchar)+ '月'+cast(datepart(dd,useEndDate) as nvarchar)+'日' as 'useEndDate' ,
                cast(datepart(yy, useEndDate_travel)as nvarchar)+'年'+cast(datepart(mm,useEndDate_travel) as nvarchar)+ '月'+cast(datepart(dd,useEndDate_travel) as nvarchar)+'日' as 'useEndDate_travel' 
                from tenterprise where id=" + id;
            DataTable dt     = SqlHelper.GetDataTable(sqlStr, null);

            return(DataTableConvertJson.DataTableToJson1(dt));
        }
        public string GetIndex()
        {
            //string sqlStr = "select top 20 (select enterprise from tenterprise where id=enterpriseID) as '企业名称', carcode as '车牌号码', jobid as '申请编号', countyType as '区域类型', [status] as '审核状态', startDate as '有效期起', endDate as '有效期止', startzone as '起点', endzone as '终点', passLine as '途经线路', carCountyType as '经营范围', mileage as '往返里程数', jobdate as '上报日期', attachCounty as '管理单位', decide as '审核人员', printNumber as '牌证编号' from tjobs_travel order by jobdate desc";
            //string sqlStr = @"select top 20 (select enterprise from tenterprise where id=enterpriseID) as 'enterprise', carcode as 'carCode', jobid as 'jobId', countyType as 'countryType', [status] as 'status', cast(datepart(yy, startDate)as nvarchar)+'年'+cast(datepart(mm,startDate) as nvarchar)+ '月'+cast(datepart(dd,startDate) as nvarchar)+'日' as 'startDate', cast(datepart(yy, endDate)as nvarchar)+'年'+cast(datepart(mm,endDate) as nvarchar)+ '月'+cast(datepart(dd,endDate) as nvarchar)+'日' as 'endDate', startzone as 'startZone', endzone as 'endZone', passLine as 'passLine', carCountyType as 'carCountryType', mileage as 'mileage', jobdate as 'jobDate', attachCounty as 'attachCounty', decide as 'decide', printNumber as 'printNumber',driver1Name as 'driver1Name',driver2Name as 'driver2Name' from tjobs_travel order by jobdate desc";
            //SqlHelper.GetCommand(SqlHelper.SqlConnString(), null, sqlStr, null);
            string    sqlStr = @"select top 100 (select enterprise from tenterprise where id=enterpriseID) as 'enterprise', carcode as 'carCode', jobid as 'jobId', cast(datepart(yy, startDate)as nvarchar)+'年'+cast(datepart(mm,startDate) as nvarchar)+ '月'+cast(datepart(dd,startDate) as nvarchar)+'日' as 'startDate', cast(datepart(yy, endDate)as nvarchar)+'年'+cast(datepart(mm,endDate) as nvarchar)+ '月'+cast(datepart(dd,endDate) as nvarchar)+'日' as 'endDate', startzone as 'startZone', endzone as 'endZone', jobdate as 'jobDate', case when printNumber is NULL then '(未打印)' else printNumber end as 'printNumber',driver1Name as 'driver1Name',driver2Name as 'driver2Name' from tjobs_travel order by jobdate desc";
            DataTable dt     = SqlHelper.GetDataTable(sqlStr, null);

            return(DataTableConvertJson.DataTableToJson1(dt));
        }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string method = string.Empty;
            //返回值
            string s_responsetext = string.Empty;

            if (string.IsNullOrEmpty(Request["method"]))
            {
                LoadSelectedEmployees();
                return;
            }

            method = Request["method"].ToString();
            switch (method)
            {
            case "getdepts":
                string sql = "";
                if (BP.WF.Glo.OSModel == BP.Sys.OSModel.OneMore)
                {
                    sql = "select NO,NAME,ParentNo from port_dept ORDER BY Idx";
                }
                else
                {
                    sql = "select NO,NAME,ParentNo from port_dept  ";
                }

                DataTable dt_dept = DBAccess.RunSQLReturnTable(sql);
                s_responsetext = DataTableConvertJson.TransDataTable2TreeJson(dt_dept, "NO", "NAME", "ParentNo", "0");
                break;

            case "getusers":    //查询人员信息
                s_responsetext = GetSearchedEmps();
                break;
            }
            if (string.IsNullOrEmpty(s_responsetext))
            {
                s_responsetext = "";
            }
            //组装ajax字符串格式,返回调用客户端
            Response.Charset         = "UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType     = "text/html";
            Response.Expires         = 0;
            Response.Write(s_responsetext);
            Response.End();
        }
Exemplo n.º 14
0
        /// <summary>
        /// 获取查询人员
        /// </summary>
        private string GetSearchedEmps()
        {
            String curUserNo       = BP.Web.WebUser.No;
            String deptId          = getUTF8ToString("DeptId");
            bool   searchChildDept = Convert.ToBoolean(getUTF8ToString("SearchChild"));
            String name            = getUTF8ToString("KeyWord");

            string sql = "";

            if (searchChildDept)
            {
                deptId = GetDeptAndChild(deptId);
            }
            else
            {
                deptId = "'" + deptId + "'";
            }

            if (BP.WF.Glo.OSModel == BP.Sys.OSModel.OneMore)
            {
                string filter_dept = deptId == "0" ? String.Empty : String.Format(" and Port_Emp.No in (Select FK_Emp from Port_DeptEmp where FK_Dept in ({0}))", deptId);
                string filter_name = String.IsNullOrEmpty(name) ? String.Empty : String.Format(" and Port_Emp.Name+','+Port_Emp.NO like '%{0}%'", name);
                if (BP.Sys.SystemConfig.AppCenterDBType == BP.DA.DBType.MySQL)
                {
                    filter_name = String.IsNullOrEmpty(name) ? String.Empty : String.Format(" and CONCAT(Port_Emp.Name,',',Port_Emp.NO) like '%{0}%'", name);
                }
                sql = String.Format("select Port_Emp.*,Port_Dept.Name as DeptName from Port_Emp,Port_Dept where Port_Emp.FK_Dept = Port_Dept.No {0}{1}", filter_dept, filter_name);
            }
            else
            {
                string filter_dept = deptId == "0" ? String.Empty : String.Format(" and Port_Emp.No in (Select FK_Emp from Port_EmpDept where FK_Dept in ({0}))", deptId);
                string filter_name = String.IsNullOrEmpty(name) ? String.Empty : String.Format(" and Port_Emp.Name+','+Port_Emp.NO like '%{0}%'", name);
                if (BP.Sys.SystemConfig.AppCenterDBType == BP.DA.DBType.MySQL)
                {
                    filter_name = String.IsNullOrEmpty(name) ? String.Empty : String.Format(" and CONCAT(Port_Emp.Name,',',Port_Emp.NO) like '%{0}%'", name);
                }
                sql = String.Format("select Port_Emp.*,Port_Dept.Name as DeptName from Port_Emp,Port_Dept where Port_Emp.FK_Dept = Port_Dept.No {0}{1}", filter_dept, filter_name);
            }

            DataTable dt = DBAccess.RunSQLReturnTable(sql);

            return(DataTableConvertJson.DataTable2Json(ColumnName2UpperCase(dt)));
        }
Exemplo n.º 15
0
        /// <summary>
        /// 以下算法只包含 oracle mysql sqlserver 三种类型的数据库 qin
        /// </summary>
        /// <param name="dataSource">表名</param>
        /// <param name="pageNumber">当前页</param>
        /// <param name="pageSize">当前页数据条数</param>
        /// <param name="key">计算总行数需要</param>
        /// <param name="orderKey">排序字段</param>
        /// <returns></returns>
        public string DBPaging(string dataSource, int pageNumber, int pageSize, string key, string orderKey)
        {
            string sql        = "";
            string orderByStr = "";

            if (!string.IsNullOrEmpty(orderKey))
            {
                orderByStr = " ORDER BY " + orderKey;
            }

            switch (DBAccess.AppCenterDBType)
            {
            case DBType.Oracle:
                int beginIndex = (pageNumber - 1) * pageSize + 1;
                int endIndex   = pageNumber * pageSize;

                sql = "SELECT * FROM ( SELECT A.*, ROWNUM RN " +
                      "FROM (SELECT * FROM  " + dataSource + orderByStr + ") A WHERE ROWNUM <= " + endIndex + " ) WHERE RN >=" + beginIndex;
                break;

            case DBType.MSSQL:
                sql = "SELECT TOP " + pageSize + " * FROM " + dataSource + " WHERE " + key + " NOT IN  ("
                      + "SELECT TOP (" + pageSize + "*(" + pageNumber + "-1)) " + key + " FROM " + dataSource + " )" + orderByStr;
                break;

            case DBType.MySQL:
                pageNumber -= 1;
                sql         = "select * from  " + dataSource + orderByStr + " limit " + pageNumber + "," + pageSize;
                break;

            default:
                throw new Exception("暂不支持您的数据库类型.");
            }

            DataTable DTable = DBAccess.RunSQLReturnTable(sql);

            int totalCount = DBAccess.RunSQLReturnCOUNT("select " + key + " from " + dataSource);

            return(DataTableConvertJson.DataTable2Json(DTable, totalCount));
        }
Exemplo n.º 16
0
        public static string DataTable2Json(DataTable dt, int totalRows)
        {
            StringBuilder jsonBuilder = new StringBuilder();

            jsonBuilder.Append("{rows:[");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (string.IsNullOrEmpty(dt.Rows[i]["OID"].ToString()))
                {
                    continue;
                }

                jsonBuilder.Append("{");
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    jsonBuilder.Append(dt.Columns[j].ColumnName);
                    jsonBuilder.Append(":");
                    jsonBuilder.Append("'" + DataTableConvertJson.GetFilteredStrForJSON(dt.Rows[i][j].ToString()) + "'");
                    jsonBuilder.Append(",");
                }
                jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
                jsonBuilder.Append("},");
            }
            //不存在数据时
            if (jsonBuilder.Length > 7)
            {
                jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
            }
            //jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
            if (totalRows == 0)
            {
                jsonBuilder.Append("],total:0");
            }
            else
            {
                jsonBuilder.Append("],total:" + totalRows);
            }
            jsonBuilder.Append("}");
            return(jsonBuilder.ToString());
        }
Exemplo n.º 17
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public string loadData()
        {
            string    FK_Flow = getUTF8ToString("FK_Flow");
            string    rpt     = "ND" + int.Parse(FK_Flow) + "Rpt";
            DataTable rptDt   = DBAccess.GetTableSchema(rpt);

            rptDt.Columns.Add("");

            MapAttrs attrs = new MapAttrs(rpt);

            DataTable dt = new DataTable();

            dt.Columns.Add("ZD", typeof(string));
            dt.Columns.Add("ZDMC", typeof(string));
            dt.Columns.Add("LX", typeof(string));
            foreach (MapAttr attr in attrs)
            {
                dt.Rows.Add(attr.Name, attr.KeyOfEn, attr.MyDataTypeStr);
            }

            return(DataTableConvertJson.DataTable2Json(dt, dt.Rows.Count));
        }
Exemplo n.º 18
0
        public static string GetDataGridTemplate(DataTable table, DataGridColumnType columns)
        {
            string m_ValidTreeJson = "";

            string[] m_ColumnText   = columns.ColumnText;  // = new string[] { "KeyID", "number", "Energy" };
            int[]    m_ColumnWidth  = columns.ColumnWidth; // = new int[] { 180, 230, 130 };
            string[] m_FormatString = columns.ColumnType;  // = new string[] { "", "\"type\":\"text\"", "\"type\":\"numberbox\", \"options\":{\"precision\":\"2\"}" };//"\"type\":\"numberbox\", \"options\":{\"precision\":\"2\"}", "", "", "\"type\":\"checkbox\", \"options\":{\"on\":\"True\",\"off\":\"False\"}", "\"type\":\"text\"" };


            DataTable m_DataTableUserInfo = table;
            List <Model_GridColumnType> m_Model_GridColumnTypeList = new List <Model_GridColumnType>(1);

            for (int i = 0; i < m_DataTableUserInfo.Columns.Count; i++)
            {
                Model_GridColumnType m_Model_GridColumnType = new Model_GridColumnType();
                m_Model_GridColumnType.ColumnText   = m_ColumnText[i];
                m_Model_GridColumnType.ColumnWidth  = m_ColumnWidth[i];
                m_Model_GridColumnType.FormatString = m_FormatString[i];
                m_Model_GridColumnTypeList.Add(m_Model_GridColumnType);
            }
            m_ValidTreeJson = DataTableConvertJson.DataTableToJson(m_DataTableUserInfo, m_Model_GridColumnTypeList);
            return(m_ValidTreeJson);
        }
Exemplo n.º 19
0
        public static string GetFormulaYearReportTemplate(DataTable table)
        {
            string m_ValidTreeJson = "";

            string[] m_ColumnText   = new string[] { "KeyID", "Number", "层次码", "工序名称", "峰期电耗", "尖峰期电耗", "谷期电耗", "平期电耗", "总计" };
            int[]    m_ColumnWidth  = new int[] { 80, 230, 130, 130, 130, 130, 130, 130, 130 };
            string[] m_FormatString = new string[] { "", "\"type\":\"text\"", "\"type\":\"text\"", "\"type\":\"text\"",
                                                     "\"type\":\"numberbox\", \"options\":{\"precision\":\"2\"}", "\"type\":\"numberbox\", \"options\":{\"precision\":\"2\"}",
                                                     "\"type\":\"numberbox\", \"options\":{\"precision\":\"2\"}", "\"type\":\"numberbox\", \"options\":{\"precision\":\"2\"}", "\"type\":\"numberbox\", \"options\":{\"precision\":\"2\"}" };//"\"type\":\"numberbox\", \"options\":{\"precision\":\"2\"}", "", "", "\"type\":\"checkbox\", \"options\":{\"on\":\"True\",\"off\":\"False\"}", "\"type\":\"text\"" };

            DataTable m_DataTableUserInfo = table;
            List <Model_GridColumnType> m_Model_GridColumnTypeList = new List <Model_GridColumnType>(1);

            for (int i = 0; i < m_DataTableUserInfo.Columns.Count; i++)
            {
                Model_GridColumnType m_Model_GridColumnType = new Model_GridColumnType();
                m_Model_GridColumnType.ColumnText   = m_ColumnText[i];
                m_Model_GridColumnType.ColumnWidth  = m_ColumnWidth[i];
                m_Model_GridColumnType.FormatString = m_FormatString[i];
                m_Model_GridColumnTypeList.Add(m_Model_GridColumnType);
            }
            m_ValidTreeJson = DataTableConvertJson.DataTableToJson(m_DataTableUserInfo, m_Model_GridColumnTypeList);
            return(m_ValidTreeJson);
        }
        public string GetTableById(int id)
        {
            //            string sqlStr = @"select top 1 (select enterprise from tenterprise where id=enterpriseID) as 'enterprise', (select enterprise from tenterprise where id=enterpriseID) as 'businessArea', carcode as 'carCode', carCountyType as 'carCountryType',
            //startzone as 'startZone', endzone as 'endZone', vehicletype as 'vehicleType', vehicleseates as 'vehicleSeat',
            //passLine as 'passLine', mileage as 'mileage', passengers as 'passengers', cast(datepart(yy, startDate)as nvarchar)+'年'+cast(datepart(mm,startDate) as nvarchar)+ '月'+cast(datepart(dd,startDate) as nvarchar)+'日' as 'startDate',
            //cast(datepart(yy, endDate)as nvarchar)+'年'+cast(datepart(mm,endDate) as nvarchar)+ '月'+cast(datepart(dd,endDate) as nvarchar)+'日' as 'endDate',
            //carDegree as 'carDegree', cast(datepart(yy, joinDate)as nvarchar)+'年'+cast(datepart(mm,joinDate) as nvarchar)+ '月'+cast(datepart(dd,joinDate) as nvarchar)+'日' as 'joinDate', license as 'carLicence', cast(datepart(yy, bxDate)as nvarchar)+'年'+cast(datepart(mm,bxDate) as nvarchar)+ '月'+cast(datepart(dd,bxDate) as nvarchar)+'日' as 'insDate', cast(datepart(yy, djpdDate)as nvarchar)+'年'+cast(datepart(mm,djpdDate) as nvarchar)+ '月'+cast(datepart(dd,djpdDate) as nvarchar)+'日' as 'degreeDate',
            //ifBack as 'gbPsg', cast(datepart(yy, xszDate)as nvarchar)+'年'+cast(datepart(mm,xszDate) as nvarchar)+ '月'+cast(datepart(dd,xszDate) as nvarchar)+'日' as 'dlvDate', nightRun as 'drAir',
            //driver1Name as 'driver1Name', driver1J as 'drver1Type', driver1C as 'driver1Num', cast(datepart(yy, driver1CDate)as nvarchar)+'年'+cast(datepart(mm,driver1CDate) as nvarchar)+ '月'+cast(datepart(dd,driver1CDate) as nvarchar)+'日' as 'endDate',
            //driver2Name as 'driver1Name', driver2J as 'drver1Type', driver2C as 'driver1Num', driver2CDate as 'driver1Date'
            //from tjobs_travel where carcode='贵GT0588' order by jobdate desc";
            string    sqlStr = @"select (select enterprise from tenterprise where id=enterpriseID) as 'enterprise', (select businessArea from tenterprise where id=enterpriseID) as 'businessArea', carcode as 'carCode', countyType as 'countryType',
startzone as 'startZone', endzone as 'endZone', vehicletype as 'vehicleType', vehicleseates as 'vehicleSeat', attachCounty as 'attachCountry',
passLine as 'passLine', mileage as 'mileage', passengers as 'passengers', cast(datepart(yy, startDate)as nvarchar)+'年'+cast(datepart(mm,startDate) as nvarchar)+ '月'+cast(datepart(dd,startDate) as nvarchar)+'日' as 'startDate', 
cast(datepart(yy, endDate)as nvarchar)+'年'+cast(datepart(mm,endDate) as nvarchar)+ '月'+cast(datepart(dd,endDate) as nvarchar)+'日' as 'endDate',
carDegree as 'carDegree', cast(datepart(yy, joinDate)as nvarchar)+'年'+cast(datepart(mm,joinDate) as nvarchar)+ '月'+cast(datepart(dd,joinDate) as nvarchar)+'日' as 'joinDate', license as 'carLicence', cast(datepart(yy, bxDate)as nvarchar)+'年'+cast(datepart(mm,bxDate) as nvarchar)+ '月'+cast(datepart(dd,bxDate) as nvarchar)+'日' as 'insDate', cast(datepart(yy, djpdDate)as nvarchar)+'年'+cast(datepart(mm,djpdDate) as nvarchar)+ '月'+cast(datepart(dd,djpdDate) as nvarchar)+'日' as 'degreeDate',
ifBack as 'gbPsg', cast(datepart(yy, xszDate)as nvarchar)+'年'+cast(datepart(mm,xszDate) as nvarchar)+ '月'+cast(datepart(dd,xszDate) as nvarchar)+'日' as 'dlvDate', nightRun as 'drAir',
driver1Name as 'driver1Name', driver1J as 'drver1Type', driver1C as 'driver1Num', cast(datepart(yy, driver1CDate)as nvarchar)+'年'+cast(datepart(mm,driver1CDate) as nvarchar)+ '月'+cast(datepart(dd,driver1CDate) as nvarchar)+'日' as 'endDate',
driver2Name as 'driver2Name', driver2J as 'drver2Type', driver2C as 'driver2Num', cast(datepart(yy, driver2CDate)as nvarchar)+'年'+cast(datepart(mm,driver2CDate) as nvarchar)+ '月'+cast(datepart(dd,driver2CDate) as nvarchar)+'日' as 'driver2Date'
from tjobs_travel where jobid=" + id;
            DataTable dt     = SqlHelper.GetDataTable(sqlStr, null);

            return(DataTableConvertJson.DataTableToJson1(dt));
        }
Exemplo n.º 21
0
        /// <summary>
        /// 添加数据
        /// </summary>
        /// <returns></returns>
        private string addData()
        {
            string lb = getUTF8ToString("lb");

            if (lb == "readWords" || lb == "hisWords")//文件,历史词汇
            {
                return("false");
            }

            string text = getUTF8ToString("text");

            text = DataTableConvertJson.GetFilteredStrForJSON(text);
            if (string.IsNullOrEmpty(text))
            {
                return("false");
            }

            string enName  = getUTF8ToString("FK_MapData");
            string AttrKey = getUTF8ToString("AttrKey");


            string lbStr  = "";
            string fk_emp = "";

            if (lb == "myWords")//我的词汇
            {
                lbStr  = "1";
                fk_emp = WebUser.No;
            }
            if (lb == "sysWords")//系统词汇
            {
                lbStr  = "3";
                fk_emp = "";
            }

            string addQue = " and FK_MapData='" + enName + "' and AttrKey='" + AttrKey + "' and CurValue='" + text + "'";
            string sql    = "select * from sys_defval where LB='" + lbStr + "' and FK_Emp='" + fk_emp + "'" + addQue;

            if (DBAccess.RunSQLReturnCOUNT(sql) != 0)
            {
                return("false");
            }

            try
            {
                DefVal dv = new DefVal();
                dv.FK_MapData = enName;
                dv.AttrKey    = AttrKey;
                dv.LB         = lbStr;
                dv.FK_Emp     = fk_emp;
                dv.CurValue   = text;
                dv.Insert();
            }
            catch
            {
                DefVal dv = new DefVal();
                dv.RunSQL("drop table Sys_DefVal");
                dv.CheckPhysicsTable();
            }

            return("true");
        }