public void LoadDelete() { Delete e = new Delete(); if (DeleteID == 0) { imgDelete.ImageUrl = "none"; } else { e = DeleteBLL.Get(DeleteID); imgDelete.ImageUrl = BarcodeBLL.Url4Delete(e.ID); } txtNote.Text = e.Note; if (e.Date != null) txtDate.Text = e.Date.ToStringVN_Hour(); GridViewPack.DataBind(); urlPrint.NavigateUrl = ResolveClientUrl(string.Format("~/Rpt/_604?DeleteID={0}", e.ID)); CurrentDIN = ""; imgCurrentDIN.ImageUrl = "none"; GridViewSum.DataBind(); }
public void Delete_SimpleSqlCheck() { SubSonic.SqlQuery q = new Delete().From(Region.Schema).Where("regiondescription").IsEqualTo("Test"); string sql = q.BuildSqlStatement(); //Assert.Fail("sql = " + sql); Assert.IsTrue(sql == "DELETE FROM `main`.`Region` WHERE `main`.`Region`.`RegionDescription` = @RegionDescription0\r\n"); }
/// <summary> /// 生成Truncate语句 /// </summary> /// <param name="deleteObject"></param> /// <param name="command"></param> public static void TranslatorIntoTruncate(Delete delete, SqlCommand command) { StringBuilder truncateString = new StringBuilder(); truncateString.Append(baseTruncate); truncateString.Append(delete.TableName); command.CommandText = truncateString.ToString(); }
public void LoadDelete() { Delete e = new Delete(); if (DeleteID == 0) { imgOrder.ImageUrl = "none"; btnOk.Enabled = true; } else { e = DeleteBLL.Get(DeleteID); imgOrder.ImageUrl = BarcodeBLL.Url4Delete(e.ID); btnOk.Enabled = false; } txtNote.Text = e.Note; txtDate.Text = e.Date.ToStringVN_Hour(); PackList = e.Packs.Select(r => r.ID).ToList(); GridViewPack.DataBind(); CurrentDIN = ""; imgCurrentDIN.ImageUrl = "none"; urlPrint.NavigateUrl = ResolveClientUrl(string.Format("~/Store/PrintDelete.aspx?DeleteID={0}", e.ID)); GridViewSum.DataBind(); }
public void LoadDelete() { Delete e = new Delete(); if (DeleteID == 0) { imgOrder.ImageUrl = "none"; btnOk.Enabled = true; } else { e = DeleteBLL.Get(DeleteID); imgOrder.ImageUrl = BarcodeBLL.Url4Delete(e.ID); btnOk.Enabled = false; } txtNote.Text = e.Note; txtDate.Text = e.Date.ToStringVN_Hour(); PackList = e.Packs.Select(r => r.ID).ToList(); GridViewPack.DataBind(); CurrentDIN = ""; imgCurrentDIN.ImageUrl = "none"; }
protected void OnDeleteOrder(object sender, EventArgs arg) { CalendarItem item = (CalendarItem)sender; Delete winDelete = new Delete(); if (winDelete.RunDeletion("orders", item.id)) item.Calendar.RefreshOrders(); }
// reference to child table? public void Delete(Delete value) { WithConnection( c => { value.ExecuteNonQuery(c); } ); }
// GET: /Student/Delete/5 public async Task<ActionResult> Delete(Delete.Query query) { var student = await _mediator.SendAsync(query); if (student == null) { return HttpNotFound(); } return View(student); }
public void Delete(Delete AppSnapshotKey) { Console.WriteLine("Delete"); WithConnection( c => { AppSnapshotKey.ExecuteNonQuery(c); } ); }
/// <summary> /// 生成Delete语句 /// </summary> /// <param name="deleteObject"></param> /// <param name="command"></param> public static void TranslateIntoDelete(Delete delete, SqlCommand command) { StringBuilder deleteString = new StringBuilder(); deleteString.Append(baseDelete); deleteString.Append(delete.TableName); TranslateHelper.GetCriterionString(deleteString, delete.Criterions, command, delete.SqlOperator); command.CommandText = deleteString.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strParamID = Request["DeleteID"]; if (!string.IsNullOrEmpty(strParamID)) { delete = DeleteBLL.Get(strParamID.ToInt()); if (delete != null) { LabelTitle1.Text = "BIÊN BẢN HỦY MÁU"; LoadOrder(); RedBloodDataContext db = new RedBloodDataContext(); //var v1 = db.Packs.Where(r => r.DeleteID.Value == delete.ID).ToList(); var v1 = db.PackDeletes.Where(r => r.DeleteID == delete.ID).Select(r => new { r.Pack, r.Note }).ToList(); var v = v1.GroupBy(r => r.Pack.ProductCode) .Select(r => new { ProductCode = r.Key, ProductDesc = ProductBLL.GetDesc(r.Key), Sum = r.Count(), BloodGroupSumary = r.GroupBy(r1 => r1.Pack.Donation.BloodGroup).Select(r1 => new { BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Key), Total = r1.Count(), VolumeSumary = r1.GroupBy(r2 => r2.Pack.Volume).Select(r2 => new { Volume = r2.Key.HasValue ? r2.Key.Value.ToString() : "_", Total = r2.Count(), //DINList = r2.Select(r3 => new { DIN = r3.DIN }).OrderBy(r4 => r4.DIN), NoteSummary = r2.GroupBy(r3 => r3.Note).Select(r3 => new { Note = r3.Key, DINList = r3.Select(r4 => new { DIN = r4.Pack.DIN }).OrderBy(r4 => r4.DIN), }).OrderBy(r3 => r3.Note), }).OrderBy(r2 => r2.Volume) }).OrderBy(r1 => r1.BloodGroupDesc), }); GridViewSum.DataSource = v; GridViewSum.DataBind(); LableCount.Text = v1.Count().ToStringRemoveZero(); } } } }
public void Delete_Simple() { //insert a test product Region r = new Region(); r.RegionDescription = "Test"; r.Save("test"); //delete it int records = new Delete().From(Region.Schema).Where("regiondescription").IsEqualTo("Test").Execute(); Assert.IsTrue(records == 1); }
public static int Add(List<Guid> packIDList, string note) { RedBloodDataContext db = new RedBloodDataContext(); List<Pack> poL = PackBLL.Get4Delete(db, packIDList); Delete re = new Delete(); re.Note = note; db.Deletes.InsertOnSubmit(re); db.SubmitChanges(); foreach (var item in packIDList) { PackBLL.Delete(re.ID, item, note); } return re.ID; }
public static int Add(List<Guid> packIDList, string note) { RedBloodDataContext db = new RedBloodDataContext(); List<Pack> poL = PackBLL.Get4Delete(db, packIDList); if (poL.Count == 0) throw new Exception("Không có túi máu để hủy."); Delete re = new Delete(); re.Note = note; re.Actor = RedBloodSystem.CurrentActor; db.Deletes.InsertOnSubmit(re); db.SubmitChanges(); foreach (var item in poL) { PackDeleteBLL.Add(re.ID, item.ID); } return re.ID; }
public IHttpActionResult Delete(Delete.Command command) { _mediator.Send(command); return Ok(); }
public override void Down() { Delete.Schema(DataConstants.Schemas.Catalog); }
public string[] Delete(Delete request) { var response = base.SendRequest<ScreenIds>("screen.delete", request); return response.screenids; }
public static InstructionCollection Parse(Stream input, long instructionsPosition) { var instructions = new SortedList <int, InstructionBase>(); using (var helper = new InstructionParseHelper(input, instructionsPosition)) { var reader = helper.GetReader(); while (helper.CanParse(instructions)) { //now reader the instructions var instructionPosition = helper.CurrentPosition; var type = reader.ReadByteAsEnum <InstructionType>(); var requireAlignment = InstructionAlignment.IsAligned(type); if (requireAlignment) { reader.Align(4); } InstructionBase instruction = null; var parameters = new List <Value>(); switch (type) { case InstructionType.ToNumber: instruction = new ToNumber(); break; case InstructionType.NextFrame: instruction = new NextFrame(); break; case InstructionType.Play: instruction = new Play(); break; case InstructionType.Stop: instruction = new Stop(); break; case InstructionType.Add: instruction = new Add(); break; case InstructionType.Subtract: instruction = new Subtract(); break; case InstructionType.Multiply: instruction = new Multiply(); break; case InstructionType.Divide: instruction = new Divide(); break; case InstructionType.Not: instruction = new Not(); break; case InstructionType.StringEquals: instruction = new StringEquals(); break; case InstructionType.Pop: instruction = new Pop(); break; case InstructionType.ToInteger: instruction = new ToInteger(); break; case InstructionType.GetVariable: instruction = new GetVariable(); break; case InstructionType.SetVariable: instruction = new SetVariable(); break; case InstructionType.StringConcat: instruction = new StringConcat(); break; case InstructionType.GetProperty: instruction = new GetProperty(); break; case InstructionType.SetProperty: instruction = new SetProperty(); break; case InstructionType.Trace: instruction = new Trace(); break; case InstructionType.Random: instruction = new RandomNumber(); break; case InstructionType.Delete: instruction = new Delete(); break; case InstructionType.Delete2: instruction = new Delete2(); break; case InstructionType.DefineLocal: instruction = new DefineLocal(); break; case InstructionType.CallFunction: instruction = new CallFunction(); break; case InstructionType.Return: instruction = new Return(); break; case InstructionType.NewObject: instruction = new NewObject(); break; case InstructionType.InitArray: instruction = new InitArray(); break; case InstructionType.InitObject: instruction = new InitObject(); break; case InstructionType.TypeOf: instruction = new TypeOf(); break; case InstructionType.Add2: instruction = new Add2(); break; case InstructionType.LessThan2: instruction = new LessThan2(); break; case InstructionType.Equals2: instruction = new Equals2(); break; case InstructionType.ToString: instruction = new ToString(); break; case InstructionType.PushDuplicate: instruction = new PushDuplicate(); break; case InstructionType.GetMember: instruction = new GetMember(); break; case InstructionType.SetMember: instruction = new SetMember(); break; case InstructionType.Increment: instruction = new Increment(); break; case InstructionType.Decrement: instruction = new Decrement(); break; case InstructionType.CallMethod: instruction = new CallMethod(); break; case InstructionType.Enumerate2: instruction = new Enumerate2(); break; case InstructionType.EA_PushThis: instruction = new PushThis(); break; case InstructionType.EA_PushZero: instruction = new PushZero(); break; case InstructionType.EA_PushOne: instruction = new PushOne(); break; case InstructionType.EA_CallFunc: instruction = new CallFunc(); break; case InstructionType.EA_CallMethodPop: instruction = new CallMethodPop(); break; case InstructionType.BitwiseXOr: instruction = new BitwiseXOr(); break; case InstructionType.Greater: instruction = new Greater(); break; case InstructionType.EA_PushThisVar: instruction = new PushThisVar(); break; case InstructionType.EA_PushGlobalVar: instruction = new PushGlobalVar(); break; case InstructionType.EA_ZeroVar: instruction = new ZeroVar(); break; case InstructionType.EA_PushTrue: instruction = new PushTrue(); break; case InstructionType.EA_PushFalse: instruction = new PushFalse(); break; case InstructionType.EA_PushNull: instruction = new PushNull(); break; case InstructionType.EA_PushUndefined: instruction = new PushUndefined(); break; case InstructionType.GotoFrame: instruction = new GotoFrame(); parameters.Add(Value.FromInteger(reader.ReadInt32())); break; case InstructionType.GetURL: instruction = new GetUrl(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.SetRegister: instruction = new SetRegister(); parameters.Add(Value.FromInteger(reader.ReadInt32())); break; case InstructionType.ConstantPool: { instruction = new ConstantPool(); var count = reader.ReadUInt32(); var constants = reader.ReadFixedSizeArrayAtOffset <uint>(() => reader.ReadUInt32(), count); foreach (var constant in constants) { parameters.Add(Value.FromConstant(constant)); } } break; case InstructionType.GotoLabel: instruction = new GotoLabel(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.DefineFunction2: { instruction = new DefineFunction2(); var name = reader.ReadStringAtOffset(); var nParams = reader.ReadUInt32(); var nRegisters = reader.ReadByte(); var flags = reader.ReadUInt24(); //list of parameter strings var paramList = reader.ReadFixedSizeListAtOffset <FunctionArgument>(() => new FunctionArgument() { Register = reader.ReadInt32(), Parameter = reader.ReadStringAtOffset(), }, nParams); parameters.Add(Value.FromString(name)); parameters.Add(Value.FromInteger((int)nParams)); parameters.Add(Value.FromInteger((int)nRegisters)); parameters.Add(Value.FromInteger((int)flags)); foreach (var param in paramList) { parameters.Add(Value.FromInteger(param.Register)); parameters.Add(Value.FromString(param.Parameter)); } //body size of the function parameters.Add(Value.FromInteger(reader.ReadInt32())); //skip 8 bytes reader.ReadUInt64(); } break; case InstructionType.PushData: { instruction = new PushData(); var count = reader.ReadUInt32(); var constants = reader.ReadFixedSizeArrayAtOffset <uint>(() => reader.ReadUInt32(), count); foreach (var constant in constants) { parameters.Add(Value.FromConstant(constant)); } } break; case InstructionType.BranchAlways: { instruction = new BranchAlways(); var offset = reader.ReadInt32(); parameters.Add(Value.FromInteger(offset)); helper.ReportBranchOffset(offset); } break; case InstructionType.GetURL2: instruction = new GetUrl2(); break; case InstructionType.DefineFunction: { instruction = new DefineFunction(); var name = reader.ReadStringAtOffset(); //list of parameter strings var paramList = reader.ReadListAtOffset <string>(() => reader.ReadStringAtOffset()); parameters.Add(Value.FromString(name)); parameters.Add(Value.FromInteger(paramList.Count)); foreach (var param in paramList) { parameters.Add(Value.FromString(param)); } //body size of the function parameters.Add(Value.FromInteger(reader.ReadInt32())); //skip 8 bytes reader.ReadUInt64(); } break; case InstructionType.BranchIfTrue: { instruction = new BranchIfTrue(); var offset = reader.ReadInt32(); parameters.Add(Value.FromInteger(offset)); helper.ReportBranchOffset(offset); } break; case InstructionType.GotoFrame2: instruction = new GotoFrame2(); parameters.Add(Value.FromInteger(reader.ReadByte())); break; case InstructionType.EA_PushString: instruction = new PushString(); //the constant id that should be pushed parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_PushConstantByte: instruction = new PushConstantByte(); //the constant id that should be pushed parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_GetStringVar: instruction = new GetStringVar(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_SetStringVar: instruction = new SetStringVar(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_GetStringMember: instruction = new GetStringMember(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_SetStringMember: instruction = new SetStringMember(); parameters.Add(Value.FromString(reader.ReadStringAtOffset())); break; case InstructionType.EA_PushValueOfVar: instruction = new PushValueOfVar(); //the constant id that should be pushed parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_GetNamedMember: instruction = new GetNamedMember(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_CallNamedFuncPop: instruction = new CallNamedFuncPop(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_CallNamedFunc: instruction = new CallNamedFunc(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_CallNamedMethodPop: instruction = new CallNamedMethodPop(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.EA_PushFloat: instruction = new PushFloat(); parameters.Add(Value.FromFloat(reader.ReadSingle())); break; case InstructionType.EA_PushByte: instruction = new PushByte(); parameters.Add(Value.FromInteger(reader.ReadByte())); break; case InstructionType.EA_PushShort: instruction = new PushShort(); parameters.Add(Value.FromInteger(reader.ReadUInt16())); break; case InstructionType.End: instruction = new End(); break; case InstructionType.EA_CallNamedMethod: instruction = new CallNamedMethod(); parameters.Add(Value.FromConstant(reader.ReadByte())); break; case InstructionType.Var: instruction = new Var(); break; case InstructionType.EA_PushRegister: instruction = new PushRegister(); parameters.Add(Value.FromInteger(reader.ReadByte())); break; case InstructionType.EA_PushConstantWord: instruction = new PushConstantWord(); parameters.Add(Value.FromConstant(reader.ReadUInt16())); break; case InstructionType.EA_CallFuncPop: instruction = new CallFunctionPop(); break; case InstructionType.StrictEqual: instruction = new StrictEquals(); break; default: throw new InvalidDataException("Unimplemented bytecode instruction:" + type.ToString()); } if (instruction != null) { instruction.Parameters = parameters; instructions.Add(instructionPosition, instruction); } } } return(new InstructionCollection(instructions)); }
public override void Down() { Delete.Column("UploadNotes").FromTable("PRF_FeedingSource"); }
public void Execute(IArray paramvalues, ITrackCancel trackcancel, IGPEnvironmentManager envMgr, IGPMessages messages) { // Remember the original GP environment settings and temporarily override these settings var gpSettings = envMgr as IGeoProcessorSettings; bool origAddOutputsToMapSetting = gpSettings.AddOutputsToMap; bool origLogHistorySetting = gpSettings.LogHistory; gpSettings.AddOutputsToMap = false; gpSettings.LogHistory = false; // Create the Geoprocessor Geoprocessor gp = new Geoprocessor(); try { // Validate our values IGPMessages validateMessages = ((IGPFunction2)this).Validate(paramvalues, false, envMgr); if ((validateMessages as IGPMessage).IsError()) { messages.AddError(1, "Validate failed"); return; } // Unpack values IGPParameter gpParam = paramvalues.get_Element(InputMtdDSTTable) as IGPParameter; IGPValue inputMtdDSTTableValue = m_gpUtils.UnpackGPValue(gpParam); gpParam = paramvalues.get_Element(InputMtdCntryRefTable) as IGPParameter; IGPValue inputMtdCntryRefTableValue = m_gpUtils.UnpackGPValue(gpParam); gpParam = paramvalues.get_Element(InputMtdAreaTable) as IGPParameter; IGPValue inputMtdAreaTableValue = m_gpUtils.UnpackGPValue(gpParam); gpParam = paramvalues.get_Element(InputAdminBndyFeatureClasses) as IGPParameter; var inputAdminBndyFeatureClassesMultiValue = m_gpUtils.UnpackGPValue(gpParam) as IGPMultiValue; gpParam = paramvalues.get_Element(OutputFileGDB) as IGPParameter; IGPValue outputFileGDBValue = m_gpUtils.UnpackGPValue(gpParam); gpParam = paramvalues.get_Element(InputStreetsFeatureClass) as IGPParameter; IGPValue inputStreetsFeatureClassValue = m_gpUtils.UnpackGPValue(gpParam); gpParam = paramvalues.get_Element(InputTimeZoneIDBaseFieldName) as IGPParameter; IGPValue inputTimeZoneIDBaseFieldNameValue = m_gpUtils.UnpackGPValue(gpParam); bool processStreetsFC = (!(inputStreetsFeatureClassValue.IsEmpty())); string timeZoneIDBaseFieldName = ""; if (!(inputTimeZoneIDBaseFieldNameValue.IsEmpty())) timeZoneIDBaseFieldName = inputTimeZoneIDBaseFieldNameValue.GetAsText(); // Get the path to the output file GDB string outputFileGdbPath = outputFileGDBValue.GetAsText(); // Create the new file geodatabase AddMessage("Creating the file geodatabase...", messages, trackcancel); int lastBackslash = outputFileGdbPath.LastIndexOf("\\"); CreateFileGDB createFGDBTool = new CreateFileGDB(); createFGDBTool.out_folder_path = outputFileGdbPath.Remove(lastBackslash); createFGDBTool.out_name = outputFileGdbPath.Substring(lastBackslash + 1); gp.Execute(createFGDBTool, trackcancel); // Copy the MtdDST table to the file geodatabase and add the ADMIN_LVL and AREACODE fields to it AddMessage("Copying the MtdDST table to the file geodatabase...", messages, trackcancel); TableToTable importTableTool = new TableToTable(); string inputMtdDSTTablePath = inputMtdDSTTableValue.GetAsText(); importTableTool.in_rows = inputMtdDSTTablePath; importTableTool.out_path = outputFileGdbPath; importTableTool.out_name = "MtdDST"; importTableTool.field_mapping = "AREA_ID \"AREA_ID\" true true false 4 Long 0 0 ,First,#," + inputMtdDSTTablePath + ",AREA_ID,-1,-1;" + "TIME_ZONE \"TIME_ZONE\" true true false 4 Text 0 0 ,First,#," + inputMtdDSTTablePath + ",TIME_ZONE,-1,-1;" + "DST_EXIST \"DST_EXIST\" true true false 1 Text 0 0 ,First,#," + inputMtdDSTTablePath + ",DST_EXIST,-1,-1"; gp.Execute(importTableTool, trackcancel); string mtdDSTTablePath = outputFileGdbPath + "\\MtdDST"; AddField addFieldTool = new AddField(); addFieldTool.in_table = mtdDSTTablePath; addFieldTool.field_name = "ADMIN_LVL"; addFieldTool.field_type = "SHORT"; gp.Execute(addFieldTool, trackcancel); addFieldTool = new AddField(); addFieldTool.in_table = mtdDSTTablePath; addFieldTool.field_name = "AREACODE"; addFieldTool.field_type = "TEXT"; addFieldTool.field_length = 76; gp.Execute(addFieldTool, trackcancel); // Copy the MtdArea table to the file geodatabase and index the AREA_ID field AddMessage("Copying the MtdArea table to the file geodatabase...", messages, trackcancel); importTableTool = new TableToTable(); importTableTool.in_rows = inputMtdAreaTableValue.GetAsText(); importTableTool.out_path = outputFileGdbPath; importTableTool.out_name = "MtdArea"; gp.Execute(importTableTool, trackcancel); string mtdAreaTablePath = outputFileGdbPath + "\\MtdArea"; AddIndex addIndexTool = new AddIndex(); addIndexTool.in_table = mtdAreaTablePath; addIndexTool.fields = "AREA_ID"; addIndexTool.index_name = "AREA_ID"; gp.Execute(addIndexTool, trackcancel); // Calculate the ADMIN_LVL and AREACODE fields on the MtdDST table MakeTableView makeTableViewTool = new MakeTableView(); makeTableViewTool.in_table = mtdDSTTablePath; makeTableViewTool.out_view = "MtdDST_Layer"; gp.Execute(makeTableViewTool, trackcancel); AddJoin addJoinTool = new AddJoin(); addJoinTool.in_layer_or_view = "MtdDST_Layer"; addJoinTool.in_field = "AREA_ID"; addJoinTool.join_table = mtdAreaTablePath; addJoinTool.join_field = "AREA_ID"; addJoinTool.join_type = "KEEP_COMMON"; gp.Execute(addJoinTool, trackcancel); AddMessage("Calculating the ADMIN_LVL field...", messages, trackcancel); CalculateField calcFieldTool = new CalculateField(); calcFieldTool.in_table = "MtdDST_Layer"; calcFieldTool.field = "MtdDST.ADMIN_LVL"; calcFieldTool.expression = "[MtdArea.ADMIN_LVL]"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); AddMessage("Calculating the AREACODE field...", messages, trackcancel); calcFieldTool = new CalculateField(); calcFieldTool.in_table = "MtdDST_Layer"; calcFieldTool.field = "MtdDST.AREACODE"; calcFieldTool.code_block = "lvl = [MtdArea.ADMIN_LVL]\n" + "s = CStr([MtdArea.AREACODE_1])\n" + "If lvl >= 2 Then s = s & \".\" & CStr([MtdArea.AREACODE_2])\n" + "If lvl >= 3 Then s = s & \".\" & CStr([MtdArea.AREACODE_3])\n" + "If lvl >= 4 Then s = s & \".\" & CStr([MtdArea.AREACODE_4])\n" + "If lvl >= 5 Then s = s & \".\" & CStr([MtdArea.AREACODE_5])\n" + "If lvl >= 6 Then s = s & \".\" & CStr([MtdArea.AREACODE_6])\n" + "If lvl >= 7 Then s = s & \".\" & CStr([MtdArea.AREACODE_7])"; calcFieldTool.expression = "s"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); RemoveJoin removeJoinTool = new RemoveJoin(); removeJoinTool.in_layer_or_view = "MtdDST_Layer"; removeJoinTool.join_name = "MtdArea"; gp.Execute(removeJoinTool, trackcancel); Delete deleteTool = new Delete(); deleteTool.in_data = "MtdDST_Layer"; gp.Execute(deleteTool, trackcancel); // Create the MtdDST# tables by admin levels and index the AREACODE field TableSelect tableSelectTool = null; for (int i = 1; i <= 7; i++) { string iAsString = Convert.ToString(i, System.Globalization.CultureInfo.InvariantCulture); AddMessage("Extracting level " + iAsString + " MtdDST rows...", messages, trackcancel); tableSelectTool = new TableSelect(); tableSelectTool.in_table = mtdDSTTablePath; tableSelectTool.out_table = mtdDSTTablePath + iAsString; tableSelectTool.where_clause = "ADMIN_LVL = " + iAsString; gp.Execute(tableSelectTool, trackcancel); addIndexTool = new AddIndex(); addIndexTool.in_table = mtdDSTTablePath + iAsString; addIndexTool.fields = "AREACODE"; addIndexTool.index_name = "AREACODE"; gp.Execute(addIndexTool, trackcancel); } deleteTool = new Delete(); deleteTool.in_data = mtdDSTTablePath; gp.Execute(deleteTool, trackcancel); // Copy the MtdCntryRef table to the file geodatabase (use Statistics tool to remove duplicate rows) AddMessage("Copying the MtdCntryRef table to the file geodatabase...", messages, trackcancel); string inputMtdCntryRefTablePath = inputMtdCntryRefTableValue.GetAsText(); string mtdCntryRefTablePath = outputFileGdbPath + "\\MtdCntryRef"; Statistics statsTool = new Statistics(); statsTool.in_table = inputMtdCntryRefTablePath; statsTool.out_table = mtdCntryRefTablePath; statsTool.statistics_fields = "ISO_CODE COUNT"; statsTool.case_field = "GOVT_CODE;ISO_CODE;DRIVING_SD;ADMINLEVEL"; gp.Execute(statsTool, trackcancel); DeleteField deleteFieldTool = new DeleteField(); deleteFieldTool.in_table = mtdCntryRefTablePath; deleteFieldTool.drop_field = "FREQUENCY;COUNT_ISO_CODE"; gp.Execute(deleteFieldTool, trackcancel); // Index the GOVT_CODE field addIndexTool = new AddIndex(); addIndexTool.in_table = mtdCntryRefTablePath; addIndexTool.fields = "GOVT_CODE"; addIndexTool.index_name = "GOVT_CODE"; gp.Execute(addIndexTool, trackcancel); // Extract the top level (country) records from the MtdArea table and index the AREACODE_1 field AddMessage("Extracting the top-level rows from the MtdArea table...", messages, trackcancel); string mtdTopAreaTablePath = outputFileGdbPath + "\\TopArea"; tableSelectTool = new TableSelect(); tableSelectTool.in_table = mtdAreaTablePath; tableSelectTool.out_table = mtdTopAreaTablePath; tableSelectTool.where_clause = "AREACODE_2 = 0 AND AREA_TYPE = 'B'"; gp.Execute(tableSelectTool, trackcancel); addIndexTool = new AddIndex(); addIndexTool.in_table = mtdTopAreaTablePath; addIndexTool.fields = "AREACODE_1"; addIndexTool.index_name = "AREACODE_1"; gp.Execute(addIndexTool, trackcancel); // Create and calculate the TOP_GOVT_CODE field on the MtdArea table addFieldTool = new AddField(); addFieldTool.in_table = mtdAreaTablePath; addFieldTool.field_name = "TOP_GOVT_CODE"; addFieldTool.field_type = "LONG"; gp.Execute(addFieldTool, trackcancel); makeTableViewTool = new MakeTableView(); makeTableViewTool.in_table = mtdAreaTablePath; makeTableViewTool.out_view = "MtdArea_Layer"; gp.Execute(makeTableViewTool, trackcancel); addJoinTool = new AddJoin(); addJoinTool.in_layer_or_view = "MtdArea_Layer"; addJoinTool.in_field = "AREACODE_1"; addJoinTool.join_table = mtdTopAreaTablePath; addJoinTool.join_field = "AREACODE_1"; addJoinTool.join_type = "KEEP_COMMON"; gp.Execute(addJoinTool, trackcancel); AddMessage("Calculating the TOP_GOVT_CODE field...", messages, trackcancel); calcFieldTool = new CalculateField(); calcFieldTool.in_table = "MtdArea_Layer"; calcFieldTool.field = "MtdArea.TOP_GOVT_CODE"; calcFieldTool.expression = "[TopArea.GOVT_CODE]"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); removeJoinTool = new RemoveJoin(); removeJoinTool.in_layer_or_view = "MtdArea_Layer"; removeJoinTool.join_name = "TopArea"; gp.Execute(removeJoinTool, trackcancel); deleteTool = new Delete(); deleteTool.in_data = mtdTopAreaTablePath; gp.Execute(deleteTool, trackcancel); // Create and calculate the ISO_CODE and DRIVING_SD string fields addFieldTool = new AddField(); addFieldTool.in_table = mtdAreaTablePath; addFieldTool.field_name = "ISO_CODE"; addFieldTool.field_type = "TEXT"; addFieldTool.field_length = 3; gp.Execute(addFieldTool, trackcancel); addFieldTool = new AddField(); addFieldTool.in_table = mtdAreaTablePath; addFieldTool.field_name = "DRIVING_SD"; addFieldTool.field_type = "TEXT"; addFieldTool.field_length = 1; gp.Execute(addFieldTool, trackcancel); addJoinTool = new AddJoin(); addJoinTool.in_layer_or_view = "MtdArea_Layer"; addJoinTool.in_field = "TOP_GOVT_CODE"; addJoinTool.join_table = mtdCntryRefTablePath; addJoinTool.join_field = "GOVT_CODE"; addJoinTool.join_type = "KEEP_COMMON"; gp.Execute(addJoinTool, trackcancel); AddMessage("Calculating the ISO_CODE field...", messages, trackcancel); calcFieldTool = new CalculateField(); calcFieldTool.in_table = "MtdArea_Layer"; calcFieldTool.field = "MtdArea.ISO_CODE"; calcFieldTool.expression = "[MtdCntryRef.ISO_CODE]"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); AddMessage("Calculating the DRIVING_SD field...", messages, trackcancel); calcFieldTool = new CalculateField(); calcFieldTool.in_table = "MtdArea_Layer"; calcFieldTool.field = "MtdArea.DRIVING_SD"; calcFieldTool.expression = "[MtdCntryRef.DRIVING_SD]"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); removeJoinTool = new RemoveJoin(); removeJoinTool.in_layer_or_view = "MtdArea_Layer"; removeJoinTool.join_name = "MtdCntryRef"; gp.Execute(removeJoinTool, trackcancel); // Create and calculate the FullAREACODE# string fields and the UTCOffset and DST fields addFieldTool = new AddField(); addFieldTool.in_table = mtdAreaTablePath; addFieldTool.field_type = "SHORT"; addFieldTool.field_name = "UTCOffset"; gp.Execute(addFieldTool, trackcancel); addFieldTool.field_name = "DST"; gp.Execute(addFieldTool, trackcancel); string codeBlock = "lvl = [ADMIN_LVL]\ns = CStr([AREACODE_1])"; for (int i = 1; i <= 7; i++) { string iAsString = Convert.ToString(i, System.Globalization.CultureInfo.InvariantCulture); string iPlusOne = Convert.ToString(i+1, System.Globalization.CultureInfo.InvariantCulture); string fullAreaCodeFieldName = "FullAREACODE" + iAsString; addFieldTool = new AddField(); addFieldTool.in_table = mtdAreaTablePath; addFieldTool.field_name = fullAreaCodeFieldName; addFieldTool.field_type = "TEXT"; addFieldTool.field_length = 76; gp.Execute(addFieldTool, trackcancel); AddMessage("Calculating the FullAREACODE" + iAsString + " field...", messages, trackcancel); calcFieldTool = new CalculateField(); calcFieldTool.in_table = mtdAreaTablePath; calcFieldTool.field = fullAreaCodeFieldName; calcFieldTool.code_block = codeBlock; calcFieldTool.expression = "s"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); codeBlock = codeBlock + "\nIf lvl >= " + iPlusOne + " Then s = s & \".\" & CStr([AREACODE_" + iPlusOne + "])"; string dstJoinTableName = "MtdDST" + iAsString; string dstJoinTablePath = outputFileGdbPath + "\\" + dstJoinTableName; addJoinTool = new AddJoin(); addJoinTool.in_layer_or_view = "MtdArea_Layer"; addJoinTool.in_field = fullAreaCodeFieldName; addJoinTool.join_table = dstJoinTablePath; addJoinTool.join_field = "AREACODE"; addJoinTool.join_type = "KEEP_COMMON"; gp.Execute(addJoinTool, trackcancel); AddMessage("Calculating the UTCOffset field (" + iAsString + " of 7)...", messages, trackcancel); calcFieldTool = new CalculateField(); calcFieldTool.in_table = "MtdArea_Layer"; calcFieldTool.field = "MtdArea.UTCOffset"; calcFieldTool.code_block = "s = [MtdArea.UTCOffset]\n" + "joinValue = [" + dstJoinTableName + ".TIME_ZONE]\n" + "If Not IsNull(joinValue) Then\n" + " If Trim(joinValue) <> \"\" Then s = CInt(joinValue) * 6\n" + "End If"; calcFieldTool.expression = "s"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); AddMessage("Calculating the DST field (" + iAsString + " of 7)...", messages, trackcancel); calcFieldTool = new CalculateField(); calcFieldTool.in_table = "MtdArea_Layer"; calcFieldTool.field = "MtdArea.DST"; calcFieldTool.code_block = "s = [MtdArea.DST]\n" + "joinValue = [" + dstJoinTableName + ".DST_EXIST]\n" + "If Not IsNull(joinValue) Then\n" + " Select Case Trim(joinValue)\n" + " Case \"Y\": s = 1\n Case \"N\": s = 0\n" + " End Select\n" + "End If"; calcFieldTool.expression = "s"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); removeJoinTool = new RemoveJoin(); removeJoinTool.in_layer_or_view = "MtdArea_Layer"; removeJoinTool.join_name = dstJoinTableName; gp.Execute(removeJoinTool, trackcancel); deleteTool = new Delete(); deleteTool.in_data = dstJoinTablePath; gp.Execute(deleteTool, trackcancel); } deleteTool = new Delete(); deleteTool.in_data = "MtdArea_Layer"; gp.Execute(deleteTool, trackcancel); // Create and calculate the sortable MSTIMEZONE field on the MtdArea table addFieldTool = new AddField(); addFieldTool.in_table = mtdAreaTablePath; addFieldTool.field_name = "SortableMSTIMEZONE"; addFieldTool.field_type = "TEXT"; addFieldTool.field_length = 60; gp.Execute(addFieldTool, trackcancel); AddMessage("Calculating the time zones...", messages, trackcancel); calcFieldTool = new CalculateField(); calcFieldTool.in_table = mtdAreaTablePath; calcFieldTool.field = "SortableMSTIMEZONE"; calcFieldTool.code_block = TimeZoneUtilities.MakeSortableMSTIMEZONECode("ISO_CODE"); calcFieldTool.expression = "z"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); // Extract the MtdArea rows to be used for generating the time zone polygons and index the AREA_ID field string mtdAreaForTZPolysTablePath = outputFileGdbPath + "\\MtdAreaForTZPolys"; tableSelectTool = new TableSelect(); tableSelectTool.in_table = mtdAreaTablePath; tableSelectTool.out_table = mtdAreaForTZPolysTablePath; tableSelectTool.where_clause = CreateWhereClauseForAdminLvlByCountry(outputFileGdbPath, "MtdCntryRef"); gp.Execute(tableSelectTool, trackcancel); addIndexTool = new AddIndex(); addIndexTool.in_table = mtdAreaForTZPolysTablePath; addIndexTool.fields = "AREA_ID"; addIndexTool.index_name = "AREA_ID"; gp.Execute(addIndexTool, trackcancel); // We no longer need the MtdCntryRef table anymore deleteTool = new Delete(); deleteTool.in_data = mtdCntryRefTablePath; gp.Execute(deleteTool, trackcancel); // Merge the AdminBndy feature classes together into one feature class int numAdminBndyFCs = inputAdminBndyFeatureClassesMultiValue.Count; string mergeToolInputs = ""; for (int i = 0; i < numAdminBndyFCs; i++) { mergeToolInputs = mergeToolInputs + inputAdminBndyFeatureClassesMultiValue.get_Value(i).GetAsText() + ";"; } mergeToolInputs = mergeToolInputs.Remove(mergeToolInputs.Length - 1); string adminBndyFCPath = outputFileGdbPath + "\\AdminBndy"; AddMessage("Merging the Administrative Boundary feature classes...", messages, trackcancel); Merge mergeTool = new Merge(); mergeTool.inputs = mergeToolInputs; mergeTool.output = adminBndyFCPath; gp.Execute(mergeTool, trackcancel); // Join the AdminBndy polygons to the MtdArea rows to be used for generating the time zone polygons MakeFeatureLayer makeFeatureLayerTool = new MakeFeatureLayer(); makeFeatureLayerTool.in_features = adminBndyFCPath; makeFeatureLayerTool.out_layer = "AdminBndy_Layer"; gp.Execute(makeFeatureLayerTool, trackcancel); addJoinTool = new AddJoin(); addJoinTool.in_layer_or_view = "AdminBndy_Layer"; addJoinTool.in_field = "AREA_ID"; addJoinTool.join_table = mtdAreaForTZPolysTablePath; addJoinTool.join_field = "AREA_ID"; addJoinTool.join_type = "KEEP_COMMON"; gp.Execute(addJoinTool, trackcancel); FeatureClassToFeatureClass importFCTool = new FeatureClassToFeatureClass(); importFCTool.in_features = "AdminBndy_Layer"; importFCTool.out_path = outputFileGdbPath; importFCTool.out_name = "UndissolvedTZPolys"; importFCTool.field_mapping = "SortableMSTIMEZONE \"SortableMSTIMEZONE\" true true false 60 Text 0 0 ,First,#," + mtdAreaForTZPolysTablePath + ",MtdAreaForTZPolys.SortableMSTIMEZONE,-1,-1"; gp.Execute(importFCTool, trackcancel); string undissolvedTZPolysFCPath = outputFileGdbPath + "\\UndissolvedTZPolys"; removeJoinTool = new RemoveJoin(); removeJoinTool.in_layer_or_view = "AdminBndy_Layer"; removeJoinTool.join_name = "MtdAreaForTZPolys"; gp.Execute(removeJoinTool, trackcancel); deleteTool = new Delete(); deleteTool.in_data = "AdminBndy_Layer"; gp.Execute(deleteTool, trackcancel); deleteTool = new Delete(); deleteTool.in_data = adminBndyFCPath; gp.Execute(deleteTool, trackcancel); deleteTool.in_data = mtdAreaForTZPolysTablePath; gp.Execute(deleteTool, trackcancel); // Dissolve the time zone polygons together AddMessage("Dissolving the time zones...", messages, trackcancel); string timeZoneFCPath = outputFileGdbPath + "\\" + TimeZoneFCName; Dissolve dissolveTool = new Dissolve(); dissolveTool.in_features = undissolvedTZPolysFCPath; dissolveTool.out_feature_class = timeZoneFCPath; dissolveTool.dissolve_field = "SortableMSTIMEZONE"; dissolveTool.multi_part = "MULTI_PART"; gp.Execute(dissolveTool, trackcancel); deleteTool = new Delete(); deleteTool.in_data = undissolvedTZPolysFCPath; gp.Execute(deleteTool, trackcancel); // Create and calculate the MSTIMEZONE field addFieldTool = new AddField(); addFieldTool.in_table = timeZoneFCPath; addFieldTool.field_name = "MSTIMEZONE"; addFieldTool.field_type = "TEXT"; addFieldTool.field_length = 50; gp.Execute(addFieldTool, trackcancel); AddMessage("Calculating the time zones...", messages, trackcancel); calcFieldTool = new CalculateField(); calcFieldTool.in_table = timeZoneFCPath; calcFieldTool.field = "MSTIMEZONE"; calcFieldTool.expression = "Mid([SortableMSTIMEZONE], 7)"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); // Delete the old sortable MSTIMEZONE field deleteFieldTool = new DeleteField(); deleteFieldTool.in_table = timeZoneFCPath; deleteFieldTool.drop_field = "SortableMSTIMEZONE"; gp.Execute(deleteFieldTool, trackcancel); if (processStreetsFC) { // Create the network dataset time zone table AddMessage("Creating the time zones table...", messages, trackcancel); importTableTool = new TableToTable(); importTableTool.in_rows = timeZoneFCPath; importTableTool.out_path = outputFileGdbPath; importTableTool.out_name = TimeZonesTableName; importTableTool.field_mapping = "MSTIMEZONE \"MSTIMEZONE\" true true false 50 Text 0 0 ,First,#," + timeZoneFCPath + ",MSTIMEZONE,-1,-1"; gp.Execute(importTableTool, trackcancel); // Separate the MtdArea table by driving side and index the AREA_ID field on each AddMessage("Extracting rows for the left-side driving areas...", messages, trackcancel); string drivingLTablePath = mtdAreaTablePath + "DrivingL"; string drivingRTablePath = mtdAreaTablePath + "DrivingR"; tableSelectTool = new TableSelect(); tableSelectTool.in_table = mtdAreaTablePath; tableSelectTool.out_table = drivingLTablePath; tableSelectTool.where_clause = "DRIVING_SD = 'L'"; gp.Execute(tableSelectTool, trackcancel); addIndexTool = new AddIndex(); addIndexTool.in_table = drivingLTablePath; addIndexTool.fields = "AREA_ID"; addIndexTool.index_name = "AREA_ID"; gp.Execute(addIndexTool, trackcancel); AddMessage("Extracting rows for the right-side driving areas...", messages, trackcancel); tableSelectTool = new TableSelect(); tableSelectTool.in_table = mtdAreaTablePath; tableSelectTool.out_table = drivingRTablePath; tableSelectTool.where_clause = "DRIVING_SD = 'R'"; gp.Execute(tableSelectTool, trackcancel); addIndexTool = new AddIndex(); addIndexTool.in_table = drivingRTablePath; addIndexTool.fields = "AREA_ID"; addIndexTool.index_name = "AREA_ID"; gp.Execute(addIndexTool, trackcancel); // Import the Streets feature class to the file geodatabase and // add the FT_TimeZoneID and TF_TimeZoneID fields AddMessage("Copying the Streets feature class to the geodatabase...", messages, trackcancel); importFCTool = new FeatureClassToFeatureClass(); importFCTool.in_features = inputStreetsFeatureClassValue.GetAsText(); importFCTool.out_path = outputFileGdbPath; importFCTool.out_name = StreetsFCName; gp.Execute(importFCTool, trackcancel); string pathToStreetsFC = outputFileGdbPath + "\\" + StreetsFCName; addFieldTool = new AddField(); addFieldTool.in_table = pathToStreetsFC; addFieldTool.field_name = "FT_" + timeZoneIDBaseFieldName; addFieldTool.field_type = "SHORT"; gp.Execute(addFieldTool, trackcancel); addFieldTool.field_name = "TF_" + timeZoneIDBaseFieldName; addFieldTool.field_type = "SHORT"; gp.Execute(addFieldTool, trackcancel); // Calculate the TimeZoneID fields makeFeatureLayerTool = new MakeFeatureLayer(); makeFeatureLayerTool.in_features = pathToStreetsFC; makeFeatureLayerTool.out_layer = "Streets_Layer"; gp.Execute(makeFeatureLayerTool, trackcancel); addJoinTool = new AddJoin(); addJoinTool.in_layer_or_view = "Streets_Layer"; addJoinTool.in_field = "R_AREA_ID"; addJoinTool.join_table = drivingLTablePath; addJoinTool.join_field = "AREA_ID"; addJoinTool.join_type = "KEEP_COMMON"; gp.Execute(addJoinTool, trackcancel); AddMessage("Calculating the FT_" + timeZoneIDBaseFieldName + " field for left driving side roads...", messages, trackcancel); calcFieldTool = new CalculateField(); calcFieldTool.in_table = "Streets_Layer"; calcFieldTool.field = StreetsFCName + ".FT_" + timeZoneIDBaseFieldName; calcFieldTool.code_block = TimeZoneUtilities.MakeTimeZoneIDCode(outputFileGdbPath, TimeZonesTableName, "MtdAreaDrivingL.SortableMSTIMEZONE"); calcFieldTool.expression = "tzID"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); removeJoinTool = new RemoveJoin(); removeJoinTool.in_layer_or_view = "Streets_Layer"; removeJoinTool.join_name = "MtdAreaDrivingL"; gp.Execute(removeJoinTool, trackcancel); addJoinTool = new AddJoin(); addJoinTool.in_layer_or_view = "Streets_Layer"; addJoinTool.in_field = "L_AREA_ID"; addJoinTool.join_table = drivingRTablePath; addJoinTool.join_field = "AREA_ID"; addJoinTool.join_type = "KEEP_COMMON"; gp.Execute(addJoinTool, trackcancel); AddMessage("Calculating the FT_" + timeZoneIDBaseFieldName + " field for right driving side roads...", messages, trackcancel); calcFieldTool = new CalculateField(); calcFieldTool.in_table = "Streets_Layer"; calcFieldTool.field = StreetsFCName + ".FT_" + timeZoneIDBaseFieldName; calcFieldTool.code_block = TimeZoneUtilities.MakeTimeZoneIDCode(outputFileGdbPath, TimeZonesTableName, "MtdAreaDrivingR.SortableMSTIMEZONE"); calcFieldTool.expression = "tzID"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); removeJoinTool = new RemoveJoin(); removeJoinTool.in_layer_or_view = "Streets_Layer"; removeJoinTool.join_name = "MtdAreaDrivingR"; gp.Execute(removeJoinTool, trackcancel); addJoinTool = new AddJoin(); addJoinTool.in_layer_or_view = "Streets_Layer"; addJoinTool.in_field = "L_AREA_ID"; addJoinTool.join_table = drivingLTablePath; addJoinTool.join_field = "AREA_ID"; addJoinTool.join_type = "KEEP_COMMON"; gp.Execute(addJoinTool, trackcancel); AddMessage("Calculating the TF_" + timeZoneIDBaseFieldName + " field for left driving side roads...", messages, trackcancel); calcFieldTool = new CalculateField(); calcFieldTool.in_table = "Streets_Layer"; calcFieldTool.field = StreetsFCName + ".TF_" + timeZoneIDBaseFieldName; calcFieldTool.code_block = TimeZoneUtilities.MakeTimeZoneIDCode(outputFileGdbPath, TimeZonesTableName, "MtdAreaDrivingL.SortableMSTIMEZONE"); calcFieldTool.expression = "tzID"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); removeJoinTool = new RemoveJoin(); removeJoinTool.in_layer_or_view = "Streets_Layer"; removeJoinTool.join_name = "MtdAreaDrivingL"; gp.Execute(removeJoinTool, trackcancel); addJoinTool = new AddJoin(); addJoinTool.in_layer_or_view = "Streets_Layer"; addJoinTool.in_field = "R_AREA_ID"; addJoinTool.join_table = drivingRTablePath; addJoinTool.join_field = "AREA_ID"; addJoinTool.join_type = "KEEP_COMMON"; gp.Execute(addJoinTool, trackcancel); AddMessage("Calculating the TF_" + timeZoneIDBaseFieldName + " field for right driving side roads...", messages, trackcancel); calcFieldTool = new CalculateField(); calcFieldTool.in_table = "Streets_Layer"; calcFieldTool.field = StreetsFCName + ".TF_" + timeZoneIDBaseFieldName; calcFieldTool.code_block = TimeZoneUtilities.MakeTimeZoneIDCode(outputFileGdbPath, TimeZonesTableName, "MtdAreaDrivingR.SortableMSTIMEZONE"); calcFieldTool.expression = "tzID"; calcFieldTool.expression_type = "VB"; gp.Execute(calcFieldTool, trackcancel); removeJoinTool = new RemoveJoin(); removeJoinTool.in_layer_or_view = "Streets_Layer"; removeJoinTool.join_name = "MtdAreaDrivingR"; gp.Execute(removeJoinTool, trackcancel); deleteTool = new Delete(); deleteTool.in_data = "Streets_Layer"; gp.Execute(deleteTool, trackcancel); deleteTool = new Delete(); deleteTool.in_data = drivingLTablePath; gp.Execute(deleteTool, trackcancel); deleteTool.in_data = drivingRTablePath; gp.Execute(deleteTool, trackcancel); } else { // Create a dummy TimeZones table and a dummy Streets feature class CreateTable createTableTool = new CreateTable(); createTableTool.out_path = outputFileGdbPath; createTableTool.out_name = TimeZonesTableName; gp.Execute(createTableTool, trackcancel); CreateFeatureclass createFCTool = new CreateFeatureclass(); createFCTool.out_path = outputFileGdbPath; createFCTool.out_name = StreetsFCName; createFCTool.geometry_type = "POLYLINE"; gp.Execute(createFCTool, trackcancel); } deleteTool = new Delete(); deleteTool.in_data = mtdAreaTablePath; gp.Execute(deleteTool, trackcancel); // Compact the output file geodatabase AddMessage("Compacting the output file geodatabase...", messages, trackcancel); Compact compactTool = new Compact(); compactTool.in_workspace = outputFileGdbPath; gp.Execute(compactTool, trackcancel); } catch (Exception e) { if (gp.MaxSeverity == 2) { object missing = System.Type.Missing; messages.AddError(1, gp.GetMessages(ref missing)); } messages.AddError(1, e.Message); messages.AddError(1, e.StackTrace); } finally { // Restore the original GP environment settings gpSettings.AddOutputsToMap = origAddOutputsToMapSetting; gpSettings.LogHistory = origLogHistorySetting; } GC.Collect(); return; }
internal static stmt Convert(Statement stmt) { stmt ast; if (stmt is FunctionDefinition) ast = new FunctionDef((FunctionDefinition)stmt); else if (stmt is ReturnStatement) ast = new Return((ReturnStatement)stmt); else if (stmt is AssignmentStatement) ast = new Assign((AssignmentStatement)stmt); else if (stmt is AugmentedAssignStatement) ast = new AugAssign((AugmentedAssignStatement)stmt); else if (stmt is DelStatement) ast = new Delete((DelStatement)stmt); else if (stmt is PrintStatement) ast = new Print((PrintStatement)stmt); else if (stmt is ExpressionStatement) ast = new Expr((ExpressionStatement)stmt); else if (stmt is ForStatement) ast = new For((ForStatement)stmt); else if (stmt is WhileStatement) ast = new While((WhileStatement)stmt); else if (stmt is IfStatement) ast = new If((IfStatement)stmt); else if (stmt is WithStatement) ast = new With((WithStatement)stmt); else if (stmt is RaiseStatement) ast = new Raise((RaiseStatement)stmt); else if (stmt is TryStatement) ast = Convert((TryStatement)stmt); else if (stmt is AssertStatement) ast = new Assert((AssertStatement)stmt); else if (stmt is ImportStatement) ast = new Import((ImportStatement)stmt); else if (stmt is FromImportStatement) ast = new ImportFrom((FromImportStatement)stmt); else if (stmt is ExecStatement) ast = new Exec((ExecStatement)stmt); else if (stmt is GlobalStatement) ast = new Global((GlobalStatement)stmt); else if (stmt is ClassDefinition) ast = new ClassDef((ClassDefinition)stmt); else if (stmt is BreakStatement) ast = new Break(); else if (stmt is ContinueStatement) ast = new Continue(); else if (stmt is EmptyStatement) ast = new Pass(); else throw new ArgumentTypeException("Unexpected statement type: " + stmt.GetType()); ast.GetSourceLocation(stmt); return ast; }
public IDeleteQueryBuild <TTable> DeleteAll() { _delete = new DeleteAll(); return(this); }
public IDeleteQueryBuild <TTable> DeleteBy(Func <object, Expression <Func <TTable, bool> > > expressionBuilder) { _delete = new DeleteAll <TTable>(expressionBuilder); return(this); }
public IDeleteQueryBuild <TTable> DeleteByIds(Func <object, IEnumerable> mapIds) { _delete = new DeleteByIds(mapIds); return(this); }
public IDeleteQueryBuild <TTable> DeleteById(Func <object, object> mapId) { _delete = new DeleteById(mapId); return(this); }
public override void Down() { Delete.Column("FrameworkID").FromTable("FrameworkComments"); }
public override void Down() { Delete.Column("Date").FromTable("Payment"); }
public override void Down() { Delete.Column("deletable").FromTable("SW_USERPROFILE"); Delete.Column("deletable").FromTable("SW_ROLE"); }
partial void InsertDelete(Delete instance);
public DeleteFlowElement(Delete delete, IDbConnection connection) { _delete = delete; _connection = connection; }
partial void DeleteDelete(Delete instance);
public static Edit Delete(PythonNode parent, PythonNode deleted) { var delete = new Delete(deleted, parent); return(delete); }
public async Task<ActionResult> Delete(Delete.Command command) { await _mediator.SendAsync(command); return this.RedirectToActionJson("Index"); }
public void Parse() { var current = _reader.BaseStream.Position; _reader.BaseStream.Seek(_offset, SeekOrigin.Begin); bool parsing = true; bool branched = false; int branchBytes = 0; while (parsing) { //now reader the instructions var type = _reader.ReadByteAsEnum <InstructionType>(); var aligned = InstructionAlignment.IsAligned(type); if (aligned) { var padding = _reader.Align(4); if (padding > 0) { Items.Add(new Padding(padding)); if (branched) { branchBytes -= (int)padding; if (branchBytes <= 0) { branched = false; branchBytes = 0; } } } } InstructionBase instruction = null; List <Value> parameters = new List <Value>(); switch (type) { case InstructionType.ToNumber: instruction = new ToNumber(); break; case InstructionType.NextFrame: instruction = new NextFrame(); break; case InstructionType.Play: instruction = new Play(); break; case InstructionType.Stop: instruction = new Stop(); break; case InstructionType.Add: instruction = new Add(); break; case InstructionType.Subtract: instruction = new Subtract(); break; case InstructionType.Multiply: instruction = new Multiply(); break; case InstructionType.Divide: instruction = new Divide(); break; case InstructionType.Not: instruction = new Not(); break; case InstructionType.StringEquals: instruction = new StringEquals(); break; case InstructionType.Pop: instruction = new Pop(); break; case InstructionType.ToInteger: instruction = new ToInteger(); break; case InstructionType.GetVariable: instruction = new GetVariable(); break; case InstructionType.SetVariable: instruction = new SetVariable(); break; case InstructionType.StringConcat: instruction = new StringConcat(); break; case InstructionType.GetProperty: instruction = new GetProperty(); break; case InstructionType.SetProperty: instruction = new SetProperty(); break; case InstructionType.Trace: instruction = new Trace(); break; case InstructionType.Delete: instruction = new Delete(); break; case InstructionType.Delete2: instruction = new Delete2(); break; case InstructionType.DefineLocal: instruction = new DefineLocal(); break; case InstructionType.CallFunction: instruction = new CallFunction(); break; case InstructionType.Return: instruction = new Return(); break; case InstructionType.NewObject: instruction = new NewObject(); break; case InstructionType.InitArray: instruction = new InitArray(); break; case InstructionType.InitObject: instruction = new InitObject(); break; case InstructionType.TypeOf: instruction = new InitObject(); break; case InstructionType.Add2: instruction = new Add2(); break; case InstructionType.LessThan2: instruction = new LessThan2(); break; case InstructionType.Equals2: instruction = new Equals2(); break; case InstructionType.ToString: instruction = new ToString(); break; case InstructionType.PushDuplicate: instruction = new PushDuplicate(); break; case InstructionType.GetMember: instruction = new GetMember(); break; case InstructionType.SetMember: instruction = new SetMember(); break; case InstructionType.Increment: instruction = new Increment(); break; case InstructionType.CallMethod: instruction = new CallMethod(); break; case InstructionType.Enumerate2: instruction = new Enumerate2(); break; case InstructionType.EA_PushThis: instruction = new PushThis(); break; case InstructionType.EA_PushZero: instruction = new PushZero(); break; case InstructionType.EA_PushOne: instruction = new PushOne(); break; case InstructionType.EA_CallFunc: instruction = new CallFunc(); break; case InstructionType.EA_CallMethodPop: instruction = new CallMethodPop(); break; case InstructionType.BitwiseXOr: instruction = new BitwiseXOr(); break; case InstructionType.Greater: instruction = new Greater(); break; case InstructionType.EA_PushThisVar: instruction = new PushThisVar(); break; case InstructionType.EA_PushGlobalVar: instruction = new PushGlobalVar(); break; case InstructionType.EA_ZeroVar: instruction = new ZeroVar(); break; case InstructionType.EA_PushTrue: instruction = new PushTrue(); break; case InstructionType.EA_PushFalse: instruction = new PushFalse(); break; case InstructionType.EA_PushNull: instruction = new PushNull(); break; case InstructionType.EA_PushUndefined: instruction = new PushUndefined(); break; case InstructionType.GotoFrame: instruction = new GotoFrame(); parameters.Add(Value.FromInteger(_reader.ReadInt32())); break; case InstructionType.GetURL: instruction = new GetUrl(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.SetRegister: instruction = new SetRegister(); parameters.Add(Value.FromInteger(_reader.ReadInt32())); break; case InstructionType.ConstantPool: { instruction = new ConstantPool(); var count = _reader.ReadUInt32(); var constants = _reader.ReadFixedSizeArrayAtOffset <uint>(() => _reader.ReadUInt32(), count); foreach (var constant in constants) { parameters.Add(Value.FromConstant(constant)); } } break; case InstructionType.GotoLabel: instruction = new GotoLabel(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.DefineFunction2: { instruction = new DefineFunction2(); var name = _reader.ReadStringAtOffset(); var nParams = _reader.ReadUInt32(); var nRegisters = _reader.ReadByte(); var flags = _reader.ReadUInt24(); //list of parameter strings var paramList = _reader.ReadFixedSizeListAtOffset <FunctionArgument>(() => new FunctionArgument() { Register = _reader.ReadInt32(), Parameter = _reader.ReadStringAtOffset(), }, nParams); parameters.Add(Value.FromString(name)); parameters.Add(Value.FromInteger((int)nParams)); parameters.Add(Value.FromInteger((int)nRegisters)); parameters.Add(Value.FromInteger((int)flags)); foreach (var param in paramList) { parameters.Add(Value.FromInteger(param.Register)); parameters.Add(Value.FromString(param.Parameter)); } //body size of the function parameters.Add(Value.FromInteger(_reader.ReadInt32())); //skip 8 bytes _reader.ReadUInt64(); } break; case InstructionType.PushData: { instruction = new PushData(); var count = _reader.ReadUInt32(); var constants = _reader.ReadFixedSizeArrayAtOffset <uint>(() => _reader.ReadUInt32(), count); foreach (var constant in constants) { parameters.Add(Value.FromConstant(constant)); } } break; case InstructionType.BranchAlways: instruction = new BranchAlways(); if (!branched) { branchBytes = _reader.ReadInt32(); parameters.Add(Value.FromInteger(branchBytes)); if (branchBytes > 0) { branchBytes += (int)instruction.Size + 1; branched = true; } } else { parameters.Add(Value.FromInteger(_reader.ReadInt32())); } break; case InstructionType.GetURL2: instruction = new GetUrl2(); break; case InstructionType.DefineFunction: { instruction = new DefineFunction(); var name = _reader.ReadStringAtOffset(); //list of parameter strings var paramList = _reader.ReadListAtOffset <string>(() => _reader.ReadStringAtOffset()); parameters.Add(Value.FromString(name)); parameters.Add(Value.FromInteger(paramList.Count)); foreach (var param in paramList) { parameters.Add(Value.FromString(param)); } //body size of the function parameters.Add(Value.FromInteger(_reader.ReadInt32())); //skip 8 bytes _reader.ReadUInt64(); } break; case InstructionType.BranchIfTrue: instruction = new BranchIfTrue(); if (!branched) { branchBytes = _reader.ReadInt32(); parameters.Add(Value.FromInteger(branchBytes)); if (branchBytes > 0) { branchBytes += (int)instruction.Size + 1; branched = true; } } else { parameters.Add(Value.FromInteger(_reader.ReadInt32())); } break; case InstructionType.GotoFrame2: instruction = new GotoFrame2(); parameters.Add(Value.FromInteger(_reader.ReadByte())); break; case InstructionType.EA_PushString: instruction = new PushString(); //the constant id that should be pushed parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_PushConstantByte: instruction = new PushConstantByte(); //the constant id that should be pushed parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_GetStringVar: instruction = new GetStringVar(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_SetStringVar: instruction = new SetStringMember(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_GetStringMember: instruction = new GetStringMember(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_SetStringMember: instruction = new SetStringMember(); parameters.Add(Value.FromString(_reader.ReadStringAtOffset())); break; case InstructionType.EA_PushValueOfVar: instruction = new PushValueOfVar(); //the constant id that should be pushed parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_GetNamedMember: instruction = new GetNamedMember(); parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_CallNamedFuncPop: instruction = new CallNamedFuncPop(); parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_CallNamedFunc: instruction = new CallNamedFunc(); parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_CallNamedMethodPop: instruction = new CallNamedMethodPop(); parameters.Add(Value.FromConstant(_reader.ReadByte())); break; case InstructionType.EA_PushFloat: instruction = new PushFloat(); parameters.Add(Value.FromFloat(_reader.ReadSingle())); break; case InstructionType.EA_PushByte: instruction = new PushByte(); parameters.Add(Value.FromInteger(_reader.ReadByte())); break; case InstructionType.EA_PushShort: instruction = new PushShort(); parameters.Add(Value.FromInteger(_reader.ReadUInt16())); break; case InstructionType.End: instruction = new End(); if (!branched) { parsing = false; } break; default: throw new InvalidDataException("Unimplemented bytecode instruction:" + type.ToString()); } if (instruction != null) { instruction.Parameters = parameters; Items.Add(instruction); } if (branched) { branchBytes -= (int)instruction.Size + 1; if (branchBytes <= 0) { branched = false; } } } _reader.BaseStream.Seek(current, SeekOrigin.Begin); }
public override void Down() { Delete.Column("IsPublic").FromTable("PRF_FeedingSource"); Delete.Table("PRF_SourceAuthorFeedingSource"); }
public override void Down() { Delete.Table("UserRoles"); }
public override void Down() { Delete.Table("customer_customer_levels"); }
public override void Down() { Delete.Table("Tags"); }
public void Acc_Delete_SimpleSqlCheck() { SubSonic.SqlQuery q = new Delete().From(Region.Schema).Where("regiondescription").IsEqualTo("Test"); string sql = q.BuildSqlStatement(); Assert.IsTrue(sql == "DELETE FROM [Region] WHERE [Region].[RegionDescription] = [PARM__RegionDescription0]\r\n"); }
public string[] Delete(Delete request) { var response = base.SendRequest<ItemIds>("item.delete", request); return response.itemids; }
protected override void MainDbUpgrade() { Delete.FromTable("Indexers").Row(new { Implementation = "BitMeTv" }); }
public override void Down() => Delete.Table("wallets");
public override void Down() { Delete.Table("Cliente"); }
public override void Down() { Delete.Table("hours_of_operation_days"); }
public string[] Delete(Delete request) { var response = base.SendRequest<MapIds>("map.delete", request); return response.mapids; }
/// <summary> /// SqlSugar的功能介绍 /// </summary> /// <param name="args"></param> static void Main(string[] args) { //设置执行的DEMO string switchOn = "select"; IDemos demo = null; switch (switchOn) { /****************************基本功能**************************************/ //查询 case "select": demo = new Select(); break; //删除 case "delete": demo = new Delete(); break; //插入 case "insert": demo = new Insert(); break; //更新 case "update": demo = new Update(); break; //基层函数的用法 case "ado": demo = new Ado(); break; //事务 case "tran": demo = new Tran(); break; //创建实体函数 case "createclass": demo = new CreateClass(); break; //T4生成 http://www.cnblogs.com/sunkaixuan/p/5751503.html //日志记录 case "log": demo = new Log(); break; //枚举支持 case "enum": demo = new EnumDemo(); break; /****************************实体映射**************************************/ //自动排除非数据库列 case "ignoreerrorcolumns": demo = new IgnoreErrorColumns(); break; //别名表 case "mappingtable": demo = new MappingTable(); break; //别名列 case "mappingcolumns": demo = new MappingColumns(); break; //通过属性的方法设置别名表和别名字段 case "attributesmapping": demo = new AttributesMapping(); break; /****************************业务应用**************************************/ //过滤器 case "filter": demo = new Filter(); break; //过滤器2 case "filter2": demo = new Filter2(); break; //流水号功能 case "serialnumber": demo = new SerialNumber(); break; //配置与实例的用法 case "initconfig": demo = new InitConfig(); break; /****************************支持**************************************/ //公开函数数 case "pubmethod": demo = new PubMethod(); break; //设置ToJson的日期格式 case "serializerdateformat": demo = new SerializerDateFormat(); break; /****************************测试用例**************************************/ case "test": demo = new Test(); break; default: Console.WriteLine("switchOn的值错误,请输入正确的 case"); break; } //执行DEMO demo.Init(); //更多例子请查看API //http://www.cnblogs.com/sunkaixuan/p/5654695.html Console.WriteLine("执行成功请关闭窗口"); Console.ReadKey(); }
partial void UpdateDelete(Delete instance);
protected override void MainDbUpgrade() { Execute.WithConnection(SetMetadataFileExtension); Execute.Sql("DELETE FROM Config WHERE Key = 'autodownloadpropers'"); Delete.Column("PreferredTags").FromTable("Profiles"); }
public string[] Delete(Delete request) { var response = base.SendRequest<ActionIds>("action.delete", request); return response.actionids; }
public override void Down() { Delete.Column("U_AVATAR").FromTable("t_user"); }
public async Task<ActionResult> Delete(Delete.Query query) { var model = await _mediator.SendAsync(query); return View(model); }
public override void Down() { Delete.Table("UserLoad"); }
public override void Down() { Delete.Table("product"); }
public override void Down() { Delete.Table("users"); }
public string[] Delete(Delete request) { var response = base.SendRequest<GraphIds>("graph.delete", request); return response.graphids; }
public override void Down() { Delete.Table(TableName); }
public string[] Delete(Delete request) { var response = base.SendRequest<HostInterfaceIds>("hostinterface.delete", request); return response.interfaceids; }
public override void Down() { Delete.Column("Text").FromTable(Tables.ChapterContent).InSchema(Schemas.Dbo); }
public string[] Delete(Delete request) { var response = base.SendRequest<TemplateScreenIds>("templatescreen.delete", request); return response.templatescreenids; }
public override void Down() { Delete.Table("CustomerAddress"); Delete.Table("Customer"); }