Пример #1
0
        /// <summary>
        /// Zastąpiony przez Workflow
        /// </summary>
        /// <param name="item"></param>
        internal static void Execute(Microsoft.SharePoint.SPListItem item)
        {
            BLL.Logger.LogEvent("Obsługa kart kontrolnych", item.ID.ToString());

            SPList list = item.Web.Lists.TryGetList(targetList);

            //ustaw okres karencji
            int      offset     = int.Parse(BLL.admSetup.GetValue(item.Web, "KK_IGNORE_UPDATES_MINUTES"));
            DateTime targetDate = DateTime.Now.AddMinutes(-1 * offset);

            list.Items.Cast <SPListItem>()
            .Where(i => BLL.Tools.Get_Date(i, "Modified") < targetDate)     //nie ruszaj modyfikowanych w ciągu istatnicj x minut
            .Where(i => BLL.Tools.Get_Text(i, "colZUS_StatusZadania").Equals(_STATUS_ZADANIA_ZWOLNIONE) ||
                   BLL.Tools.Get_Text(i, "colPD_StatusZadania").Equals(_STATUS_ZADANIA_ZWOLNIONE) ||
                   BLL.Tools.Get_Text(i, "colVAT_StatusZadania").Equals(_STATUS_ZADANIA_ZWOLNIONE) ||
                   BLL.Tools.Get_Text(i, "colRBR_StatusZadania").Equals(_STATUS_ZADANIA_ZWOLNIONE))

            .ToList()
            .ForEach(i =>
            {
                SPWorkflow wf = BLL.Workflows.StartWorkflow(i, "Przygotuj wiadomość dla klienta");
                Debug.WriteLine("StartWorkflow: Przygotuj wiadomość dla klienta " + wf.InternalState.ToString());
                BLL.Logger.LogEvent(BLL.Tools.Get_LookupValue(i, "selKlient").ToString(), i.ID.ToString());
            });
        }
Пример #2
0
        public static void Create(Microsoft.SharePoint.SPListItem item)
        {
            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);
                }
            }
        }
 public DeleteFolderCommand(int itemID, string listName, SP.SPWeb web)
     : base(web)
 {
     SP.SPList targetList = _web.Lists.TryGetList(listName);
     if (targetList == default(SP.SPList)) { throw new Exception(string.Format("Could not find any list with the name {0}", listName)); }
     _item = targetList.GetItemByIdSelectedFields(itemID);
 }
 public DeleteFolderCommand(string folderUrl, SP.SPWeb web)
     : base(web)
 {
     SP.SPFolder folder = _web.GetFolder(folderUrl);
     if (!folder.Exists) { throw new Exception(string.Format("Could not find any folder with the url {0}", folder)); }
     _item = folder.Item;
 }
Пример #5
0
        private static string Create_KEY(Microsoft.SharePoint.SPListItem item)
        {
            int klientId = Get_LookupId(item, "selKlient");
            int okresId  = Get_LookupId(item, "selOkres");

            return(Create_KEY(klientId, okresId));
        }
Пример #6
0
 public UpdateItemCommand(SP.SPListItem item, Dictionary<string, object> properties)
     : base()
 {
     _web = item.Web;
     _item = item;
     _newPropertiesValues = properties;
     BackUpOldPropertiesValues();
 }
 public UpdateFolderCommand(string folderUrl, Dictionary<string, object> properties, SP.SPWeb web)
     : base(web)
 {
     SP.SPFolder folder = _web.GetFolder(folderUrl);
     if (!folder.Exists) { throw new Exception(string.Format("Could not find any folder with the url {0}", folder)); }
     _item = folder.Item;
     BackUpOldPropertiesValues();
 }
Пример #8
0
 public UpdateItemCommand(int itemID, string listName, Dictionary<string, object> properties, SP.SPWeb web)
     : base(web)
 {
     SP.SPList targetList = _web.Lists.TryGetList(listName);
     if (targetList == default(SP.SPList)) { throw new Exception(string.Format("Could not find any list with the name {0}", listName)); }
     _item = targetList.GetItemByIdSelectedFields(itemID, properties.Keys.ToArray());
     BackUpOldPropertiesValues();
 }
 public UpdateFolderCommand(SP.SPFolder folder, Dictionary<string, object> properties)
     : base()
 {
     _web = folder.ParentWeb;
     _item = folder.Item;
     _newPropertiesValues = properties;
     BackUpOldPropertiesValues();
 }
