void QueryList()
        {
            string page     = Request.Params["page"];
            string pagesize = Request.Params["rows"];

            if (string.IsNullOrEmpty(page))
            {
                page = "1";
            }
            if (string.IsNullOrEmpty(pagesize))
            {
                pagesize = "15";
            }

            mg_insertco_customerordertable cot = new mg_insertco_customerordertable();
            string    sql = @"
                            SELECT co.OrderID,
                                   isnull (co.CustomerNumber, '') AS CustomerNumber,
                                   isnull (co.JITCallNumber, '') AS JITCallNumber,
                                   isnull (co.SerialNumber, '') AS SerialNumber,
                                   isnull (co.VinNumber, '') AS VinNumber,
                                   isnull (co.PlanDeliverTime, '') AS PlanDeliverTime,
                                   isnull (prod.ProductNo, '') AS ProductNo,
                                   isnull (prod.ProductName, '') AS ProductName
                              FROM mg_CustomerOrder_3 co
                                   INNER JOIN mg_Customer_Product coprod
                                      ON co.OrderID = coprod.CustomerOrderID
                                   INNER JOIN mg_Product prod ON coprod.ProductID = prod.ID
                             WHERE co.OrderType = 3 and datediff(day,co.CreateTime,getdate())<15 and prod.IsUseing=1
                            ORDER BY co.CreateTime DESC";
            DataTable dt;

            dt = SqlHelper.GetDataDataTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
            int iPage     = Convert.ToInt32(page);
            int iPageZize = Convert.ToInt32(pagesize);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dt.Rows[i];
                if (i < (iPage - 1) * iPageZize || i >= (iPage * iPageZize))
                {
                    continue;
                }
                mg_insertco_customerorder itm = new mg_insertco_customerorder();
                itm.OrderID         = Convert.ToInt32(dr["OrderID"]);
                itm.CustomerNumber  = dr["CustomerNumber"].ToString();
                itm.JITCallNumber   = dr["JITCallNumber"].ToString();
                itm.SerialNumber    = dr["SerialNumber"].ToString();
                itm.VinNumber       = dr["VinNumber"].ToString();
                itm.PlanDeliverTime = dr["PlanDeliverTime"].ToString();
                itm.ProductNo       = dr["ProductNo"].ToString();
                itm.ProductName     = dr["ProductName"].ToString();
                cot.rows.Add(itm);
            }
            cot.total = dt.Rows.Count.ToString();
            string jsonStr = JSONTools.ScriptSerialize <mg_insertco_customerordertable>(cot);

            Response.Write(jsonStr);
            Response.End();
        }
        void QueryPart(string strProductList)
        {
            mg_insertco_parttable pt = new mg_insertco_parttable();

            DataTable dt;
            string    sql = @"
                SELECT part_id, part_no, part_name, part_desc FROM mg_part
                 WHERE charindex (',' + CONVERT (NVARCHAR (20), productID) + ',', '," + strProductList + @",') > 0";

            dt = SqlHelper.GetDataDataTable(SqlHelper.SqlConnString, CommandType.Text, sql, null);
            foreach (DataRow dr in dt.Rows)
            {
                mg_insertco_part itm = new mg_insertco_part();
                itm.part_id   = Convert.ToInt32(dr["part_id"]);
                itm.part_no   = dr["part_no"].ToString();
                itm.part_name = dr["part_name"].ToString();
                itm.part_desc = dr["part_desc"].ToString();
                pt.rows.Add(itm);
            }
            pt.total = dt.Rows.Count.ToString();
            string jsonStr = JSONTools.ScriptSerialize <mg_insertco_parttable>(pt);

            Response.Write(jsonStr);
            Response.End();
        }
Пример #3
0
        /// <summary>
        /// 查询全部宣传口号
        /// </summary>
        /// <returns></returns>
        public static string QueryAndonTaglinesList()
        {
            List <Andon_Taglines> tempList = AndonTaglinesDAL.QueryAndonTaglinesList();
            String jsonStr = JSONTools.ScriptSerialize <List <Andon_Taglines> >(tempList);

            return(jsonStr);
        }
