コード例 #1
0
        public JsonResult AssignConfiuredAsset(ConfiguredAssetEmployee configuredAssetEmployee)
        {
            int             result = 0;
            string          configurationGroupNameId = string.Empty;
            AssetService    assetservice             = new AssetService();
            EmployeeService employeeService          = new EmployeeService();
            int             configResult             = 0;
            int             configAssetAllocation    = 0;

            result = assetservice.ConfiguredAssetAllocation(configuredAssetEmployee);

            if (result > 0)
            {
                configurationGroupNameId = assetservice.ConfigurationGroupNameId();
            }
            if (configurationGroupNameId != string.Empty || configurationGroupNameId != null)
            {
                configResult = assetservice.CreateConfiguration(configurationGroupNameId, configuredAssetEmployee.selectedAssets);
            }
            if (configResult > 0)
            {
                for (int i = 0; i < configuredAssetEmployee.selectedAssets.Count; i++)
                {
                    configAssetAllocation = assetservice.AssetAllocation(configuredAssetEmployee.srNo, configuredAssetEmployee.selectedAssets[i]);
                }
            }
            if (configAssetAllocation > 0 && result > 0 && configResult > 0)
            {
                return(Json(new { success = true, responseText = "Configured Assets allocated successfully." }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { success = false, responseText = "Error while configured allocation!!" }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
        public JsonResult AssignStandaloneAsset(AssetEmployee assetEmployee)
        {
            int             result          = 0;
            AssetService    assetservice    = new AssetService();
            EmployeeService employeeservice = new EmployeeService();

            result = assetservice.AssetAllocation(assetEmployee.srNo, assetEmployee.assetId);
            //      assetservice.AssetAllocation();
            if (result > 0)
            {
                //  Send "false"
                return(Json(new { success = true, responseText = "Asset allocated successfully." }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                //  Send "Success"
                return(Json(new { success = false, responseText = "Error while allocation!!" }, JsonRequestBehavior.AllowGet));
            }
            //   return Json(new { success = false, responseText = "Your message successfuly sent!" }, JsonRequestBehavior.AllowGet);
        }