Example #1
0
        static void Main(string[] args)
        {
            var invoker    = new Invoker();
            var addItem    = new AddItem();
            var modifyItem = new ModifyItem();

            invoker.Invoke(addItem, new ToDoList()
            {
                Id        = 1,
                ToDoItems = new List <ToDoItem>()
                {
                    new ToDoItem()
                    {
                        Id = 1, Item = "Clean the house", Description = "Take a vacuum and clean", State = "In Progress"
                    }
                }
            });

            invoker.Invoke(modifyItem, new ToDoList()
            {
                Id        = 1,
                ToDoItems = new List <ToDoItem>()
                {
                    new ToDoItem()
                    {
                        Id = 1, Item = "Clean the house", Description = "Take a vacuum and clean", State = "Done"
                    }
                }
            });
        }
Example #2
0
 private void BtnRemove_Click(object sender, EventArgs e)
 {
     if (removeItem == null)
     {
         removeItem = new ModifyItem();
     }
     Contain(removeItem);
 }
Example #3
0
        public void RunAdminModule()
        {
            Console.Clear();
            Console.WriteLine(">>> You have been authenticated. Welcome ADMIN user!\n");

            while (option != exitValue)
            {
                DisplayAdminMenu();

                Console.Write("\nChoose an option: ");
                input = Console.ReadLine();
                bool result = Int32.TryParse(input, out option);

                if (result)
                {
                    switch (option)
                    {
                    case 1:
                        Console.Clear();
                        DisplayInventory.ListInventory();
                        break;

                    case 2:
                        Console.Clear();
                        NewItem.GetItemData();
                        break;

                    case 3:
                        Console.Clear();
                        ModifyItem.ModifyItemData();
                        break;

                    case 4:
                        Console.Clear();
                        RemoveItem.RemoveItemFromInventory();
                        break;

                    case 5:
                        Console.Clear();
                        Console.WriteLine("EXITING the application... Thank you!");
                        break;

                    default:
                        Console.Clear();
                        Console.WriteLine(">>> Invalid number. Please try again!\n");
                        break;
                    }
                }
                else
                {
                    Console.Clear();
                    Console.WriteLine(">>> Invalid input. Please try again!\n");
                }
            }
        }
        public void ModifyItemAddPropertyContainingSemicolon()
        {
            // Populate the project directory with three physical files on disk -- a.weirdo, b.weirdo, c.weirdo.
            ModifyItem.CreateThreeWeirdoFilesHelper();

            // ************************************
            //               BEFORE
            // ************************************
            string projectOriginalContents = @" 
                <Project ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`msbuildnamespace`>

                    <PropertyGroup>
                        <FilenameWithSemicolon>foo;bar</FilenameWithSemicolon>
                    </PropertyGroup>

                    <ItemGroup>
                        <MyWildcard Include=`*.weirdo` />
                    </ItemGroup>
                
                </Project>
                ";


            // ************************************
            //               AFTER
            // ************************************
            string projectNewExpectedContents = @" 
                <Project ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`msbuildnamespace`>

                    <PropertyGroup>
                        <FilenameWithSemicolon>foo;bar</FilenameWithSemicolon>
                    </PropertyGroup>

                    <ItemGroup>
                        <MyWildcard Include=`a.weirdo` />
                        <MyWildcard Include=`$(FileNameWithSemicolon).weirdo` />
                        <MyWildcard Include=`c.weirdo` />
                    </ItemGroup>
                
                </Project>
                ";

            // Change b.weirdo to foo;bar.weirdo.
            ModifyItem.ModifyItemIncludeHelper(projectOriginalContents, projectNewExpectedContents,
                                               "b.weirdo", "$(FileNameWithSemicolon).weirdo");

            ModifyItem.CleanupWeirdoFilesHelper();
        }
        public CompareOption(Dictionary <string, string> columnsToCompare,
                             CreateNewItem <T1, T2> createNewItem, ModifyItem <T1, T2> modifyItem, RemoveItem <T1> removeItem,
                             GetSrcId <T1> getSrcId, GetDstId <T2> getDstId,
                             string columnNameOfRemove = "IsDeleted")
        {
            if (columnsToCompare == null || columnsToCompare.Count == 0)
            {
                throw new Exception("No compare columns are specified.");
            }

            this.ColumnNameOfRemove = columnNameOfRemove;
            this.ColumnsToCompare   = columnsToCompare;

            this.CreateNewItem = new CreateNewItem <T1, T2>(createNewItem);
            this.ModifyItem    = new ModifyItem <T1, T2>(modifyItem);
            this.RemoveItem    = new RemoveItem <T1>(removeItem);

            this.GetSrcId = new GetSrcId <T1>(getSrcId);
            this.GetDstId = new GetDstId <T2>(getDstId);
        }