Пример #4
0
    public static Vector3 ReadVector3(Dictionary <string, object> inDict, string inVector3Name, out bool outSuccess, Vector3 inDefaultValue = default(Vector3))
    {
        Vector3 returnVal = inDefaultValue;

        if (inDict.ContainsKey(inVector3Name) == true)
        {
            outSuccess = false;
            List <float> floatList = JSONTools.ReadFloatList(inDict[inVector3Name]);
            if (floatList != null)
            {
                if (floatList.Count == 3)
                {
                    returnVal.x = floatList[0];
                    returnVal.y = floatList[1];
                    returnVal.z = floatList[2];
                    outSuccess  = true;
                }
            }
        }
        else
        {
            outSuccess = false;
        }

        return(returnVal);
    }
        public string GetClassInfo()
        {
            DataTable dt   = Production_Report_BLL.GetClassInfo();
            string    json = JSONTools.DataTableToJson(dt);

            return(json);
        }
Пример #6
0
    private void extractGameInfos(JSONObject json)
    {
        max_cards_action_played = JSONTools.GetIntValue(json, "max_cards_action_played", GameStateReader.INVALID_INT);
        tablespeed = JSONTools.GetIntValue(json, "tablespeed", GameStateReader.INVALID_INT);
        rtc_mode   = JSONTools.GetIntValue(json, "rtc_mode", GameStateReader.INVALID_INT);
        game_result_neutralized = JSONTools.GetStrValue(json, "game_result_neutralized");
        neutralized_player_id   = JSONTools.GetStrValue(json, "neutralized_player_id");

        Debug.Assert(JSONTools.HasFieldOfTypeObject(json, "actions"));
        JSONObject actions = json.GetField("actions");

        action_nbr = JSONTools.GetIntValue(actions, "action_nbr", GameStateReader.INVALID_INT);

        playerorder = new List <string>();
        Debug.Assert(JSONTools.HasFieldOfTypeArray(json, "playerorder"));
        foreach (JSONObject id in json.GetField("playerorder").list)
        {
            Debug.Assert(id.IsString || id.IsNumber);
            if (id.IsString)
            {
                playerorder.Add(id.str);
            }
            else
            {
                playerorder.Add(Mathf.RoundToInt(id.n).ToString());
            }
        }
        Debug.Assert(playerorder.Count == 2);
    }
Пример #7
0
    public static Quaternion ReadQuaternion(Dictionary <string, object> inDict, string inQuatName, out bool outSuccess, Quaternion inDefaultValue = default(Quaternion))
    {
        Quaternion returnVal = inDefaultValue;

        if (inDict.ContainsKey(inQuatName) == true)
        {
            outSuccess = false;
            List <float> floatList = JSONTools.ReadFloatList(inDict[inQuatName]);
            if (floatList != null)
            {
                if (floatList.Count == 4)
                {
                    returnVal.x = floatList[0];
                    returnVal.y = floatList[1];
                    returnVal.z = floatList[2];
                    returnVal.w = floatList[3];
                    outSuccess  = true;
                }
            }
        }
        else
        {
            outSuccess = false;
        }

        return(returnVal);
    }
Пример #8
0
    public static TEnum ReadEnum <TEnum>(Dictionary <string, object> inDict, string inVariableName, out bool inSuccess, TEnum inDefaultValue)
    // With Unity 4.3.4 and VS Express 2012 WP8 having the contraint causes an exception
#if !UNITY_WP8
        where TEnum : struct, System.IComparable, System.IFormattable, System.IConvertible
#endif
    {
        TEnum returnVal = inDefaultValue;

        if (typeof(TEnum).IsEnum == false)
        {
            throw new System.ArgumentException("TEnum must be an enumerated type");
        }

        if (inDict.ContainsKey(inVariableName) == true)
        {
            returnVal = JSONTools.ReadEnum(inDict[inVariableName], inDefaultValue);
            inSuccess = true;
        }
        else
        {
            inSuccess = false;
        }

        return(returnVal);
    }
Пример #9
0
        public static string QueryPartForPartidList()
        {
            List <mg_partModel> list = mg_PartDAL.QueryPartForPartidList();
            string jsonStr           = JSONTools.ScriptSerialize <List <mg_partModel> >(list);

            return(jsonStr);
        }
Пример #10
0
        public void SetOnlineGame(string viewerId, BGA.TableData table, JSONObject bgaData)
        {
            Logger.Instance.Log("LOG", "NWInterface: SetOnlineGame()");
            try
            {
                Clear();

                BGA.BoardData board = new BGA.BoardData(viewerId, table);

                string bgaDataDebugString = JSONTools.FormatJsonDisplay(bgaData);
                foreach (string chunk in splitInLineChunks(bgaDataDebugString, 500))
                {
                    Logger.Instance.Log("DETAIL", chunk);
                }

                GameStateReader gameStateReader = new GameStateReader(bgaData, board);
                if (!gameStateReader.IsValid)
                {
                    Logger.Instance.Log("ERROR", "invalid gamestate received from server");
                }
                gamestate = gameStateReader.convertToGameState();

                gameData.SetOnlineGame(board, gameStateReader.initMoveId, gameStateReader.initPacketId);
            }
            catch (System.Exception e)
            {
                Logger.Instance.Log("ERROR", e.ToString());
                BGA.BoardData board = new BGA.BoardData(viewerId, table);
                gamestate = null;
                gameData.SetOnlineGame(board, 0, 0);
            }
        }
