Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="type">function|account</param>
 /// <param name="ID"></param>
 /// <param name="msg"></param>
 /// <returns></returns>
 public bool ChangeStatusFunctionAccount(string type, string ID, ref string msg)
 {
     try
     {
         MyStoreAndBusinessRequest paraBody = new MyStoreAndBusinessRequest();
         paraBody.ID = ID;
         NSLog.Logger.Info("ChangeStatus" + type + " Request", paraBody);
         var result = (NSApiResponse)ApiResponse.Post <NSApiResponse>(
             type.Equals("function") ? Commons.ClientSiteStoreBusinessChangeStatusFunction : Commons.ClientSiteStoreBusinessChangeStatusAccount,
             null, paraBody);
         if (result != null)
         {
             if (result.Success)
             {
                 return(true);
             }
             else
             {
                 msg = result.Message;
                 NSLog.Logger.Info("ChangeStatus" + type, result.Message);
                 return(false);
             }
         }
         else
         {
             NSLog.Logger.Info("ChangeStatus" + type, result);
             return(false);
         }
     }
     catch (Exception ex)
     {
         NSLog.Logger.Error("ChangeStatus" + type + "_Error", ex);
         return(false);
     }
 }
Beispiel #2
0
        // Get information of Product for Buy Addition from My Store & Business
        public List <ProductApplyStoreModels> GetProductApplyAdditionsStoreBusiness(string AssetID, string CustomerID)
        {
            List <ProductApplyStoreModels> lstData = new List <ProductApplyStoreModels>();

            try
            {
                MyStoreAndBusinessRequest paraBody = new MyStoreAndBusinessRequest();
                paraBody.ID      = CustomerID;
                paraBody.AssetID = AssetID;

                NSLog.Logger.Info("GetProductApplyAdditionsStoreBusiness Request: ", paraBody);

                var     result     = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.ClientSiteStoreBusinessGetListProductApplyStore, null, paraBody);
                dynamic data       = result.Data;
                var     lstDataRaw = data["ListProduct"];
                var     lstObject  = JsonConvert.SerializeObject(lstDataRaw);
                lstData = JsonConvert.DeserializeObject <List <ProductApplyStoreModels> >(lstObject);
                NSLog.Logger.Info("GetProductApplyAdditionsStoreBusiness", lstData);

                return(lstData);
            }
            catch (Exception e)
            {
                NSLog.Logger.Error("GetProductApplyAdditionsStoreBusiness_Fail", e);
                return(lstData);
            }
        }
Beispiel #3
0
 public bool ChangeStatusDevice(string DeviceID, ref string msg)
 {
     try
     {
         MyStoreAndBusinessRequest paraBody = new MyStoreAndBusinessRequest();
         paraBody.ID = DeviceID;
         NSLog.Logger.Info("ChangeStatusDevice Request", paraBody);
         var result = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.ClientSiteStoreBusinessChangeStatusDevice, null, paraBody);
         if (result != null)
         {
             if (result.Success)
             {
                 return(true);
             }
             else
             {
                 msg = result.Message;
                 NSLog.Logger.Info("ChangeStatusDevice", result.Message);
                 return(false);
             }
         }
         else
         {
             NSLog.Logger.Info("ChangeStatusDevice", result);
             return(false);
         }
     }
     catch (Exception ex)
     {
         NSLog.Logger.Error("ChangeStatusDevice_Error", ex);
         return(false);
     }
 }
Beispiel #4
0
        public MerchantModels GetMerchantInfo(string CustomerID)
        {
            MerchantModels item = new MerchantModels();

            try
            {
                MyStoreAndBusinessRequest paraBody = new MyStoreAndBusinessRequest();
                paraBody.ID = CustomerID;
                NSLog.Logger.Info("GetMerchantInfo Request: ", paraBody);

                var     result     = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.ClientSiteStoreBusinessMerchantGetInfo, null, paraBody);
                dynamic data       = result.Data;
                var     lstDataRaw = data["MerchantInfo"];
                var     lstObject  = JsonConvert.SerializeObject(lstDataRaw);
                item = JsonConvert.DeserializeObject <MerchantModels>(lstObject);
                if (item == null)
                {
                    item = new MerchantModels();
                }
                NSLog.Logger.Info("GetMerchantInfo", item);

                return(item);
            }
            catch (Exception e)
            {
                NSLog.Logger.Error("GetMerchantInfo_Fail", e);
                return(item);
            }
        }