Пример #10
0
        internal static string Get_ItemInfo(Microsoft.SharePoint.SPListItem item)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("CT=" + item.ContentType.Name);
            sb.AppendLine("ID=" + item.ID.ToString());

            return(sb.ToString());
        }
Пример #11
0
        public static void Update_PD_Data(Microsoft.SharePoint.SPListItem item)
        {
            string KEY    = Create_KEY(item);
            int    formId = Get_KartaKontrolnaId(item, KEY);

            SPListItem form = Get_KartaKontrolnaById(item.Web, formId);

            Copy_PDFields(item, form);
            form.SystemUpdate();
        }
Пример #12
0
        /// <summary>
        /// How to get attachement URL programatically
        /// </summary>
        /// <param name="oItem"></param>
        /// <returns></returns>
        //public static string GetAttachmentUrls(Microsoft.SharePoint.SPListItem oItem)
        //{

        //    string path = string.Empty;

        //    try
        //    {

        //        path = (from string file in oItem.Attachments
        //                orderby file
        //                select SPUrlUtility.CombineUrl(oItem.Attachments.UrlPrefix, file)).FirstOrDefault();
        //        return path;
        //    }
        //    catch
        //    {
        //        return string.Empty;
        //    }
        //}

        public static string GetAttachmentUrl(Microsoft.SharePoint.SPListItem oItem, string attName)
        {
            string url = string.Empty;

            try
            {
                url = SPUrlUtility.CombineUrl(oItem.Attachments.UrlPrefix, attName);
            }
            catch (Exception)
            {}

            return(url);
        }
Пример #13
0
        private static void Create_New_GFR_K(Microsoft.SharePoint.SPListItem item, string mask, SPList list, SPListItem klientItem)
        {
            string ct      = "Generowanie formatek rozliczeniowych dla klienta";
            int    okresId = BLL.Tools.Get_LookupId(item, "selOkres");

            SPListItem newItem = list.AddItem();

            newItem["ContentType"]     = ct;
            newItem["selKlient"]       = klientItem.ID;
            newItem["selOkres"]        = okresId;
            newItem["colMaskaSerwisu"] = mask;

            newItem.SystemUpdate();
        }
Пример #14
0
        /// <summary>
        /// kopiowanie wartości PD na kartę kontrolną
        /// </summary>
        private static void Copy_PDFields(Microsoft.SharePoint.SPListItem item, SPListItem form)
        {
            Copy_Field(item, form, "colPotwierdzenieOdbioruDokumento");
            Copy_Field(item, form, "colFormaOpodatkowaniaPD");
            Copy_Field(item, form, "enumRozliczeniePD");
            Copy_Field(item, form, "colPD_OcenaWyniku");
            Copy_Field(item, form, "colPD_WartoscDochodu");
            Copy_Field(item, form, "colPD_WartoscDoZaplaty");
            //Copy_Field(item, form, "colPD_WartoscStraty");
            Copy_Field(item, form, "colPD_WartoscStraty", -1);

            Copy_Field(item, "selOperator", form, "selOperator_PD");
            Copy_Field(item, "colUwagi", form, "Uwagi_PD");

            Copy_Field(item, "colNieWysylajDoKlienta", form, "_NieWysylajDoKlienta_PD");

            Copy_Id(item, form, "_ZadanieID_PD");
        }
Пример #15
0
        private static void Create_New_GFR_K(Microsoft.SharePoint.SPListItem item, string mask, SPList list, SPListItem klientItem)
        {
            string ct      = "Generowanie formatek rozliczeniowych dla klienta";
            int    okresId = BLL.Tools.Get_LookupId(item, "selOkres");

            SPListItem newItem = list.AddItem();

            newItem["ContentType"]     = ct;
            newItem["selKlient"]       = klientItem.ID;
            newItem["selOkres"]        = okresId;
            newItem["colMaskaSerwisu"] = mask;

            newItem.SystemUpdate();

            SPWorkflow wf = BLL.Workflows.StartWorkflow(newItem, "Generuj formatki rozliczeniowe dla klienta");

            Debug.WriteLine("StartWorkflow: Generuj formatki rozliczeniowe dla klienta " + wf.InternalState.ToString());
        }