Пример #11
0
        public string GetListNew(HttpContext context)
        {
            string start_time = context.Request["start_time"];
            string end_time   = context.Request["end_time"];
            int    PageSize   = Convert.ToInt32(context.Request["rows"]);
            int    PageIndex  = Convert.ToInt32(context.Request["page"]);

            StringBuilder commandText = new StringBuilder();

            string where = "";

            if (string.IsNullOrEmpty(start_time))
            {
                DateTime t = DateTime.Now.AddMonths(-1);
                start_time = t.ToString("yyyy-MM-dd");
            }
            string StartTime = start_time.Substring(0, 10);

            if (string.IsNullOrEmpty(end_time))
            {
                DateTime t = DateTime.Now;
                end_time = t.ToString("yyyy-MM-dd");
            }
            string EndTime    = end_time.Substring(0, 10);
            int    StartIndex = (PageIndex - 1) * PageSize + 1;
            int    EndIndex   = PageIndex * PageSize;
            DataListModel <Production_AlarmModel> userList = Production_AlarmTrendReport_BLL.GetListNew(StartTime, EndTime, StartIndex, EndIndex);
            string json = JSONTools.ScriptSerialize <DataListModel <Production_AlarmModel> >(userList);

            return(json);
        }
Пример #12
0
            private bool ParseData(JSONObject json)
            {
                /*if (_HasFieldOfTypeString(json, "time"))
                 * {
                 *  DateTime outtime;
                 *  if (DateTime.TryParseExact(json.GetField("time").str, "HH:mm", CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces, out outtime))
                 *  {
                 *      _time = outtime;
                 *  }
                 * }*/
                if (JSONTools.HasFieldOfTypeString(json, "uid"))
                {
                    uid = json.GetField("uid").str;
                }
                if (JSONTools.HasFieldOfTypeString(json, "log"))
                {
                    log = json.GetField("log").str;
                }
                if (JSONTools.HasFieldOfTypeString(json, "type"))
                {
                    type = StringToType(json.GetField("type").str);
                }
                if (JSONTools.HasFieldOfTypeContainer(json, "args"))
                {
                    args = json.GetField("args");
                }

                if (CheckValidity())
                {
                    _status = Status.SLEEPING;
                }

                return(isValid);
            }
Пример #13
0
    public GameStateReaderToken(JSONObject json, bool initialState = false)
    {
        id        = JSONTools.GetIntValue(json, "id", GameStateReader.INVALID_INT);
        player_id = JSONTools.GetStrValue(json, "player_id");
        category  = JSONTools.GetStrValue(json, "category");
        type      = JSONTools.GetStrValue(json, "type");

        if (!initialState)
        {
            location           = JSONTools.GetStrValue(json, "location");
            location_arg       = JSONTools.GetStrValue(json, "location_arg");
            x                  = JSONTools.GetIntValue(json, "x", GameStateReader.INVALID_INT);
            y                  = JSONTools.GetIntValue(json, "y", GameStateReader.INVALID_INT);
            wounded            = JSONTools.GetBoolValue(json, "wounded", 1);
            wounded_this_turn  = JSONTools.GetBoolValue(json, "wounded_this_turn", 1);
            blocked_this_turn  = JSONTools.GetBoolValue(json, "blocked_this_turn", 1);
            additional_actions = JSONTools.GetIntValue(json, "additional_actions", GameStateReader.INVALID_INT);
        }
        else
        {
            location           = JSONTools.GetStrValue(json, "initial_location");
            location_arg       = JSONTools.GetStrValue(json, "initial_location_arg");
            x                  = JSONTools.GetIntValue(json, "initial_x", GameStateReader.INVALID_INT);
            y                  = JSONTools.GetIntValue(json, "initial_y", GameStateReader.INVALID_INT);
            wounded            = false;
            wounded_this_turn  = false;
            blocked_this_turn  = false;
            additional_actions = 0;
        }

        Debug.Assert(isValid);
    }
