//Get Lot Data Details public IEnumerable <LotData> LotDatas() { List <LotData> lotDatas = new List <LotData>(); var conn = new SqlConnection(Properties.Settings.Default.SPConnecting); using (var cmd = conn.CreateCommand()) { cmd.CommandText = "EXEC [StoredProcedureDB].[atom].[sp_get_trans_lots]"; conn.Open(); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { LotData methodLotData = new LotData(); if (!(reader["LotNo"] is DBNull)) { methodLotData.lotNo = reader["LotNo"].ToString(); } if (!(reader["PackageId"] is DBNull)) { methodLotData.packageId = int.Parse(reader["PackageId"].ToString()); } if (!(reader["Package"] is DBNull)) { methodLotData.packageName = reader["Package"].ToString(); } if (!(reader["Device"] is DBNull)) { methodLotData.deviceName = reader["Device"].ToString(); } if (!(reader["StepNo"] is DBNull)) { methodLotData.stepNo = int.Parse(reader["StepNo"].ToString()); } if (!(reader["FlowName"] is DBNull)) { methodLotData.flowName = reader["FlowName"].ToString(); } lotDatas.Add(methodLotData); } conn.Close(); } return(lotDatas); } }
private IResult SetLotAttributes(LotData data, Employee employee, DateTime timestamp, List <AttributeName> attributeNames, Dictionary <AttributeNameKey, IAttributeValueParameters> attributes) { var historyResult = new RecordLotHistoryCommand(_lotUnitOfWork).Execute(data.Lot, timestamp); if (!historyResult.Success) { return(historyResult); } var setValuesResult = new SetLotAttributeValuesCommand(_lotUnitOfWork).Execute(new SetLotAttributesParameters { Employee = employee, TimeStamp = timestamp, AttributeNames = attributeNames, Lot = data.Lot, LotUnarchivedPickedInventoryItems = data.Picked, LotAttributeDefects = data.Lot.AttributeDefects.ToList(), NewAttributes = attributes }); if (!setValuesResult.Success) { return(setValuesResult); } if (data.Lot.ChileLot != null) { var updateStatusResult = LotStatusHelper.UpdateChileLotStatus(data.Lot.ChileLot, attributeNames); if (!updateStatusResult.Success) { return(updateStatusResult); } } data.Lot.EmployeeId = employee.EmployeeId; data.Lot.TimeStamp = timestamp; return(new SuccessResult()); }
private IResult SetLotAttributes(LotData data, DateTime timestamp, AddLotAttributeParameters parameters, Employee user, List <AttributeName> attributeNames) { var lotAttributes = parameters.Attributes.ToDictionary(a => a.Key, a => a.Value); foreach (var attribute in data.Lot.Attributes) { var attributeNameKey = attribute.ToAttributeNameKey(); if (!lotAttributes.ContainsKey(attributeNameKey)) { lotAttributes.Add(attributeNameKey, new AttributeValueParameters { AttributeInfo = new AttributeInfoParameters { Value = attribute.AttributeValue, Date = attribute.AttributeDate } }); } } var setAttributesResult = SetLotAttributes(data, user, timestamp, attributeNames, lotAttributes); if (!setAttributesResult.Success) { return(setAttributesResult); } if (parameters.Parameters.OverrideOldContextLotAsCompleted) { var setStatusResult = new SetLotStatusConductor(_lotUnitOfWork).Execute(timestamp, user, data.Lot.ToLotKey(), LotQualityStatus.Released); if (!setStatusResult.Success) { return(setStatusResult); } } return(new SuccessResult()); }
void SaveFunction() { buildings = GameObject.FindGameObjectsWithTag("Building"); playerData = new PlayerData("PkerkidHD", GameManager.currencySys.getPlyMoney()); XmlWriterSettings xmlWriterSettings = new XmlWriterSettings() { Indent = true, IndentChars = "\t", NewLineOnAttributes = true }; using (XmlWriter xml = XmlWriter.Create(fileLocation, xmlWriterSettings)) { //ROOT xml.WriteStartDocument(); xml.WriteStartElement("SaveData"); //Player Data xml.WriteStartElement("PlayerData"); xml.WriteStartElement("Player"); xml.WriteElementString("PlayerName", playerData.PlayerName); xml.WriteElementString("Money", playerData.Money.ToString()); xml.WriteEndElement(); //Clock Data xml.WriteStartElement("Clock"); xml.WriteElementString("Seconds", GameManager.clockSys.seconds.ToString()); xml.WriteElementString("Minutes", GameManager.clockSys.minutes.ToString()); xml.WriteElementString("Hours", GameManager.clockSys.hours.ToString()); xml.WriteElementString("OldHours", GameManager.clockSys.oldHours.ToString()); xml.WriteElementString("IsAM", GameManager.clockSys.isAm.ToString()); xml.WriteEndElement(); xml.WriteEndElement(); //Building Data xml.WriteStartElement("BuildingData"); for (int i = 0; i < buildings.Length; i++) { buildingData = new BuildingData(buildings[i].name, buildings[i].transform.position.x, buildings[i].transform.position.y, buildings[i].transform.position.z); xml.WriteStartElement("Building"); xml.WriteElementString("Name", buildingData.BlgName); xml.WriteElementString("X", buildingData.X.ToString()); xml.WriteElementString("Y", buildingData.Y.ToString()); xml.WriteElementString("Z", buildingData.Z.ToString()); xml.WriteEndElement(); } xml.WriteEndElement(); //Lot Data xml.WriteStartElement("LotData"); for (int i = 0; i < lots.Length; i++) { if (lots[i].GetComponent<LotSaving>().isBought) { xml.WriteStartElement("Lot"); lotData = new LotData(lots[i].name, true); xml.WriteElementString("Name", lotData.LotName); xml.WriteElementString("Bought", "True"); xml.WriteEndElement(); } } xml.WriteEndElement(); // End. xml.WriteEndElement(); xml.WriteEndDocument(); xml.Flush(); } Debug.Log ("Save Complete"); }