public CswNbtObjClassBatchOp makeNodesBatch(CswNbtCISProNbtMobileData.MobileRequest LegacyData) { // Send to background task CswNbtObjClassBatchOp BatchNode = null; CswNbtBatchOpMobileMultiOpUpdates BatchOp = new CswNbtBatchOpMobileMultiOpUpdates(_CswNbtResources); BatchNode = BatchOp.makeBatchOp(LegacyData); return(BatchNode); }
public CswNbtObjClassBatchOp makeBatchOp(CswNbtCISProNbtMobileData.MobileRequest MobileRequest) { CswNbtObjClassBatchOp BatchNode = null; MobileMultiOpUpdatesBatchData BatchData = new MobileMultiOpUpdatesBatchData(string.Empty); BatchData.StartingCount = MobileRequest.data.MultiOpRows.Count; BatchData.Operations = _operationsCollectionToJArray(MobileRequest.data.MultiOpRows); BatchData.Username = MobileRequest.data.username; BatchNode = CswNbtBatchManager.makeNew(_CswNbtResources, _BatchOpName, BatchData.ToString()); return(BatchNode); } // makeBatchOp()
public CswNbtWebServiceCISProNbtMobile.CswNbtMobileReturn saveOperations(CswNbtCISProNbtMobileData.MobileRequest OperationsArray) { CswNbtWebServiceCISProNbtMobile.CswNbtMobileReturn Ret = new CswNbtWebServiceCISProNbtMobile.CswNbtMobileReturn(); var SvcDriver = new CswWebSvcDriver <CswNbtWebServiceCISProNbtMobile.CswNbtMobileReturn, CswNbtCISProNbtMobileData.MobileRequest>( CswWebSvcResourceInitializer: new CswWebSvcResourceInitializerNbt(_Context), ReturnObj: Ret, WebSvcMethodPtr: CswNbtWebServiceCISProNbtMobile.saveOperations, ParamObj: OperationsArray ); SvcDriver.run(); Ret.Data.Success = true; return(Ret); }
public static void saveOperations(ICswResources CswResources, CswNbtWebServiceCISProNbtMobile.CswNbtMobileReturn returnobj, CswNbtCISProNbtMobileData.MobileRequest MobileRequest) { //Shelve this to a batch operation CswNbtBatchOpMobileMultiOpUpdates op = new CswNbtBatchOpMobileMultiOpUpdates((CswNbtResources)CswResources); CswNbtObjClassBatchOp BatchNode = op.makeBatchOp(MobileRequest); }
/// <summary> /// /// </summary> /// <param name="CswResources"></param> /// <param name="ReturnObj"></param> /// <param name="LegacyFileData"></param> public static void performOperations(ICswResources CswResources, CswNbtMobileReturn ReturnObj, string LegacyFileData) { CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture; TextInfo textInfo = cultureInfo.TextInfo; Collection <CswNbtCISProNbtMobileData.MobileRequest.Operation> LegacyOperations = new Collection <CswNbtCISProNbtMobileData.MobileRequest.Operation>(); // string filecontents = MPFDF.FileContents; string filecontents = LegacyFileData; //Convert string into an array of strings string[] delimiters = new string[] { "\r\n", "\n" }; List <string> ops = new List <string>(filecontents.Split(delimiters, StringSplitOptions.RemoveEmptyEntries)); //Grab the first line and store it as programname CswNbtCISProNbtMobileData.MobileRequest.Data LegacyData = new CswNbtCISProNbtMobileData.MobileRequest.Data(); LegacyData.programname = ops[0]; // We set the user to the user who is uploading the data LegacyData.username = CswResources.CurrentUser.Username; //What to do if the first line doesn't match with enum? DataFormat Format; if (Enum.TryParse(LegacyData.programname, out Format)) { //remove the first line ops.RemoveAt(0); if (DataFormat.multi1 == Format) { //iterate through operations and save as objects foreach (string op in ops) { string[] currentOp = op.Split(','); //create an operation object CswNbtCISProNbtMobileData.MobileRequest.Operation NewOperation = new CswNbtCISProNbtMobileData.MobileRequest.Operation(); NewOperation.op = textInfo.ToTitleCase(currentOp[0].ToLower()); string barcodeIn = currentOp[3]; if (false == barcodeIn.StartsWith("C")) { barcodeIn = "C" + barcodeIn; } NewOperation.barcode = barcodeIn; //create an update object CswNbtCISProNbtMobileData.MobileRequest.Update NewUpdate = new CswNbtCISProNbtMobileData.MobileRequest.Update(); NewUpdate.user = currentOp[1]; NewUpdate.location = currentOp[2]; //add update object to the operation object NewOperation.update = NewUpdate; //save the operation object to the collection of operations LegacyOperations.Add(NewOperation); } } else if (DataFormat.reconcilectrlctns == Format) { //iterate through operations and save as objects foreach (string op in ops) { string[] currentOp = op.Split(','); //create an operation object CswNbtCISProNbtMobileData.MobileRequest.Operation NewOperation = new CswNbtCISProNbtMobileData.MobileRequest.Operation(); NewOperation.op = "Reconcile"; string barcodeIn = currentOp[1]; if (false == barcodeIn.StartsWith("C")) { barcodeIn = "C" + barcodeIn; } NewOperation.barcode = barcodeIn; //create an update object CswNbtCISProNbtMobileData.MobileRequest.Update NewUpdate = new CswNbtCISProNbtMobileData.MobileRequest.Update(); NewUpdate.location = currentOp[0]; //add update object to the operation object NewOperation.update = NewUpdate; //save the operation object to the collection of operations LegacyOperations.Add(NewOperation); } } //Add the collection of operations to the data object LegacyData.MultiOpRows = LegacyOperations; //Create a new mobilerequest object and add the data object to it CswNbtCISProNbtMobileData.MobileRequest LegacyMobileDataObj = new CswNbtCISProNbtMobileData.MobileRequest(); LegacyMobileDataObj.data = LegacyData; //Call the action class which makes the batch op CswNbtActUploadLegacyMobileData _CswNbtActUploadLegacyMobileData = new CswNbtActUploadLegacyMobileData((CswNbtResources)CswResources); CswNbtObjClassBatchOp BatchNode = _CswNbtActUploadLegacyMobileData.makeNodesBatch(LegacyMobileDataObj); //Create a JObject to display the tree view in the last step of the wizard JObject ret = new JObject(); if (null != BatchNode) { ret["result"] = 1; CswNbtView BatchOpsView = new CswNbtView((CswNbtResources)CswResources); BatchOpsView.ViewName = "New Batch Operations"; BatchOpsView.ViewMode = CswEnumNbtViewRenderingMode.Tree; CswNbtViewRelationship BatchRel = BatchOpsView.AddViewRelationship(BatchNode.NodeType, false); BatchRel.NodeIdsToFilterIn.Add(BatchNode.NodeId); CswNbtWebServiceTree ws = new CswNbtWebServiceTree((CswNbtResources)CswResources, BatchOpsView); ret["treedata"] = ws.runTree(null, null, false, true, string.Empty); BatchOpsView.SaveToCache(true); ret["sessionviewid"] = BatchOpsView.SessionViewId.ToString(); ret["viewmode"] = BatchOpsView.ViewMode.ToString(); } ReturnObj.Data.TreeData = ret.ToString(); } else { ReturnObj.Data.Error = "The program name is invalid."; } }