Esempio n. 1
0
        public static JArray parseJsonResourceLines(string result)
        {
            JArray conversion = null;

            try
            {
                var jObject2 = JObject.Parse(result);
                //dynamic json = JValue.Parse(result.ToString());
                //conversion = (JArray)json.value;
                JArray items = (JArray)jObject2["value"];
                for (int i = 0; i < items.Count; i++)
                {
                    ResourceMaster obj = new ResourceMaster();
                    obj.ResourceNo = (string)jObject2["value"][i]["No"];
                    string username = (string)jObject2["value"][i]["Time_Sheet_Owner_User_ID"];
                    if (!string.IsNullOrEmpty(username))
                    {
                        obj.UserName = username.Replace("SERVPRO\\", "");
                    }

                    obj.Name = (string)jObject2["value"][i]["Name"];
                    bool status = (bool)jObject2["value"][i]["Blocked"];
                    if (!status)
                    {
                        SyncResource.InsertResourceLines(obj);
                    }
                }
            }
            catch (Exception e)
            {
            }
            return(conversion);
        }
Esempio n. 2
0
        public static int InsertResourceLines(ResourceMaster obj)
        {
            DBHelper  DBConn = new DBHelper();
            DataTable dt;

            SqlParameter[] sqlparam;
            sqlparam = new SqlParameter[4];

            sqlparam[0] = new SqlParameter("@id", '0');
            sqlparam[1] = new SqlParameter("@ResourceNo", obj.ResourceNo);
            sqlparam[2] = new SqlParameter("@UserName", obj.UserName);
            sqlparam[3] = new SqlParameter("@Name", obj.Name);
            int a = DBConn.Save("InsertResourceLines", sqlparam, "");

            return(a);
        }