Example #6
0
        void CmdGetItems()
        {
            string str = string.Empty;

            for (int i = 0; i < Lines.Count; i++)
            {
                str = Lines[i];
                //  读到结束符不继续读取
                if (str.StartsWith("/") && str.EndsWith("/"))
                {
                    break;
                }

                //  不为空的行
                if (str.IsWorkLine())
                {
                    List <string> newStr = str.EclExtendToArray();

                    if (newStr.Count > 0)
                    {
                        ModifyItem pitem = new ModifyItem();
                        pitem.Build(newStr);
                        //  标记行的ID位置
                        //Lines[i] = pitem.ID;
                        if (pitem != null)
                        {
                            Items.Add(pitem);
                        }
                    }
                }
            }


            if (this.DefautRegion == null)
            {
                this.DefautRegion = this.BaseFile.TempRegion;
            }

            ConvertToModel();
        }
 /// <remarks/>
 public void modifyItemsRequestAsync(ModifyItem[] modifyItemsRequest1, object userState)
 {
     if ((this.modifyItemsRequestOperationCompleted == null)) {
         this.modifyItemsRequestOperationCompleted = new System.Threading.SendOrPostCallback(this.OnmodifyItemsRequestOperationCompleted);
     }
     this.InvokeAsync("modifyItemsRequest", new object[] {
                 modifyItemsRequest1}, this.modifyItemsRequestOperationCompleted, userState);
 }
 /// <remarks/>
 public void modifyItemsRequestAsync(ModifyItem[] modifyItemsRequest1)
 {
     this.modifyItemsRequestAsync(modifyItemsRequest1, null);
 }
 /// <remarks/>
 public System.IAsyncResult BeginmodifyItemsRequest(ModifyItem[] modifyItemsRequest1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("modifyItemsRequest", new object[] {
                 modifyItemsRequest1}, callback, asyncState);
 }
Example #10
0
        private void Execute(object paremeter)
        {
            ThreadParameter p          = paremeter as ThreadParameter;
            DataSet         dataset    = p.Data;
            String          modelIndex = p.ModelIndex;

            if (dataset == null)
            {
                return;
            }

            List <ModifyItem> modifyList = new List <ModifyItem>();

            try
            {
                foreach (DataTable Table in dataset.Tables)
                {
                    foreach (DataRow Row in Table.Rows)
                    {
                        foreach (DataColumn Column in Table.Columns)
                        {
                            String originalValue = Convert.ToString(Row[Column.ColumnName, DataRowVersion.Original]);
                            String currentValue  = Convert.ToString(Row[Column.ColumnName, DataRowVersion.Current]);
                            if (originalValue == "" || originalValue == "/")
                            {
                                continue;
                            }
                            if (Column.ColumnName.StartsWith("col_norm_") && String.Compare(originalValue, currentValue, true) != 0)
                            {
                                ModifyItem item = new ModifyItem()
                                {
                                    CellPosition  = Column.ColumnName.Replace("col_norm_", ""),
                                    SheetName     = Table.TableName.Replace("[biz_norm_", "").Replace("]", ""),
                                    OriginalValue = originalValue.Replace("'", "''"),
                                    CurrentValue  = currentValue.Replace("'", "''")
                                };
                                modifyList.Add(item);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("changes log modify:" + ex.Message);
            }

            try
            {
                if (modifyList.Count == 0)
                {
                    return;
                }
                String    modelName    = GetModelNameByID(modelIndex);
                String    reportNumber = GetReportNumberByModelID(modelIndex, dataset);
                DataTable tb           = dataset.Tables["[biz_norm_extent_" + modelIndex + "]"];
                if (tb == null || tb.Rows.Count <= 0)
                {
                    logger.Error(String.Format("传入数据中无[biz_norm_extent_{0}]", modelIndex));
                    return;
                }

                String dataID     = tb.Rows[0]["ID"].ToString();
                String modelCode  = tb.Rows[0]["SCPT"].ToString();
                String reportName = string.Empty;
                if (tb.Columns.Contains("DataName"))
                {
                    reportName = tb.Rows[0]["DataName"].ToString();
                }
                else
                {
                    reportName = GetModelNameByID(p.ModelIndex);
                }
                String modifyItems = Newtonsoft.Json.JsonConvert.SerializeObject(modifyList);

                String relateApplyID = "";
                if (tb.Rows[0]["SCCS"] != DBNull.Value)
                {
                    relateApplyID = tb.Rows[0]["SCCS"].ToString();
                }

                //logger.Error("SCCS= " + relateApplyID);

                String segment  = GetDepartmentInfo("sys_engs_SectionInfo", modelCode.Substring(0, 8));
                String company  = GetDepartmentInfo("sys_engs_CompanyInfo", modelCode.Substring(0, 12));
                String testRoom = GetDepartmentInfo("sys_engs_ItemInfo", modelCode.Substring(0, 16));

                String insertSql = String.Format(@"INSERT INTO dbo.sys_operatelog
                            ( modifiedby ,
                              modifiedDate ,
                              optType,
                              modelIndex ,
                              modelCode ,
                              dataID ,
                              segmentName ,
                              companyName ,
                              testRoom ,
                              modelName ,
                              reportName ,
                              reportNumber ,
                              modifyItem ,
                              comment,
                              testRoomCode
                            )
                    VALUES  ( '{0}','{1}','修改','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}' )",
                                                 p.UserName,
                                                 DateTime.Now,
                                                 modelIndex,
                                                 modelCode,
                                                 dataID,
                                                 segment,
                                                 company,
                                                 testRoom,
                                                 modelName,
                                                 reportName,
                                                 reportNumber,
                                                 modifyItems,
                                                 relateApplyID,
                                                 modelCode.Substring(0, 16));
                ExcuteCommand(insertSql);

                //将申请修改字段SCCS,变更为空
                String sql = "update [biz_norm_extent_" + modelIndex + "] set SCCS=null where ID='" + dataID + "' ";
                ExcuteCommand(sql);
            }
            catch (Exception ex)
            {
                logger.Error("changes log big error:" + ex.Message);
            }
        }