Beispiel #5
0
        public List <ProductPriceModels> GetPriceProduct(string ProductID)
        {
            var models = new List <ProductPriceModels>();

            try
            {
                MyStoreAndBusinessRequest paraBody = new MyStoreAndBusinessRequest();
                paraBody.ID = ProductID;
                NSLog.Logger.Info("GetPriceProduct Request: ", paraBody);

                var result = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.ClientSiteStoreBusinessPriceList, null, paraBody);
                NSLog.Logger.Info("GetPriceProduct Response : ", result);
                dynamic data = result.Data;

                var lstDataRaw = data["ListPrice"];
                var lstObject  = JsonConvert.SerializeObject(lstDataRaw);
                models = JsonConvert.DeserializeObject <List <ProductPriceModels> >(lstObject);
                return(models);
            }
            catch (Exception ex)
            {
                NSLog.Logger.Error("GetPriceProduct ", ex);
                return(models);
            }
        }
Beispiel #6
0
        public List <MerchantModels> GetListMerchant(string CustomerID)
        {
            List <MerchantModels> listItem = new List <MerchantModels>();

            try
            {
                MyStoreAndBusinessRequest paraBody = new MyStoreAndBusinessRequest();
                paraBody.ID = CustomerID;
                NSLog.Logger.Info("GetListMerchant_Request: ", paraBody);

                var     result     = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.ClientSiteStoreBusinessMerchantGetList, null, paraBody);
                dynamic data       = result.Data;
                var     lstDataRaw = data["ListMerchant"];
                var     lstObject  = JsonConvert.SerializeObject(lstDataRaw);
                listItem = JsonConvert.DeserializeObject <List <MerchantModels> >(lstObject);
                if (listItem == null)
                {
                    listItem = new List <MerchantModels>();
                }
                NSLog.Logger.Info("GetListMerchant_Response: ", listItem);

                return(listItem);
            }
            catch (Exception e)
            {
                NSLog.Logger.Error("GetListMerchant_Fail: ", e);
                return(listItem);
            }
        }
Beispiel #7
0
        public StoreDetailModels GetStoreInfo(string StoreId)
        {
            StoreDetailModels item = new StoreDetailModels();

            try
            {
                MyStoreAndBusinessRequest paraBody = new MyStoreAndBusinessRequest();
                paraBody.ID = StoreId;

                NSLog.Logger.Info("GetStoreInfo Request: ", paraBody);

                var     result     = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.ClientSiteStoreBusinessStoreGetInfo, null, paraBody);
                dynamic data       = result.Data;
                var     lstDataRaw = data["StoreInfo"];
                var     lstObject  = JsonConvert.SerializeObject(lstDataRaw);
                item = JsonConvert.DeserializeObject <StoreDetailModels>(lstObject);
                NSLog.Logger.Info("GetStoreInfo", item);

                return(item);
            }
            catch (Exception e)
            {
                NSLog.Logger.Error("GetStoreInfo_Fail", e);
                return(item);
            }
        }
Beispiel #8
0
        public UserGetListProductManagementModels GetListHardwareServiceAccountAddition(string CustomerID)
        {
            UserGetListProductManagementModels item = new UserGetListProductManagementModels();

            List <HardwareModels>           ListHardware = new List <HardwareModels>();
            List <ServiceModels>            ListService  = new List <ServiceModels>();
            List <AccountManagementModels>  ListAccount  = new List <AccountManagementModels>();
            List <AdditionFunctionModels>   ListFunction = new List <AdditionFunctionModels>();
            List <ProductPackageUserModels> ListPackage  = new List <ProductPackageUserModels>();

            try
            {
                MyStoreAndBusinessRequest paraBody = new MyStoreAndBusinessRequest();
                paraBody.CustomerID = CustomerID;
                NSLog.Logger.Info("GetListHardwareServiceAccountAddition Request: ", paraBody);

                var     result = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.ClientSiteStoreBusinessHardwareServiceAccountAddition, null, paraBody);
                dynamic data   = result.Data;

                var lstDataRaw = data["ListHardware"];
                var lstObject  = JsonConvert.SerializeObject(lstDataRaw);
                ListHardware = JsonConvert.DeserializeObject <List <HardwareModels> >(lstObject);

                lstDataRaw  = data["ListService"];
                lstObject   = JsonConvert.SerializeObject(lstDataRaw);
                ListService = JsonConvert.DeserializeObject <List <ServiceModels> >(lstObject);

                lstDataRaw  = data["ListAccount"];
                lstObject   = JsonConvert.SerializeObject(lstDataRaw);
                ListAccount = JsonConvert.DeserializeObject <List <AccountManagementModels> >(lstObject);

                lstDataRaw   = data["ListFunction"];
                lstObject    = JsonConvert.SerializeObject(lstDataRaw);
                ListFunction = JsonConvert.DeserializeObject <List <AdditionFunctionModels> >(lstObject);

                lstDataRaw  = data["ListProductPackage"];
                lstObject   = JsonConvert.SerializeObject(lstDataRaw);
                ListPackage = JsonConvert.DeserializeObject <List <ProductPackageUserModels> >(lstObject);

                NSLog.Logger.Info("GetListHardwareServiceAccountAddition", item);
                item.ListHardware       = ListHardware;
                item.ListService        = ListService;
                item.ListAccount        = ListAccount;
                item.ListFunction       = ListFunction;
                item.ListProductPackage = ListPackage;
                return(item);
            }
            catch (Exception e)
            {
                NSLog.Logger.Error("GetListHardwareServiceAccountAddition_Fail", e);
                return(item);
            }
        }