Пример #16
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);
            }
        }
Пример #17
0
        private static void Copy_PDFields(Microsoft.SharePoint.SPListItem item, SPListItem form)
        {
            Copy_Field(item, form, "colPotwierdzenieOdbioruDokumento");
            Copy_Field(item, form, "colFormaOpodatkowaniaPD");
            Copy_Field(item, form, "enumRozliczeniePD");
            Copy_Field(item, form, "colPD_OcenaWyniku");
            Copy_Field(item, form, "colPD_WartoscDochodu");
            Copy_Field(item, form, "colPD_WartoscDoZaplaty");
            Copy_Field(item, form, "colPD_WartoscStraty");

            Copy_Field(item, "selOperator", form, "selOperator_PD");
            Copy_Field(item, "colNotatka", form, "colUwagiPD");
            Copy_Id(item, form, "selZadanie_PD");

            Copy_Field(item, form, "colPD_TerminPlatnosciPodatku");
            Copy_Id(item, form, "selZadanie_PD");
            Copy_Field(item, "enumStatusZadania", form, "colPD_StatusZadania");
            BLL.Tools.Set_Text(form, "colPD_StatusWysylki", string.Empty);
        }
Пример #18
0
        /// <summary>
        /// Inicjuje rekordy rozliczenia wspólników spółek na podstawia aktualnej konfiguracji klienta w kartotece.
        /// </summary>
        public static void Ensure_RecordInitiated(Microsoft.SharePoint.SPWeb web, Microsoft.SharePoint.SPListItem powiazanieItem, int klientId, int okresId)
        {
            int wspolnikId = BLL.Tools.Get_LookupId(powiazanieItem, "selKlient");

            Debug.WriteLine("tab.DochowyWspolnikow.Ensure_RecordInitiated, powiązanieId=" + powiazanieItem.ID.ToString());

            int result = 0;

            SPList list = web.Lists.TryGetList(targetList);

            string key = Define_KEY(klientId, wspolnikId, okresId);

            SPListItem item = list.Items.Cast <SPListItem>()
                              .Where(i => BLL.Tools.Get_Text(i, "KEY").Equals(key))
                              .FirstOrDefault();

            if (item != null)
            {
                result = item.ID;
            }
            else
            {
                //create new record
                SPListItem newItem = list.AddItem();
                newItem["KEY"]       = key;
                newItem["selKlient"] = wspolnikId;
                newItem["selOkres"]  = okresId;

                newItem["selKlient_NazwaSkrocona"] = klientId;
                newItem["colPD_UdzialWZysku"]      = BLL.Tools.Get_Value(powiazanieItem, "colPD_UdzialWZysku");

                newItem.Update();

                result = newItem.ID;
            }
        }
Пример #19
0
 protected void AddElementToList()
 {
     if (string.IsNullOrEmpty(_subfolder)) { _item = _list.AddItem(_subfolder, SP.SPFileSystemObjectType.File); }
     else { _item = _list.AddItem(); }
 }
Пример #20
0
 internal static void Create_RB_Form(Microsoft.SharePoint.SPWeb web, int okresId, Microsoft.SharePoint.SPListItem klientItem, BLL.Models.Klient iok)
 {
     if (BLL.Tools.Has_SerwisAssigned(klientItem, "selSewisy", "RB")) //ograniczony dostęp do tablicy rozliczeń gotówkowych
     {
         SPSecurity.RunWithElevatedPrivileges(delegate()
         {
             using (SPSite eSite = new SPSite(web.Site.ID))
             {
                 using (SPWeb eWeb = eSite.OpenWeb())
                 {
                     string key = BLL.tabRozliczeniaGotowkowe.Define_KEY(klientItem.ID, okresId);
                     if (BLL.tabRozliczeniaGotowkowe.Check_KEY_IsAllowed(key, web, 0))
                     {
                         BLL.tabRozliczeniaGotowkowe.Create_ctRB_Form(web, klientItem.ID, okresId, key, klientItem, iok);
                     }
                 }
             }
         });
     }
 }