Пример #14
0
        public static string getList(int PageSize, int StartIndex, int EndIndex, string SortFlag, string sortOrder, string wherestr)
        {
            if (string.IsNullOrEmpty(SortFlag))
            {
                SortFlag = " st_no,step_startTime";
            }
            if (string.IsNullOrEmpty(sortOrder))
            {
                sortOrder = "asc";
            }
            List <mg_sys_log> list = new List <mg_sys_log>();
            int     total          = 0;
            string  query_sql      = " select * from(select row_number() over(order by " + SortFlag + " " + sortOrder + " ) as rowid,report.* from View_mg_sys_log report  where 1 = 1 " + wherestr + ") as Results where rowid >=" + StartIndex + " and rowid <=" + EndIndex + " ";
            string  count_sql      = "select  count(*) as total from View_mg_sys_log where 1 = 1 " + wherestr;
            DataSet ds             = SqlHelper.GetDataSetTableMapping(SqlHelper.SqlConnString, System.Data.CommandType.Text, count_sql + query_sql, new string[] { "count", "data" }, null);

            if (DataHelper.HasData(ds))
            {
                DataTable dt1 = ds.Tables["count"];
                total = NumericParse.StringToInt(DataHelper.GetCellDataToStr(dt1.Rows[0], "total"));
                DataTable dt2 = ds.Tables["data"];
                foreach (DataRow row in dt2.Rows)
                {
                    mg_sys_log model = new mg_sys_log();
                    model.sys_id          = DataHelper.GetCellDataToStr(row, "sys_id");
                    model.op_id           = DataHelper.GetCellDataToStr(row, "op_id");
                    model.op_name         = DataHelper.GetCellDataToStr(row, "op_name");
                    model.fl_id           = DataHelper.GetCellDataToStr(row, "fl_id");
                    model.fl_name         = DataHelper.GetCellDataToStr(row, "fl_name");
                    model.st_id           = DataHelper.GetCellDataToStr(row, "st_id");
                    model.st_no           = DataHelper.GetCellDataToStr(row, "st_no");
                    model.PartOrderID     = DataHelper.GetCellDataToStr(row, "PartOrderID");
                    model.or_no           = DataHelper.GetCellDataToStr(row, "or_no");
                    model.part_no         = DataHelper.GetCellDataToStr(row, "part_no");
                    model.step_order      = NumericParse.StringToInt(DataHelper.GetCellDataToStr(row, "step_order"));
                    model.step_startTime  = DataHelper.GetCellDataToStr(row, "step_startTime");
                    model.step_endTime    = DataHelper.GetCellDataToStr(row, "step_endTime");
                    model.step_duringtime = DataHelper.GetCellDataToStr(row, "step_duringtime");
                    model.AngleResult     = DataHelper.GetCellDataToStr(row, "AngleResult");
                    model.TorqueResult    = DataHelper.GetCellDataToStr(row, "TorqueResult");
                    model.scanCode        = DataHelper.GetCellDataToStr(row, "scanCode");
                    model.scanResult      = DataHelper.GetCellDataToStr(row, "scanResult");
                    model.sys_desc        = DataHelper.GetCellDataToStr(row, "sys_desc");
                    model.ScrewCount      = DataHelper.GetCellDataToStr(row, "ScrewCount");
                    model.MenderName      = DataHelper.GetCellDataToStr(row, "MenderName");
                    model.ReviseTime      = DataHelper.GetCellDataToStr(row, "ReviseTime");


                    list.Add(model);
                }
            }
            DataListModel <mg_sys_log> allmodel = new DataListModel <mg_sys_log>();

            allmodel.total = total.ToString();
            allmodel.rows  = list;
            string jsonStr = JSONTools.ScriptSerialize <DataListModel <mg_sys_log> >(allmodel);

            return(jsonStr);
        }
Пример #15
0
        public static string QueryStationForStepEditing(string fl_id)
        {
            string jsonStr = "[]";
            List <mg_stationModel> list = mg_StationDAL.QueryStationForStepEditing(fl_id);

            jsonStr = JSONTools.ScriptSerialize <List <mg_stationModel> >(list);
            return(jsonStr);
        }
Пример #16
0
        public static string queryPartForStepSearching()
        {
            string jsonStr           = "[]";
            List <mg_partModel> list = mg_PartDAL.queryPartForStepSearching();

            jsonStr = JSONTools.ScriptSerialize <List <mg_partModel> >(list);
            return(jsonStr);
        }
Пример #17
0
 public bool toBool()
 {
     if (null != obj && obj.GetType() == typeof(string))
     {
         return(bool.Parse(obj.ToString()));
     }
     return(JSONTools.ReadBool(obj));
 }