Beispiel #9
0
        public ProductPackageUserModels GetProductPackageDetail(string AssetID)
        {
            ProductPackageUserModels item = new ProductPackageUserModels();

            try
            {
                MyStoreAndBusinessRequest paraBody = new MyStoreAndBusinessRequest();
                paraBody.ID = AssetID;
                NSLog.Logger.Info("GetProductPackageDetail Request: ", paraBody);

                var     result = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.ClientSiteStoreBusinessGetProductPackageDetail, null, paraBody);
                dynamic data   = result.Data;

                var lstDataRaw = data["ProductPackage"];
                var lstObject  = JsonConvert.SerializeObject(lstDataRaw);
                item = JsonConvert.DeserializeObject <ProductPackageUserModels>(lstObject);

                // Convert local time
                if (item != null)
                {
                    item.ActiveTime = item.ActiveTime.HasValue ? CommonHelper.ConvertToLocalTime(item.ActiveTime.Value) : item.ActiveTime;
                    item.ExpiryDate = item.ExpiryDate.HasValue ? CommonHelper.ConvertToLocalTime(item.ExpiryDate.Value) : item.ExpiryDate;
                    if (item.ListProduct != null && item.ListProduct.Count > 0)
                    {
                        item.ListProduct.ForEach(product =>
                        {
                            product.ActiveTime = product.ActiveTime.HasValue ? CommonHelper.ConvertToLocalTime(product.ActiveTime.Value) : product.ActiveTime;
                            product.ExpiryDate = product.ExpiryDate.HasValue ? CommonHelper.ConvertToLocalTime(product.ExpiryDate.Value) : product.ExpiryDate;
                        });
                    }
                    if (item.ListDevice != null && item.ListDevice.Count > 0)
                    {
                        item.ListDevice.ForEach(device =>
                        {
                            device.ActiveTime = device.ActiveTime.HasValue ? CommonHelper.ConvertToLocalTime(device.ActiveTime.Value) : device.ActiveTime;
                        });
                    }
                }
                return(item);
            }
            catch (Exception ex)
            {
                NSLog.Logger.Error("GetProductPackageDetail_Fail", ex);
                return(item);
            }
        }
Beispiel #10
0
        public bool CreateStoreInfoTemp(StoreDetailModels model, string CustomerID, ref string msg, ref string StoreIDReturn)
        {
            try
            {
                MyStoreAndBusinessRequest paraBody = new MyStoreAndBusinessRequest();
                paraBody.StoreInfo   = model;
                paraBody.AssetID     = model.AssetID;
                paraBody.ListAssetID = model.ListAssetID;
                paraBody.ID          = CustomerID;

                NSLog.Logger.Info("CreateStoreInfoTemp Request: ", paraBody);

                //====================
                var result = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.ClientSiteInputStoreCreateStoreTemp, null, paraBody);
                NSLog.Logger.Info("CreateStoreInfoTemp Result: ", result);
                if (result != null)
                {
                    if (result.Success)
                    {
                        dynamic data = result.Data;
                        StoreIDReturn = data["ID"];
                        return(true);
                    }
                    else
                    {
                        msg = result.Message;
                        NSLog.Logger.Info("CreateStoreInfoTemp", result.Message);
                        return(false);
                    }
                }
                else
                {
                    NSLog.Logger.Info("CreateStoreInfoTemp", result);
                    return(false);
                }
            }
            catch (Exception e)
            {
                NSLog.Logger.Error("CreateStoreInfoTemp_Fail: ", e);
                return(false);
            }
        }
Beispiel #11
0
        public bool UpdateStoreInfo(StoreDetailModels model, string CustomerID, ref string msg)
        {
            try
            {
                MyStoreAndBusinessRequest paraBody = new MyStoreAndBusinessRequest();
                paraBody.StoreInfo  = model;
                paraBody.CustomerID = CustomerID;

                NSLog.Logger.Info("UpdateStoreInfo Request: ", paraBody);

                //====================
                var result = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.ClientSiteStoreBusinessStoreUpdateInfo, null, paraBody);
                if (result != null)
                {
                    if (result.Success)
                    {
                        return(true);
                    }
                    else
                    {
                        msg = result.Message;
                        NSLog.Logger.Info("UpdateStoreInfo", result.Message);
                        return(false);
                    }
                }
                else
                {
                    NSLog.Logger.Info("UpdateStoreInfo", result);
                    return(false);
                }
            }
            catch (Exception e)
            {
                NSLog.Logger.Error("UpdateStoreInfo", e);
                return(false);
            }
        }