Пример #21
0
 private static int Get_LookupId(Microsoft.SharePoint.SPListItem item, string col)
 {
     return(item[col] != null ? new SPFieldLookupValue(item[col].ToString()).LookupId : 0);
 }
Пример #22
0
        public static void Create(Microsoft.SharePoint.SPListItem item)
        {
            BLL.Logger.LogEvent_Procedure("GFR_K_Request.Create", item, "start");

            int    okresId  = BLL.Tools.Get_LookupId(item, "selOkres");
            int    klientId = BLL.Tools.Get_LookupId(item, "selKlient");
            string mask     = BLL.Tools.Get_Text(item, "colMaskaSerwisu");

            if (okresId > 0 && klientId > 0)
            {
                BLL.Models.Klient iok = new BLL.Models.Klient(item.Web, klientId);

                SPListItem klientItem = BLL.tabKlienci.Get_KlientById(item.Web, klientId);

                int formId = BLL.tabKartyKontrolne.Ensure_KartaKontrolna(item.Web, klientId, okresId, iok);

                switch (iok.TypKlienta)
                {
                case "KPiR":
                    if (mask.StartsWith("ZUS-") || string.IsNullOrEmpty(mask))
                    {
                        ZUS_Forms.Manage_ZUS_Form(item.Web, okresId, klientItem, iok);
                    }
                    if (mask.StartsWith("PD-") || string.IsNullOrEmpty(mask))
                    {
                        PD_Forms.Create_PD_Form(item.Web, okresId, klientItem, iok);
                    }
                    if (mask.StartsWith("VAT-") || string.IsNullOrEmpty(mask))
                    {
                        VAT_Forms.Create_VAT_Form(item.Web, okresId, klientItem, iok);
                    }
                    if (mask.Equals("RBR") || string.IsNullOrEmpty(mask))
                    {
                        RBR_Forms.Create_RBR_Form(item.Web, okresId, klientItem, iok);
                    }
                    if (mask.Equals("RB") || string.IsNullOrEmpty(mask))
                    {
                        RB_Forms.Create_RB_Form(item.Web, okresId, klientItem, iok);
                    }
                    break;

                case "KSH":
                    if (mask.StartsWith("ZUS-") || string.IsNullOrEmpty(mask))
                    {
                        ZUS_Forms.Manage_ZUS_Form(item.Web, okresId, klientItem, iok);
                    }
                    if (mask.StartsWith("PDS-") || string.IsNullOrEmpty(mask))
                    {
                        PDS_Forms.Create_PDS_Form(item.Web, okresId, klientItem, iok);
                    }
                    if (mask.StartsWith("VAT-") || string.IsNullOrEmpty(mask))
                    {
                        VAT_Forms.Create_VAT_Form(item.Web, okresId, klientItem, iok);
                    }
                    if (mask.Equals("RBR") || string.IsNullOrEmpty(mask))
                    {
                        RBR_Forms.Create_RBR_Form(item.Web, okresId, klientItem, iok);
                    }
                    break;

                case "Firma":
                    if (mask.StartsWith("PD-") || string.IsNullOrEmpty(mask))
                    {
                        PD_Forms.Create_PD_Form(item.Web, okresId, klientItem, iok);
                    }
                    if (mask.StartsWith("VAT-") || string.IsNullOrEmpty(mask))
                    {
                        VAT_Forms.Create_VAT_Form(item.Web, okresId, klientItem, iok);
                    }
                    break;

                case "Osoba fizyczna":
                    if (mask.StartsWith("ZUS-") || string.IsNullOrEmpty(mask))
                    {
                        ZUS_Forms.Manage_ZUS_Form(item.Web, okresId, klientItem, iok);
                    }
                    if (mask.StartsWith("PD-") || string.IsNullOrEmpty(mask))
                    {
                        PD_Forms.Create_PD_Form(item.Web, okresId, klientItem, iok);
                    }
                    break;

                default:
                    break;
                }
            }

            BLL.Logger.LogEvent_Procedure("GFR_K_Request.Create", item, "end");
        }
 public DeleteFolderCommand(SP.SPListItem item)
     : base()
 {
     _web = item.Web;
     _item = item;
 }