Пример #18
0
 public GameStateReaderPlayer(JSONObject json)
 {
     id    = JSONTools.GetStrValue(json, "id");
     score = JSONTools.GetIntValue(json, "score", GameStateReader.INVALID_INT);
     color = JSONTools.GetStrValue(json, "color");
     order = JSONTools.GetIntValue(json, "player_no", GameStateReader.INVALID_INT);
     Debug.Assert(isValid);
 }
Пример #19
0
        static string queryJSONStringByPropertyType(string type)
        {
            string jsonStr = "[]";
            List <mg_MaterialPropertyModel> list = mg_MaterialPropertyDAL.queryJSONStringByPropertyType(type);

            jsonStr = JSONTools.ScriptSerialize <List <mg_MaterialPropertyModel> >(list);
            return(jsonStr);
        }
Пример #20
0
        public static string QueryDepartmentsForUser()
        {
            string jsonStr = "[]";
            List <mg_DepartmentModel> list = mg_DepartmentDAL.QueryDepartmentsForUser();

            jsonStr = JSONTools.ScriptSerialize <List <mg_DepartmentModel> >(list);
            return(jsonStr);
        }
Пример #21
0
        public static string QueryPositionsForUser()
        {
            string jsonStr = "[]";
            List <mg_PositionModel> list = mg_PositionDAL.QueryPositionsForUser();

            jsonStr = JSONTools.ScriptSerialize <List <mg_PositionModel> >(list);
            return(jsonStr);
        }
Пример #22
0
        public static string queryProductidForPart()
        {
            string jsonStr = "[]";
            List <mg_ProductModel> list = mg_ProductDAL.queryProductidForPart();

            jsonStr = JSONTools.ScriptSerialize <List <mg_ProductModel> >(list);
            return(jsonStr);
        }
Пример #23
0
        public static string QueryTestList()
        {
            string jsonStr           = "[]";
            List <mg_TestModel> list = mg_TestDAL.QueryTestList();

            jsonStr = JSONTools.ScriptSerialize <List <mg_TestModel> >(list);
            return(jsonStr);
        }
Пример #24
0
        public static string QueryStationStnoList()
        {
            string jsonStr = "[]";
            List <mg_stationModel> list = mg_StationDAL.QueryStationStnoList();

            jsonStr = JSONTools.ScriptSerialize <List <mg_stationModel> >(list);
            return(jsonStr);
        }
Пример #25
0
        public static string QueryMaterialPropertyTypeForEditing()
        {
            string jsonStr = "[]";
            List <Mg_MaterialPropertyTypeModel> list = mg_MaterialPropertyDAL.QueryMaterialPropertyTypeForEditing();

            jsonStr = JSONTools.ScriptSerialize <List <Mg_MaterialPropertyTypeModel> >(list);
            return(jsonStr);
        }
Пример #26
0
 public float toFloat()
 {
     if (null != obj && obj.GetType() == typeof(string))
     {
         return(float.Parse(obj.ToString()));
     }
     return((float)JSONTools.ReadDouble(obj));
 }
Пример #27
0
        public static string querySupplierForBOM(string type)
        {
            string jsonStr = "[]";
            List <Mat_SupplierListModel> list = mg_MaterialPropertyDAL.querySupplierForBOM(type);

            jsonStr = JSONTools.ScriptSerialize <List <Mat_SupplierListModel> >(list);
            return(jsonStr);
        }
Пример #28
0
    private void extractNotifications(JSONObject json)
    {
        Debug.Assert(JSONTools.HasFieldOfTypeObject(json, "notifications"));
        JSONObject notifications = json.GetField("notifications");

        last_packet_id = JSONTools.GetIntValue(notifications, "last_packet_id", GameStateReader.INVALID_INT);
        move_nbr       = JSONTools.GetIntValue(notifications, "move_nbr", GameStateReader.INVALID_INT);
    }
Пример #29
0
        public static string queryFlowLineidForPart()
        {
            string jsonStr = "[]";
            List <mg_FlowlingModel> list = mg_FlowLine1DAL.queryFlowLineidForPart();

            jsonStr = JSONTools.ScriptSerialize <List <mg_FlowlingModel> >(list);
            return(jsonStr);
        }
Пример #30
0
        public static string QueryODSByStepid(string step_id)
        {
            string             jsonStr = "[]";
            List <mg_ODSModel> list    = mg_StepDAL.QueryODSByStepid(step_id);

            jsonStr = JSONTools.ScriptSerialize <List <mg_ODSModel> >(list);
            return(jsonStr);
        }