public JsonResult GetWorkTypes(string userName, string password, string domain, string companies, string utcTime, string signatureValue) { ValidateSignature.Check(userName, password, utcTime, signatureValue); using (Axapta ax = AxaptaInstanceContainer.GetInstance(userName, new SecurityHelper().Decrypt(password, true), domain, "")) { List <WorkType> list = new List <WorkType>(); if (companies != null && companies.Length > 0) { using (AxaptaRecord workflowWorkItemTableRecord = ax.CreateAxaptaRecord("WorkflowWorkItemTable")) { using (AxaptaRecord workflowTrackingStatusTableRecord = ax.CreateAxaptaRecord("WorkflowTrackingStatusTable")) { string query = "select RecId from %1 " + "where %1.UserId == curUserId() && %1.Status == WorkflowWorkItemStatus::Pending " + "join DocumentType, ContextTableId, count(RecId) from %2 group by DocumentType, ContextTableId " + "where %1.CorrelationId == %2.CorrelationId " + "&& %2.TrackingStatus == WorkflowTrackingStatus::Pending"; ax.ExecuteStmt(query, workflowWorkItemTableRecord, workflowTrackingStatusTableRecord); string axRecCount = ax.ToString(); while (workflowWorkItemTableRecord.Found == true) { string empty = string.Empty; if (workflowTrackingStatusTableRecord.Found == true) { empty = workflowTrackingStatusTableRecord.get_Field("ContextTableId").ToString(); } if (DataAreaIncluding.Check(empty, companies)) { object contextTableId = workflowTrackingStatusTableRecord.get_Field("ContextTableId"); object documentType = workflowTrackingStatusTableRecord.get_Field("DocumentType"); object recId = workflowTrackingStatusTableRecord.get_Field("RecId"); object tblName = ax.CallStaticClassMethod("Global", "tableId2Name", recId); list.Add(new WorkType() { WorkTypeName = documentType.ToString(), WorkTypeCount = Convert.ToInt32(recId) }); workflowWorkItemTableRecord.Next(); } } } } } return(Json(list, JsonRequestBehavior.AllowGet)); } }
public List <IntershopWebService.SizeStock> getItemDims(string itemId, string company) { List <IntershopWebService.SizeStock> sizeStockList = new List <IntershopWebService.SizeStock>(); Axapta axapta = (Axapta)null; try { axapta = this.axLogon(company); string str = "select * from %1 where %1.ItemId == '" + itemId + "'"; AxaptaRecord axaptaRecord = axapta.CreateAxaptaRecord("InventSize"); axaptaRecord.ExecuteStmt(str); while (axaptaRecord.Found) { IntershopWebService.SizeStock sizeStock = new IntershopWebService.SizeStock(); if (Convert.ToBoolean(axaptaRecord.get_Field("Color"))) { sizeStock.color = Convert.ToString(axaptaRecord.get_Field("InventSizeId")); } else { sizeStock.size = Convert.ToString(axaptaRecord.get_Field("InventSizeId")); } sizeStockList.Add(sizeStock); axaptaRecord.Next(); } return(sizeStockList); } catch (Exception ex) { MessageLogger.info(string.Format("getItemDims(itemId={0}, company={1} -> error: {2})", itemId, company, ex.Message)); return((List <IntershopWebService.SizeStock>)null); } finally { axapta.Logoff(); } }
public List<Address> getListOfAdresses() { Addresses addresses = new Addresses(); // The AddressState field names for calls to // the AxRecord.get_field method. string strNameField = "NAME"; string strStateIdField = "STATEID"; string strRecIdField = "RecId"; // The output variables for calls to the // AxRecord.get_Field method. string fieldName, fieldStateId, recId; try { AxLogon(); // Create a query using the AxaptaRecord class // for the StateAddress table. using (axRecord = ax.CreateAxaptaRecord(tableName)) { // Execute the query on the table. string stmt = "select * from %1"; axRecord.ExecuteStmt(stmt); // Loop through the set of retrieved records. while (axRecord.Found) { // Retrieve the record data for the specified fields. fieldName = (String)axRecord.get_Field(strNameField); fieldStateId = (String)axRecord.get_Field(strStateIdField); recId = axRecord.get_Field(strRecIdField).ToString(); if (!String.IsNullOrEmpty(fieldName) && !String.IsNullOrEmpty(fieldStateId) && !String.IsNullOrEmpty(recId)) { Address address = new Address(); address.Name = fieldName; address.StateId = fieldStateId; address.recId = recId; addresses.Add(address); } // Advance to the next row. axRecord.Next(); } } ax.Logoff(); } catch (Exception e) { throw (e); } finally { ax.Logoff(); } return addresses; }
public List <Address> getListOfAdresses() { Addresses addresses = new Addresses(); // The AddressState field names for calls to // the AxRecord.get_field method. string strNameField = "NAME"; string strStateIdField = "STATEID"; string strRecIdField = "RecId"; // The output variables for calls to the // AxRecord.get_Field method. string fieldName, fieldStateId, recId; try { AxLogon(); // Create a query using the AxaptaRecord class // for the StateAddress table. using (axRecord = ax.CreateAxaptaRecord(tableName)) { // Execute the query on the table. string stmt = "select * from %1"; axRecord.ExecuteStmt(stmt); // Loop through the set of retrieved records. while (axRecord.Found) { // Retrieve the record data for the specified fields. fieldName = (String)axRecord.get_Field(strNameField); fieldStateId = (String)axRecord.get_Field(strStateIdField); recId = axRecord.get_Field(strRecIdField).ToString(); if (!String.IsNullOrEmpty(fieldName) && !String.IsNullOrEmpty(fieldStateId) && !String.IsNullOrEmpty(recId)) { Address address = new Address(); address.Name = fieldName; address.StateId = fieldStateId; address.recId = recId; addresses.Add(address); } // Advance to the next row. axRecord.Next(); } } ax.Logoff(); } catch (Exception e) { throw (e); } finally { ax.Logoff(); } return(addresses); }