Example #1
0
        public static void Create(Microsoft.SharePoint.SPListItem item)
        {
            try
            {
                BLL.Logger.LogEvent("Generowanie formatek rozliczeniowych", item.ID.ToString());

                string mask = BLL.Tools.Get_Text(item, "colMaskaSerwisu");
                string kmask = BLL.Tools.Get_Text(item, "colMaskaTypuKlienta");

                if (!string.IsNullOrEmpty(kmask))
                {
                    if (!string.IsNullOrEmpty(mask))
                    {
                        Create_Bulk_FormsBy_KMask_Mask(item, kmask, mask);
                    }
                    else
                    {
                        Crate_Bulk_FormsBy_KMask(item, kmask);
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(mask))
                    {
                        Create_Bulk_FormsBy_Mask(item, mask);
                    }
                    else
                    {
                        Crate_Bulk_Forms(item);
                    }
                }

            #if DEBUG
                BLL.Tools.Set_Text(item, "enumStatusZlecenia", "ZakoŇĄczony");
                item.SystemUpdate();
            #else
                item.Delete();
            #endif
            }
            catch (Exception ex)
            {
                BLL.Logger.LogError(item.Web.Name, item.ID.ToString(), ex);
            }
        }
Example #2
0
        private static void DeleteStatement(Microsoft.VisualStudio.Text.ITextEdit edit, SourceSpan span, bool insertPass)
        {
            // remove the entire node, leave any trailing whitespace/comments, but include the
            // newline and any indentation.

            int start = span.Start.Index;
            int length = span.Length;
            int cur = start - 1;
            if (!insertPass) {
                // backup to remove any indentation
                while (start - 1 > 0) {
                    var curChar = edit.Snapshot.GetText(start - 1, 1);
                    if (curChar[0] == ' ' || curChar[0] == '\t' || curChar[0] == '\f') {
                        length++;
                        start--;
                    } else {
                        break;
                    }
                }
            }

            // extend past any trailing whitespace characters
            while (start + length < edit.Snapshot.Length) {
                var curChar = edit.Snapshot.GetText(start + length, 1);
                if (curChar[0] == ' ' || curChar[0] == '\t' || curChar[0] == '\f') {
                    length++;
                } else {
                    break;
                }
            }

            // remove the trailing newline as well.
            if (!insertPass) {
                if (start + length < edit.Snapshot.Length) {
                    var newlineText = edit.Snapshot.GetText(start + length, 1);
                    if (newlineText == "\r") {
                        if (start + length + 1 < edit.Snapshot.Length) {
                            newlineText = edit.Snapshot.GetText(start + length + 1, 1);
                            if (newlineText == "\n") {
                                length += 2;
                            } else {
                                length++;
                            }
                        } else {
                            length++;
                        }
                    } else if (newlineText == "\n") {
                        length++;
                    }
                }
            }
            edit.Delete(start, length);

            if (insertPass) {
                edit.Insert(start, "pass");
            }
        }