Esempio n. 1
0
        private static void Import_Firma(Microsoft.SharePoint.SPWeb web, SPList list)
        {
            list.Items.Cast <SPListItem>()
            .Where(i => i["colTypRekordu"].ToString() == "Firma")
            .ToList()
            .ForEach(item =>
            {
                string nazwaSkrocona = item["colNazwaSkrocona"] != null ? item["colNazwaSkrocona"].ToString() : string.Empty;
                string nazwa         = item["colNazwa"] != null ? item["colNazwa"].ToString() : string.Empty;
                int klientId         = tabKlienci.Get_KlientByNazwaSkrocona(web, nazwaSkrocona);

                if (!string.IsNullOrEmpty(nazwa) &&
                    !string.IsNullOrEmpty(nazwaSkrocona) &&
                    klientId > 0)
                {
                    int firmaId = tabKlienci.Get_FirmaByNazwa(web, nazwaSkrocona, nazwa);

                    if (firmaId == 0)
                    {
                        firmaId = tabKlienci.AddNew_Firma_Klient(web, item, klientId);

                        item["selKlient"] = firmaId;
                        item.SystemUpdate();
                    }
                }
            });
        }
Esempio n. 2
0
 private SPFile GetFileFromUrl(string url, Microsoft.SharePoint.SPWeb web)
 {
     ConfirmNotNullOrEmpty(url, "url");
     ConfirmNotNull(web, "web");
     Microsoft.SharePoint.SPFile fileOrFolderObject = null;
     try
     {
         fileOrFolderObject = web.GetFileOrFolderObject(url) as Microsoft.SharePoint.SPFile;
     }
     catch (SPException ex)
     {
         SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data);
     }
     catch (FileNotFoundException ex)
     {
         SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data);
     }
     catch (ArgumentException ex)
     {
         SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data);
     }
     catch (PathTooLongException ex)
     {
         SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data);
     }
     return(fileOrFolderObject);
 }
Esempio n. 3
0
        private static void Import_OsobaFizyczna(Microsoft.SharePoint.SPWeb web, SPList list)
        {
            list.Items.Cast <SPListItem>()
            .Where(i => i["colTypRekordu"].ToString() == "Osoba fizyczna")
            .ToList()
            .ForEach(item =>
            {
                string nazwaSkrocona = item["colNazwaSkrocona"] != null ? item["colNazwaSkrocona"].ToString() : string.Empty;
                string pesel         = item["colPESEL"] != null ? item["colPESEL"].ToString() : string.Empty;
                int klientId         = tabKlienci.Get_KlientByNazwaSkrocona(web, nazwaSkrocona);

                if (!string.IsNullOrEmpty(pesel) &&
                    !string.IsNullOrEmpty(nazwaSkrocona) &&
                    klientId > 0)
                {
                    int osobaId = tabKlienci.Get_OsobaFizycznaByPesel(web, nazwaSkrocona, pesel);

                    if (osobaId == 0)
                    {
                        osobaId = tabKlienci.AddNew_OsobaFizyczna_Klient(web, item, klientId);

                        item["selKlient"] = osobaId;
                        item.SystemUpdate();
                    }
                }
            });
        }
Esempio n. 4
0
        public static int Ensure_RecordExist(Microsoft.SharePoint.SPWeb web, int klientId, int targetYear)
        {
            int result = 0;

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

            string key = Define_KEY(klientId, targetYear);

            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"]          = klientId;
                newItem["colRokObrachunkowy"] = targetYear;

                newItem.SystemUpdate();

                result = newItem.ID;
            }

            return(result);
        }
Esempio n. 5
0
        private void DeployWebWorkflowAssociationDefinition(WebModelHost modelHost, Microsoft.SharePoint.SPWeb web, WorkflowAssociationDefinition definition)
        {
            var existingWorkflowAssotiation = FindExistringWorkflowAssotiation(modelHost, definition);

            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model            = null,
                EventType        = ModelEventType.OnProvisioning,
                Object           = existingWorkflowAssotiation,
                ObjectType       = typeof(SPWorkflowAssociation),
                ObjectDefinition = definition,
                ModelHost        = modelHost
            });

            bool isNew = false;

            if (existingWorkflowAssotiation == null)
            {
                var workflowTemplate = GetWorkflowTemplate(modelHost, definition);

                if (workflowTemplate == null)
                {
                    throw new SPMeta2Exception(
                              string.Format("Cannot find workflow template by definition:[{0}]", definition));
                }

                existingWorkflowAssotiation = SPWorkflowAssociation.CreateListAssociation(workflowTemplate,
                                                                                          definition.Name,
                                                                                          web.Lists[definition.TaskListTitle],
                                                                                          web.Lists[definition.HistoryListTitle]);

                isNew = true;
            }

            MapProperties(definition, existingWorkflowAssotiation);

            InvokeOnModelEvent(this, new ModelEventArgs
            {
                CurrentModelNode = null,
                Model            = null,
                EventType        = ModelEventType.OnProvisioned,
                Object           = existingWorkflowAssotiation,
                ObjectType       = typeof(SPWorkflowAssociation),
                ObjectDefinition = definition,
                ModelHost        = modelHost
            });

            if (isNew)
            {
                web.WorkflowAssociations.Add(existingWorkflowAssotiation);
                web.Update();
            }
            else
            {
                web.WorkflowAssociations.Update(existingWorkflowAssotiation);
            }
        }
Esempio n. 6
0
 /// <summary>Retrieves the ID of the site.</summary>
 /// <returns>The ID of the site.</returns>
 string WebId()
 {
     using (Microsoft.SharePoint.SPSite site = new Microsoft.SharePoint.SPSite(URL))
     {
         using (Microsoft.SharePoint.SPWeb web = site.OpenWeb())
         {
             return(web.ID.ToString());
         }
     }
 }
Esempio n. 7
0
        const string targetList = @"Faktury za obsługę - import"; //"intFakturyZaObsluge";

        public static void Execute(SPListItem item, Microsoft.SharePoint.SPWeb web)
        {
            int okresId = new SPFieldLookupValue(item["selOkres"].ToString()).LookupId;

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

            list.Items.Cast <SPListItem>()
            .ToList()
            .ForEach(oItem =>
            {
                Import_DaneOFakturze(web, oItem, okresId);
            });
        }
Esempio n. 8
0
        internal static SPListItem GetItemById(Microsoft.SharePoint.SPWeb web, int operatorId)
        {
            SPList     list   = web.Lists.TryGetList(targetList);
            SPListItem result = null;

            try
            {
                result = list.Items.GetItemById(operatorId);
            }
            catch (Exception)
            {}

            return(result);
        }
Esempio n. 9
0
        internal static int Get_IdByKod(Microsoft.SharePoint.SPWeb web, string serwisName)
        {
            SPList     list = web.Lists.TryGetList(targetList);
            SPListItem item = list.Items.Cast <SPListItem>()
                              .Where(i => i.Title == serwisName)
                              .FirstOrDefault();

            if (item != null)
            {
                return(item.ID);
            }

            return(0);
        }
Esempio n. 10
0
        internal static string GetValue(Microsoft.SharePoint.SPWeb web, string key)
        {
            SPListItem item = GetList(web).Items.Cast <SPListItem>()
                              .Where(i => i["KEY"].ToString() == key)
                              .FirstOrDefault();

            if (item != null)
            {
                return(item["VALUE"].ToString());
            }
            //}

            return(string.Empty);
        }
Esempio n. 11
0
        const string targetList = "Terminy płatności"; // "dicTerminyPlatnosci";

        internal static int Get_TerminPlatnosci(Microsoft.SharePoint.SPWeb web, int terminPlatnosciId)
        {
            int result = 0;

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

            SPListItem item = list.GetItemById(terminPlatnosciId);

            if (item != null)
            {
                result = item["colLiczbaDni"] != null?int.Parse(item["colLiczbaDni"].ToString()) : 0;
            }

            return(result);
        }
Esempio n. 12
0
        const string targetList = "Szablony wiadomości"; //"tabSzablonyWiadomosci";

        public static int GetSzablonId(Microsoft.SharePoint.SPWeb web, string nazwaSzablonu)
        {
            SPList list = web.Lists.TryGetList(targetList);

            SPListItem item = list.Items.Cast <SPListItem>()
                              .Where(i => i.Title == nazwaSzablonu)
                              .FirstOrDefault();

            if (item != null)
            {
                return(item.ID);
            }

            return(0);
        }
Esempio n. 13
0
        internal static double Get_OplataMiesieczna(Microsoft.SharePoint.SPWeb web, int klientId)
        {
            SPList     list = web.Lists.TryGetList(targetList);
            SPListItem item = list.Items.Cast <SPListItem>()
                              .Where(i => BLL.Tools.Get_LookupId(i, "selKlient").Equals(klientId))
                              .FirstOrDefault();

            if (item != null)
            {
                return(BLL.Tools.Get_Double(item, "colOplataMiesieczna"));
            }
            else
            {
                return(0);
            }
        }
Esempio n. 14
0
        public static bool Check_KEY_IsAllowed(string key, Microsoft.SharePoint.SPWeb web, int currentId)
        {
            bool result = true;

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

            Array li = list.Items.Cast <SPListItem>()
                       .Where(i => i.ID != currentId)
                       .Where(i => BLL.Tools.Get_Text(i, "KEY").Equals(key))
                       .ToArray();

            if (li.Length > 0)
            {
                result = false;
            }

            return(result);
        }
Esempio n. 15
0
        internal static int Get_IdByName(Microsoft.SharePoint.SPWeb web, string v)
        {
            SPList     list = web.Lists.TryGetList(targetList);
            SPListItem item = list.Items.Cast <SPListItem>()
                              .Where(i => i.Title == v)
                              .FirstOrDefault();

            if (item != null)
            {
                return(item.ID);
            }

            SPListItem newItem = list.AddItem();

            newItem["Title"] = v;
            newItem.SystemUpdate();

            return(newItem.ID);
        }
Esempio n. 16
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);
                     }
                 }
             }
         });
     }
 }
Esempio n. 17
0
        internal static Models.KontaZUS GetKontaZUS(Microsoft.SharePoint.SPWeb web)
        {
            SPList list = web.Lists.TryGetList(targetList);

            KontaZUS obj = new Models.KontaZUS();

            if (list != null)
            {
                //SP
                SPListItem item = list.Items.Cast <SPListItem>()
                                  .Where(i => i["KEY"].ToString() == @"ZUS_SP_KONTO")
                                  .FirstOrDefault();

                if (item != null)
                {
                    obj.KontoSP = item["VALUE"].ToString();
                }

                //ZD
                item = list.Items.Cast <SPListItem>()
                       .Where(i => i["KEY"].ToString() == @"ZUS_ZD_KONTO")
                       .FirstOrDefault();

                if (item != null)
                {
                    obj.KontoZD = item["VALUE"].ToString();
                }

                //FP
                item = list.Items.Cast <SPListItem>()
                       .Where(i => i["KEY"].ToString() == @"ZUS_FP_KONTO")
                       .FirstOrDefault();

                if (item != null)
                {
                    obj.KontoFP = item["VALUE"].ToString();
                }
            }

            return(obj);
        }
Esempio n. 18
0
        private static void Import_KPiR(Microsoft.SharePoint.SPWeb web, SPList list)
        {
            list.Items.Cast <SPListItem>()
            .Where(i => i["colTypRekordu"].ToString() == "KPiR")
            .ToList()
            .ForEach(item =>
            {
                string nazwaSkrocona = item["colNazwaSkrocona"] != null ? item["colNazwaSkrocona"].ToString() : string.Empty;

                if (!string.IsNullOrEmpty(nazwaSkrocona))
                {
                    int klientId = tabKlienci.Get_KlientByNazwaSkrocona(web, nazwaSkrocona);
                    if (klientId == 0)
                    {
                        klientId          = tabKlienci.AddNew_KPiR_Klient(web, nazwaSkrocona, item);
                        item["selKlient"] = klientId;
                        item.SystemUpdate();
                    }
                }
            });
        }
Esempio n. 19
0
        public static void Execute(SPListItem item, Microsoft.SharePoint.SPWeb web, out string message)
        {
            StringBuilder sb = new StringBuilder();

            //sprawdź parametry wywołania
            SPFieldMultiChoiceValue wt = new SPFieldMultiChoiceValue(item["enumTypKlienta"].ToString());

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

            for (int i = 0; i < wt.Count; i++)
            {
                switch (wt[i])
                {
                case "KPiR":
                    Import_KPiR(web, list);
                    sb.AppendFormat(@"<li>{1} Import {0} zakończony</li>", wt[i], DateTime.Now.ToString());
                    break;

                case "KSH":
                    Import_KSH(web, list);
                    sb.AppendFormat(@"<li>{1} Import {0} zakończony</li>", wt[i], DateTime.Now.ToString());
                    break;

                case "Osoba fizyczna":
                    Import_OsobaFizyczna(web, list);
                    sb.AppendFormat(@"<li>{1} Import {0} zakończony</li>", wt[i], DateTime.Now.ToString());
                    break;

                case "Firma":
                    Import_Firma(web, list);
                    sb.AppendFormat(@"<li>{1} Import {0} zakończony</li>", wt[i], DateTime.Now.ToString());
                    break;

                default:
                    break;
                }
            }

            message = String.Format(@"<ul>{0}</ul>", sb.ToString());
        }
Esempio n. 20
0
        public Okres(Microsoft.SharePoint.SPWeb web, int okresId)
        {
            this.web     = web;
            this.okresId = okresId;

            SPList     list = web.Lists.TryGetList(targetList);
            SPListItem item = list.GetItemById(okresId);

            if (item != null)
            {
                this.Nazwa           = BLL.Tools.Get_Text(item, "Title");
                this.DataRozpoczecia = BLL.Tools.Get_Date(item, "colDataRozpoczecia");
                this.DataZakonczenia = BLL.Tools.Get_Date(item, "colDataZakonczenia");

                Skladka_ZUS_M_SP  = BLL.Tools.Get_Double(item, "colZUS_M_SP_Skladka");
                Skladka_ZUS_M_SPC = BLL.Tools.Get_Double(item, "colZUS_M_SPC_Skladka");
                Skladka_ZUS_D_SP  = BLL.Tools.Get_Double(item, "colZUS_D_SP_Skladka");
                Skladka_ZUS_D_SPC = BLL.Tools.Get_Double(item, "colZUS_D_SPC_Skladka");
                Skladka_ZUS_M_ZD  = BLL.Tools.Get_Double(item, "colZUS_M_ZD_Skladka");
                Skladka_ZUS_D_ZD  = BLL.Tools.Get_Double(item, "colZUS_D_ZD_Skladka");
                Skladka_ZUS_M_FP  = BLL.Tools.Get_Double(item, "colZUS_M_FP_Skladka");
                Skladka_ZUS_D_FP  = BLL.Tools.Get_Double(item, "colZUS_D_FP_Skladka");

                TerminPlatnosciSkladek_ZUS_BezPracownikow = BLL.Tools.Get_Date(item, "colZUS_TerminPlatnosciSkladek_BezPracownikow");
                TerminPlatnosciSkladek_ZUS_ZPracownikami  = BLL.Tools.Get_Date(item, "colZUS_TerminPlatnosciSkladek_ZPracownikami");
                TerminPrzekazaniaWynikow_ZUS_Ofset        = BLL.Tools.Get_Double(item, "ZUS_TerminPrzekazaniaWynikow_Ofset");

                TerminPlatnosciPodatkuPD         = BLL.Tools.Get_Date(item, "colPD_TerminPlatnosciPodatku");
                TerminPlatnosciPodatkuPD_KW      = BLL.Tools.Get_Date(item, "colPD_TerminPlatnosciPodatkuKW");
                TerminPrzekazaniaWynikowPD_Ofset = BLL.Tools.Get_Double(item, "colPD_TerminPrzekazaniaWynikow_Ofset");

                TerminPlatnosciPodatkuVAT         = BLL.Tools.Get_Date(item, "colVAT_TerminPlatnosciPodatku");
                TerminPlatnosciPodatkuVAT_KW      = BLL.Tools.Get_Date(item, "colVAT_TerminPlatnosciPodatkuKW");
                TerminPrzekazaniaWynikowVAT_Ofset = BLL.Tools.Get_Double(item, "colVAT_TerminPrzekazaniaWynikow_Ofset");

                TerminPrzekazaniaRBR = BLL.Tools.Get_Date(item, "colBR_TerminPrzekazania");
            }
        }
Esempio n. 21
0
        public Okres(Microsoft.SharePoint.SPWeb web, int okresId)
        {
            this.web = web;
            this.okresId = okresId;

            SPList list = web.Lists.TryGetList(targetList);
            SPListItem item = list.GetItemById(okresId);
            if (item != null)
            {
                this.Nazwa = BLL.Tools.Get_Text(item, "Title");
                this.DataRozpoczecia = BLL.Tools.Get_Date(item, "colDataRozpoczecia");
                this.DataZakonczenia = BLL.Tools.Get_Date(item, "colDataZakonczenia");

                Skladka_ZUS_M_SP = BLL.Tools.Get_Double(item, "colZUS_M_SP_Skladka");
                Skladka_ZUS_M_SPC = BLL.Tools.Get_Double(item, "colZUS_M_SPC_Skladka");
                Skladka_ZUS_D_SP = BLL.Tools.Get_Double(item, "colZUS_D_SP_Skladka");
                Skladka_ZUS_D_SPC = BLL.Tools.Get_Double(item, "colZUS_D_SPC_Skladka");
                Skladka_ZUS_M_ZD = BLL.Tools.Get_Double(item, "colZUS_M_ZD_Skladka");
                Skladka_ZUS_D_ZD = BLL.Tools.Get_Double(item, "colZUS_D_ZD_Skladka");
                Skladka_ZUS_M_FP = BLL.Tools.Get_Double(item, "colZUS_M_FP_Skladka");
                Skladka_ZUS_D_FP = BLL.Tools.Get_Double(item, "colZUS_D_FP_Skladka");

                TerminPlatnosciSkladek_ZUS_BezPracownikow = BLL.Tools.Get_Date(item, "colZUS_TerminPlatnosciSkladek_BezPracownikow");
                TerminPlatnosciSkladek_ZUS_ZPracownikami = BLL.Tools.Get_Date(item, "colZUS_TerminPlatnosciSkladek_ZPracownikami");
                TerminPrzekazaniaWynikow_ZUS_Ofset = BLL.Tools.Get_Double(item, "ZUS_TerminPrzekazaniaWynikow_Ofset");

                TerminPlatnosciPodatkuPD = BLL.Tools.Get_Date(item, "colPD_TerminPlatnosciPodatku");
                TerminPlatnosciPodatkuPD_KW = BLL.Tools.Get_Date(item, "colPD_TerminPlatnosciPodatkuKW");
                TerminPrzekazaniaWynikowPD_Ofset = BLL.Tools.Get_Double(item, "colPD_TerminPrzekazaniaWynikow_Ofset");

                TerminPlatnosciPodatkuVAT = BLL.Tools.Get_Date(item, "colVAT_TerminPlatnosciPodatku");
                TerminPlatnosciPodatkuVAT_KW = BLL.Tools.Get_Date(item, "colVAT_TerminPlatnosciPodatkuKW");
                TerminPrzekazaniaWynikowVAT_Ofset = BLL.Tools.Get_Double(item, "colVAT_TerminPrzekazaniaWynikow_Ofset");

                TerminPrzekazaniaRBR = BLL.Tools.Get_Date(item, "colBR_TerminPrzekazania");
            }
        }
Esempio n. 22
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;
            }
        }
Esempio n. 23
0
        const string targetList = @"Przeterminowane należności - import"; //"intPrzeterminowaneNaleznosci";

        public static void Execute(SPListItem item, Microsoft.SharePoint.SPWeb web)
        {
            string mode = item["cmdPrzeterminowaneNaleznosci"] != null ? item["cmdPrzeterminowaneNaleznosci"].ToString() : string.Empty;

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


            Array aRekordy = list.Items.Cast <SPListItem>()
                             .OrderBy(i => i["Title"].ToString())
                             .ThenBy(i => i["colDataSprzedazy"].ToString())
                             .ThenBy(i => i["colTerminPlatnosci"].ToString())
                             .ToArray();

            List <string> lstDluznicy = new List <string>();

            if (aRekordy != null)
            {
                string klient  = string.Empty;
                string klient0 = string.Empty;
                foreach (SPListItem oItem in aRekordy)
                {
                    string dluznik = oItem["Title"].ToString();

                    if (!lstDluznicy.Exists(i => i == dluznik))
                    {
                        lstDluznicy.Add(dluznik);
                    }
                }
            }

            foreach (string dluznik in lstDluznicy)
            {
                int klientId = tabKlienci.Get_KlientId_BestFit(web, dluznik);
                if (klientId > 0)
                {
                    Array items = list.Items.Cast <SPListItem>()
                                  .Where(i => i["Title"].ToString() == dluznik)
                                  .ToArray();

                    StringBuilder sb          = new StringBuilder();
                    string        rowTemplate = dicSzablonyKomunikacji.Get_TemplateByKod(web, "OVERDUE_PAYMENTS_TR_TEMPLATE", false);
                    double        value1total = 0;
                    double        value2total = 0;


                    foreach (SPListItem oItem in items)
                    {
                        oItem["selKlient"] = klientId;
                        oItem.SystemUpdate();


                        StringBuilder sbRow = new StringBuilder(rowTemplate);
                        sbRow.Replace("___colNumerFaktury___", oItem["colNumerFaktury"].ToString());
                        sbRow.Replace("___colDataSprzedazy___", oItem["colDataSprzedazy"].ToString());
                        sbRow.Replace("___colDataWystawienia___", oItem["colDataWystawienia"].ToString());
                        sbRow.Replace("___colTerminPlatnosci___", oItem["colTerminPlatnosci"].ToString());

                        //int dniZwloki = (DateTime.Today - DateTime.Parse(oItem["colTerminPlatnosci"].ToString())).Days;

                        double value1 = Double.Parse(oItem["colKwotaFaktury"].ToString());
                        value1total = value1total + value1;
                        double value2 = Double.Parse(oItem["colKwotaDlugu"].ToString());
                        value2total = value2total + value2;

                        sbRow.Replace("___colKwotaFaktury___", BLL.Tools.Format_Currency(value1));
                        sbRow.Replace("___colZaplacono___", BLL.Tools.Format_Currency(value1 - value2));
                        sbRow.Replace("___colKwotaDlugu___", BLL.Tools.Format_Currency(value2));

                        sb.Append(sbRow);
                    }

                    string temat;
                    string trescHTML;

                    //StringBuilder sb0 = new StringBuilder(dicSzablonyKomunikacji.Get_TemplateByKod(web, "OVERDUE_PAYMENTS_TEMPLATE.Include", false));
                    dicSzablonyKomunikacji.Get_TemplateByKod(web, "OVERDUE_PAYMENTS_TEMPLATE.Include", out temat, out trescHTML, false);
                    StringBuilder sb0 = new StringBuilder(trescHTML);
                    sb0.Replace("___TABLE_ROW___", sb.ToString());
                    sb0.Replace("___colKwotaFakturyRazem___", BLL.Tools.Format_Currency(value1total));
                    sb0.Replace("___colKwotaDluguRazem___", BLL.Tools.Format_Currency(value2total));


                    StringBuilder lt = new StringBuilder(dicSzablonyKomunikacji.Get_TemplateByKod(web, "OVERDUE_PAYMENTS_LEADING_TEXT", false));
                    lt.Replace("___FIRMA___", BLL.tabKlienci.Get_NazwaFirmyById(web, klientId));
                    lt.Replace("___ADRES___", BLL.tabKlienci.Get_PelnyAdresFirmyById(web, klientId));
                    lt.Replace("___DATA___", DateTime.Now.ToShortDateString());
                    sb0.Replace("___OVERDUE_PAYMENTS_LEADING_TEXT___", lt.ToString());

                    StringBuilder tt = new StringBuilder(dicSzablonyKomunikacji.Get_TemplateByKod(web, "OVERDUE_PAYMENTS_TRAILING_TEXT", false));
                    tt.Replace("___DATA___", DateTime.Now.ToShortDateString());
                    tt.Replace("___KwotaDoZaplaty___", BLL.Tools.Format_Currency(value2total));
                    sb0.Replace("___OVERDUE_PAYMENTS_TRAILING_TEXT___", tt.ToString());


                    if (mode == "Import")
                    {
                        //zapisz w buforze wiadomości o ile

                        string nadawca  = BLL.admSetup.GetValue(web, "EMAIL_BIURA");
                        string odbiorca = BLL.tabKlienci.Get_EmailById(web, klientId);
                        string kopiaDla = BLL.dicOperatorzy.EmailByUserId(web, item.Web.CurrentUser.ID);

                        //dodanie nazwy firmy do tematu
                        temat = BLL.Tools.AddCompanyName(web, temat, klientId);

                        trescHTML = sb0.ToString();

                        BLL.tabWiadomosci.AddNew(web, null, nadawca, odbiorca, kopiaDla, false, true, temat, string.Empty, trescHTML, new DateTime(), 0, klientId, BLL.Models.Marker.NoAttachements);

                        foreach (SPListItem oItem in items)
                        {
#if DEBUG
                            // w trybie debugowania przetworzony rekord nie jest usówany z tablicy źródłowej
#else
                            oItem.Delete();
#endif
                        }
                    }

                    // jeżeli mode "Weryfikacja" to jedynie mamy przypisanie kodu klient do rekordu i dzięki temu wiemy czy rekord został rozpoznany czy nie
                }
            }
        }
Esempio n. 24
0
 public static void Execute(SPListItem item, Microsoft.SharePoint.SPWeb web)
 {
     ManageTasks_WorkingHours(item);
     ManageTasks(item);
 }
Esempio n. 25
0
        internal static SPListItem GetItemById(Microsoft.SharePoint.SPWeb web, int operatorId)
        {
            SPList list = web.Lists.TryGetList(targetList);

            return(list.Items.GetItemById(operatorId));
        }
Esempio n. 26
0
        public Klient(Microsoft.SharePoint.SPWeb web, int klientId)
        {
            this.web      = web;
            this.klientId = klientId;

            SPListItem item = tabKlienci.Get_KlientById(web, klientId);

            if (item != null)
            {
                this.TypKlienta        = item.ContentType.Name;
                OddzialZUSId           = item["selOddzialZUS"] != null ? new SPFieldLookupValue(item["selOddzialZUS"].ToString()).LookupId : 0;
                FormaOpodatkowaniaZUS  = item["colFormaOpodakowania_ZUS"] != null ? item["colFormaOpodakowania_ZUS"].ToString() : string.Empty;
                FormaOpodatkowaniaKPiR = item["colFormaOpodatkowaniaPD_KPiR"] != null ? item["colFormaOpodatkowaniaPD_KPiR"].ToString() : string.Empty;
                FormaOpodatkowaniaKSH  = item["colFormaOpodatkowaniaPD_KSH"] != null ? item["colFormaOpodatkowaniaPD_KSH"].ToString() : string.Empty;
                FormaOpodatkowaniaVAT  = item["colFormaOpodatkowaniaVAT"] != null ? item["colFormaOpodatkowaniaVAT"].ToString() : string.Empty;

                RozliczeniePD  = item["enumRozliczeniePD"] != null ? item["enumRozliczeniePD"].ToString() : string.Empty;
                RozliczenieVAT = item["enumRozliczenieVAT"] != null ? item["enumRozliczenieVAT"].ToString() : string.Empty;


                string ct = item["ContentType"].ToString();
                //Forma opodatkowania
                switch (ct)
                {
                case "KPiR":
                case "Osoba fizyczna":
                    FormaOpodatkowaniaPD = FormaOpodatkowaniaKPiR;
                    break;

                case "KSH":
                case "Firma":
                    FormaOpodatkowaniaPD = FormaOpodatkowaniaKSH;
                    break;

                default:
                    FormaOpodatkowaniaPD = string.Empty;
                    break;
                }

                //Pełna nazwa firmy
                switch (ct)
                {
                case "KPiR":
                    this.FormaPrawna     = item["enumFormaPrawna_KPiR"] != null ? item["enumFormaPrawna_KPiR"].ToString() : string.Empty;
                    this.PelnaNazwaFirmy = item.Title;
                    break;

                case "KSH":
                    this.PelnaNazwaFirmy = item.Title;
                    this.FormaPrawna     = item["enumFormaPrawna"] != null ? item["enumFormaPrawna"].ToString() : string.Empty;
                    break;

                case "Osoba fizyczna":

                    this.PelnaNazwaFirmy = string.Format("{0} {1} {2}",
                                                         item["colImie"] != null ? item["colImie"].ToString() : string.Empty,
                                                         item["colNazwisko"] != null ? item["colNazwisko"].ToString() : string.Empty,
                                                         item["colPESEL"] != null ? "pesel: " + item["colPESEL"].ToString() : string.Empty).Trim();
                    break;

                case "Firma":
                    this.PelnaNazwaFirmy = item["colNazwa"] != null ? item["colNazwa"].ToString() : string.Empty;
                    break;

                default:
                    this.PelnaNazwaFirmy = string.Empty;
                    break;
                }

                OsobaDoKontaktu = item["colOsobaDoKontaktu"] != null ? item["colOsobaDoKontaktu"].ToString() : string.Empty;

                this.Email = BLL.Tools.Get_Email(item, "colEmail");

                this.PreferowanaFormaKontaktu = BLL.Tools.Get_Text(item, "enumPreferowanaFormaKomunikacji");
                if (this.PreferowanaFormaKontaktu.Equals("Email"))
                {
                    this.KopiaDla = BLL.Tools.Get_Email(item, "colEmailCC");
                }
                else
                {
                    this.KopiaDla = string.Empty;
                }

                Telefon = item["colTelefon"] != null ? item["colTelefon"].ToString() : string.Empty;


                Adres                  = item["colAdres"] != null ? item["colAdres"].ToString() : string.Empty;
                KodPocztowy            = item["colKodPocztowy"] != null ? item["colKodPocztowy"].ToString() : string.Empty;
                Miejscowosc            = item["colMiejscowosc"] != null ? item["colMiejscowosc"].ToString() : string.Empty;
                NIP                    = item["colNIP"] != null ? item["colNIP"].ToString() : string.Empty;
                NazwaFirmy             = BLL.Tools.Get_Text(item, "colNazwaFirmy");
                this.NazwaPrezentowana = BLL.Tools.Get_Text(item, "_NazwaPrezentowana");
                Regon                  = item["colRegon"] != null ? item["colRegon"].ToString() : string.Empty;

                this.ZatrudniaPracownikow = item["colZatrudniaPracownikow"] != null?bool.Parse(item["colZatrudniaPracownikow"].ToString()) : false;

                this.ZablokujFunduszPracy = BLL.Tools.Get_Flag(item, "colZablokujFunduszPracy");

                if (item["selTerminPlatnosci"] != null)
                {
                    int terminPlatnosciId = new SPFieldLookupValue(item["selTerminPlatnosci"].ToString()).LookupId;
                    this.TerminPlatnosci = dicTerminyPlatnosci.Get_TerminPlatnosci(web, terminPlatnosciId);
                }
                else
                {
                    this.TerminPlatnosci = 0;
                }

                //operatorzy
                this.OperatorId_Audyt   = item["selDedykowanyOperator_Audyt"] != null ? new SPFieldLookupValue(item["selDedykowanyOperator_Audyt"].ToString()).LookupId : 0;
                this.OperatorId_Podatki = item["selDedykowanyOperator_Podatki"] != null ? new SPFieldLookupValue(item["selDedykowanyOperator_Podatki"].ToString()).LookupId : 0;
                this.OperatorId_Kadry   = item["selDedykowanyOperator_Kadry"] != null ? new SPFieldLookupValue(item["selDedykowanyOperator_Kadry"].ToString()).LookupId : 0;

                //Daty
                this.DataRozpoczeciaDzialalnosci = BLL.Tools.Get_Date(item, "colDataRozpoczeciaDzialalnosci");

                //Serwisy

                this.Serwisy = BLL.Tools.Get_LookupValueCollection(item, "selSewisy");
                this.PrzypomnienieOTerminiePlatnosci = BLL.Tools.Get_Flag(item, "colPrzypomnienieOTerminiePlatnos");
                this.GenerowanieDrukuWplaty          = BLL.Tools.Get_Flag(item, "colDrukWplaty");
                this.AudytDanych = BLL.Tools.Get_Flag(item, "colAudytDanych");

                // PIT
                try
                {
                    int urzadId = item["selUrzadSkarbowy"] != null ? new SPFieldLookupValue(item["selUrzadSkarbowy"].ToString()).LookupId : 0;
                    urzadId = BLL.dicUrzedySkarbowe.Ensure(web, urzadId);
                    if (urzadId > 0)
                    {
                        this.NumerRachunkuVAT   = tabUrzedySkarbowe.Get_NumerRachunkuVATById(web, urzadId);
                        this.NumerRachunkuZUSPD = tabUrzedySkarbowe.Get_NumerRachunkuPITById(web, urzadId);

                        if (this.FormaOpodatkowaniaPD == "CIT")
                        {
                            NumerRachunkuPD = tabUrzedySkarbowe.Get_NumerRachunkuCITById(web, urzadId);
                        }
                        else
                        {
                            NumerRachunkuPD = tabUrzedySkarbowe.Get_NumerRachunkuPITById(web, urzadId);
                        }

                        NazwaUrzeduSkarbowego = tabUrzedySkarbowe.Get_NazwaUrzeduById(web, urzadId);
                        UrzadSkarbowyId       = urzadId;
                    }
                    else
                    {
                        NumerRachunkuPD = string.Empty;
                        UrzadSkarbowyId = 0;
                    }
                }
                catch (Exception ex)
                {
#if DEBUG
                    throw ex;
#else
                    BLL.Logger.LogEvent(web.Url, ex.ToString() + " KlientId= " + klientId.ToString());
                    var result = ElasticEmail.EmailGenerator.ReportError(ex, web.Url, BLL.Tools.Get_ItemInfo(item));
#endif
                }

                //VAT

                try
                {
                    int urzadVATId = item["selUrzadSkarbowyVAT"] != null ? new SPFieldLookupValue(item["selUrzadSkarbowyVAT"].ToString()).LookupId : 0;
                    urzadVATId = BLL.dicUrzedySkarbowe.Ensure(web, urzadVATId);
                    if (urzadVATId > 0)
                    {
                        NumerRachunkuVAT         = tabUrzedySkarbowe.Get_NumerRachunkuVATById(web, urzadVATId);
                        NazwaUrzeduSkarbowegoVAT = tabUrzedySkarbowe.Get_NazwaUrzeduById(web, urzadVATId);
                        UrzadSkarbowyVATId       = urzadVATId;
                    }
                    else
                    {
                        //Przyjmij parametry jak dla US od podatku PIT
                        NumerRachunkuVAT         = this.NumerRachunkuVAT;
                        NazwaUrzeduSkarbowegoVAT = this.NazwaUrzeduSkarbowego;
                        UrzadSkarbowyVATId       = this.UrzadSkarbowyId;
                    }
                }
                catch (Exception ex)
                {
#if DEBUG
                    throw ex;
#else
                    BLL.Logger.LogEvent(web.Url, ex.ToString() + " KlientId= " + klientId.ToString());
                    var result = ElasticEmail.EmailGenerator.ReportError(ex, web.Url, BLL.Tools.Get_ItemInfo(item));
#endif
                }

                // ZUS

                try
                {
                    int oddzialZUSId = item["selOddzialZUS"] != null ? new SPFieldLookupValue(item["selOddzialZUS"].ToString()).LookupId : 0;
                    oddzialZUSId = BLL.dicOddzialyZUS.Ensure(web, oddzialZUSId);
                    if (oddzialZUSId > 0)
                    {
                        this.OddzialZUSId = oddzialZUSId;
                    }
                    else
                    {
                        //Przyjmij parametry jak dla US od podatku PIT
                        NumerRachunkuVAT         = this.NumerRachunkuPD;
                        NazwaUrzeduSkarbowegoVAT = this.NazwaUrzeduSkarbowego;
                        UrzadSkarbowyVATId       = this.UrzadSkarbowyId;
                    }
                }
                catch (Exception ex)
                {
#if DEBUG
                    throw ex;
#else
                    BLL.Logger.LogEvent(web.Url, ex.ToString() + " KlientId= " + klientId.ToString());
                    var result = ElasticEmail.EmailGenerator.ReportError(ex, web.Url, BLL.Tools.Get_ItemInfo(item));
#endif
                }

                //uwagi

                this.UwagiPD      = BLL.Tools.Get_Text(item, "colUwagiPD");
                this.UwagiVAT     = BLL.Tools.Get_Text(item, "colUwagiVAT");
                this.UwagiKadrowe = BLL.Tools.Get_Text(item, "colUwagiKadrowe");
                this.Uwagi        = BLL.Tools.Get_Text(item, "colUwagi");

                this.OplataMiesieczna = BLL.Tools.Get_Double(item, "colOplataMiesieczna");
            }
        }
Esempio n. 27
0
        public Klient(Microsoft.SharePoint.SPWeb web, int klientId)
        {

            this.web = web;
            this.klientId = klientId;

            SPListItem item = tabKlienci.Get_KlientById(web, klientId);

            if (item != null)
            {

                this.DrukWplatyWymagany = BLL.Tools.Has_Service(item, "GBW", "selSewisy");

                this.PrzypomnienieOTerminiePlatnosciWymagane = BLL.Tools.Has_Service(item, "POT", "selSewisy");

                this.TypKlienta = item.ContentType.Name;
                OddzialZUSId = item["selOddzialZUS"] != null ? new SPFieldLookupValue(item["selOddzialZUS"].ToString()).LookupId : 0;
                FormaOpodatkowaniaZUS = item["colFormaOpodakowania_ZUS"] != null ? item["colFormaOpodakowania_ZUS"].ToString() : string.Empty;
                FormaOpodatkowaniaKPiR = item["colFormaOpodatkowaniaPD_KPiR"] != null ? item["colFormaOpodatkowaniaPD_KPiR"].ToString() : string.Empty;
                FormaOpodatkowaniaKSH = item["colFormaOpodatkowaniaPD_KSH"] != null ? item["colFormaOpodatkowaniaPD_KSH"].ToString() : string.Empty;
                FormaOpodatkowaniaVAT = item["colFormaOpodatkowaniaVAT"] != null ? item["colFormaOpodatkowaniaVAT"].ToString() : string.Empty;

                RozliczeniePD = item["enumRozliczeniePD"] != null ? item["enumRozliczeniePD"].ToString() : string.Empty;
                RozliczenieVAT = item["enumRozliczenieVAT"] != null ? item["enumRozliczenieVAT"].ToString() : string.Empty;


                string ct = item["ContentType"].ToString();
                //Forma opodatkowania
                switch (ct)
                {
                    case "KPiR":
                    case "Osoba fizyczna":
                        FormaOpodatkowaniaPD = FormaOpodatkowaniaKPiR;
                        break;
                    case "KSH":
                    case "Firma":
                    case "Firma zewnętrzna":
                        FormaOpodatkowaniaPD = FormaOpodatkowaniaKSH;
                        break;
                    default:
                        FormaOpodatkowaniaPD = string.Empty;
                        break;
                }

                //Pełna nazwa firmy
                switch (ct)
                {
                    case "KPiR":
                        this.FormaPrawna = item["enumFormaPrawna_KPiR"] != null ? item["enumFormaPrawna_KPiR"].ToString() : string.Empty;
                        this.PelnaNazwaFirmy = item.Title;
                        break;
                    case "KSH":
                        this.FormaPrawna = item["enumFormaPrawna"] != null ? item["enumFormaPrawna"].ToString() : string.Empty;
                        this.PelnaNazwaFirmy = item.Title;
                        break;
                    case "Osoba fizyczna":
                        this.ImieNazwisko = string.Format("{0} {1}",
                            item["colImie"] != null ? item["colImie"].ToString() : string.Empty,
                            item["colNazwisko"] != null ? item["colNazwisko"].ToString() : string.Empty);
                        this.PelnaNazwaFirmy = string.Format("{0} {1} {2}",
                            item["colImie"] != null ? item["colImie"].ToString() : string.Empty,
                            item["colNazwisko"] != null ? item["colNazwisko"].ToString() : string.Empty,
                            item["colPESEL"] != null ? "pesel: " + item["colPESEL"].ToString() : string.Empty).Trim();
                        break;
                    case "Firma zewnętrzna":
                        this.PelnaNazwaFirmy = item["colNazwa"] != null ? item["colNazwa"].ToString() : string.Empty;
                        break;
                    default:
                        this.PelnaNazwaFirmy = string.Empty;
                        break;
                }

                OsobaDoKontaktu = item["colOsobaDoKontaktu"] != null ? item["colOsobaDoKontaktu"].ToString() : string.Empty;
                Email = item["colEmail"] != null ? item["colEmail"].ToString() : string.Empty;
                Telefon = item["colTelefon"] != null ? item["colTelefon"].ToString() : string.Empty;
                Adres = item["colAdres"] != null ? item["colAdres"].ToString() : string.Empty;
                KodPocztowy = item["colKodPocztowy"] != null ? item["colKodPocztowy"].ToString() : string.Empty;
                Miejscowosc = item["colMiejscowosc"] != null ? item["colMiejscowosc"].ToString() : string.Empty;
                NIP = item["colNIP"] != null ? item["colNIP"].ToString() : string.Empty;
                NazwaFirmy = item.Title;
                Regon = item["colRegon"] != null ? item["colRegon"].ToString() : string.Empty;
                this.Pesel = BLL.Tools.Get_Text(item, "colPESEL");

                this.UwagiKadrowe = item["colUwagiKadrowe"] != null ? item["colUwagiKadrowe"].ToString() : string.Empty;
                this.Uwagi = item["colUwagi"] != null ? item["colUwagi"].ToString() : string.Empty;

                this.ZatrudniaPracownikow = item["colZatrudniaPracownikow"] != null ? bool.Parse(item["colZatrudniaPracownikow"].ToString()) : false ;


                if (item["selTerminPlatnosci"] != null)
                {
                    int terminPlatnosciId = new SPFieldLookupValue(item["selTerminPlatnosci"].ToString()).LookupId;
                    this.TerminPlatnosci = dicTerminyPlatnosci.Get_TerminPlatnosci(web, terminPlatnosciId);
                }
                else
                {
                    this.TerminPlatnosci = 0;
                }

                //operatorzy
                this.OperatorId_Audyt = item["selDedykowanyOperator_Audyt"] != null ? new SPFieldLookupValue(item["selDedykowanyOperator_Audyt"].ToString()).LookupId : 0;
                SPListItem opItem = BLL.dicOperatorzy.GetItemById(item.Web, this.OperatorId_Audyt);
                if (opItem == null) this.OperatorId_Audyt = 0;
                
                this.OperatorId_Podatki = item["selDedykowanyOperator_Podatki"] != null ? new SPFieldLookupValue(item["selDedykowanyOperator_Podatki"].ToString()).LookupId : 0;
                opItem = BLL.dicOperatorzy.GetItemById(item.Web, this.OperatorId_Podatki);
                if (opItem == null) this.OperatorId_Podatki = 0;
                
                this.OperatorId_Kadry = item["selDedykowanyOperator_Kadry"] != null ? new SPFieldLookupValue(item["selDedykowanyOperator_Kadry"].ToString()).LookupId : 0;
                opItem = BLL.dicOperatorzy.GetItemById(item.Web, this.OperatorId_Kadry);
                if (opItem == null) this.OperatorId_Kadry = 0;

                //Daty
                this.DataRozpoczeciaDzialalnosci = BLL.Tools.Get_Date(item,"colDataRozpoczeciaDzialalnosci");


                // PIT i VAT
                try
                {
                    int urzadId = item["selUrzadSkarbowy"] != null ? new SPFieldLookupValue(item["selUrzadSkarbowy"].ToString()).LookupId : 0;
                    urzadId = BLL.dicUrzedySkarbowe.Ensure(web, urzadId);
                    if (urzadId > 0)
                    {
                        this.NumerRachunkuPIT_PD = tabUrzedySkarbowe.Get_NumerRachunkuPITById(web, urzadId);
                        this.NumerRachunkuVAT = tabUrzedySkarbowe.Get_NumerRachunkuVATById(web, urzadId);

                        if (this.FormaOpodatkowaniaPD=="CIT")
                            NumerRachunkuPD = tabUrzedySkarbowe.Get_NumerRachunkuCITById(web, urzadId);
                        else
                            NumerRachunkuPD = tabUrzedySkarbowe.Get_NumerRachunkuPITById(web, urzadId);

                        NazwaUrzeduSkarbowego = tabUrzedySkarbowe.Get_NazwaUrzeduById(web, urzadId);
                        UrzadSkarbowyId = urzadId;
                    }
                    else
                    {
                        NumerRachunkuPIT_PD = string.Empty;
                        NumerRachunkuPD = string.Empty;
                        NumerRachunkuVAT = string.Empty;
                        UrzadSkarbowyId = 0;
                    }
                }
                catch (Exception ex)
                {
#if DEBUG
                throw ex;
#else
                    BLL.Logger.LogEvent(web.Url, ex.ToString() + " KlientId= " + klientId.ToString());
                    var result = ElasticEmail.EmailGenerator.ReportError(ex, web.Url, BLL.Tools.Get_ItemInfo(item));
#endif

                }

                //VAT (update jeżeli wymagany)

                try
                {
                    int urzadVATId = item["selUrzadSkarbowyVAT"] != null ? new SPFieldLookupValue(item["selUrzadSkarbowyVAT"].ToString()).LookupId : 0;
                    urzadVATId = BLL.dicUrzedySkarbowe.Ensure(web, urzadVATId);
                    if (urzadVATId > 0)
                    {
                        NumerRachunkuVAT = tabUrzedySkarbowe.Get_NumerRachunkuVATById(web, urzadVATId);
                        NazwaUrzeduSkarbowegoVAT = tabUrzedySkarbowe.Get_NazwaUrzeduById(web, urzadVATId);
                        UrzadSkarbowyVATId = urzadVATId;
                    }
                    else
                    {
                        //Przyjmij parametry jak dla US od podatku PIT
                        NumerRachunkuVAT = this.NumerRachunkuVAT;
                        NazwaUrzeduSkarbowegoVAT = this.NazwaUrzeduSkarbowego;
                        UrzadSkarbowyVATId = this.UrzadSkarbowyId;
                    }
                }
                catch (Exception ex)
                {
#if DEBUG
                throw ex;
#else
                    BLL.Logger.LogEvent(web.Url, ex.ToString() + " KlientId= " + klientId.ToString());
                    var result = ElasticEmail.EmailGenerator.ReportError(ex, web.Url, BLL.Tools.Get_ItemInfo(item));
#endif
                }

                // ZUS

                try
                {
                    int oddzialZUSId = item["selOddzialZUS"] != null ? new SPFieldLookupValue(item["selOddzialZUS"].ToString()).LookupId : 0;
                    oddzialZUSId = BLL.dicOddzialyZUS.Ensure(web, oddzialZUSId);
                    if (oddzialZUSId > 0)
                    {
                        this.OddzialZUSId = oddzialZUSId;
                    }
                }
                catch (Exception ex)
                {
#if DEBUG
                    throw ex;
#else
                    BLL.Logger.LogEvent(web.Url, ex.ToString() + " KlientId= " + klientId.ToString());
                    var result = ElasticEmail.EmailGenerator.ReportError(ex, web.Url, BLL.Tools.Get_ItemInfo(item));
#endif
                }

            }

        }
Esempio n. 28
0
        const string targetList = @"Faktury za obsługę - import"; //"intFakturyZaObsluge";

        internal static void Execute(Microsoft.SharePoint.SPItemEventProperties properties, Microsoft.SharePoint.SPWeb web)
        {
            SPListItem sItem   = properties.ListItem;
            int        okresId = new SPFieldLookupValue(sItem["selOkres"].ToString()).LookupId;

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

            list.Items.Cast <SPListItem>()
            .ToList()
            .ForEach(item =>
            {
                Import_DaneOFakturze(web, item, okresId);
            });
        }
 private void DeployWebWorkflowAssociationDefinition(WebModelHost webModelHost, Microsoft.SharePoint.SPWeb web, WorkflowAssociationDefinition workflowAssociationModel)
 {
     // TODO
 }
Esempio n. 30
0
        internal static void Execute(Microsoft.SharePoint.SPItemEventProperties properties, Microsoft.SharePoint.SPWeb web)
        {
            results = BLL.tabWiadomosci.Select_Batch(web);

            foreach (SPListItem item in results)
            {
                //todo: ??? obsługa pojedyńczej wiadomości - to chyba nie w tym miejscu
                BLL.Workflows.StartWorkflow(item, "Obsługa wiadomości");
                Debug.WriteLine("Workflow initiated for message #" + item.ID.ToString());
            }
        }
Esempio n. 31
0
 internal static void Execute(Microsoft.SharePoint.SPItemEventProperties properties, Microsoft.SharePoint.SPWeb web)
 {
     ManageTasks_WorkingHours(properties);
     ManageTasks(properties);
 }
Esempio n. 32
0
        public static void Execute(SPListItem item, Microsoft.SharePoint.SPWeb web)
        {
            StringBuilder msg = new StringBuilder();

            // sprawdź czy wybrana procedura jest obsługiwana
            string procName = string.Empty;
            int    procId   = 0;

            if (item["selProcedura"] != null)
            {
                procName = new SPFieldLookupValue(item["selProcedura"].ToString()).LookupValue;
                procId   = new SPFieldLookupValue(item["selProcedura"].ToString()).LookupId;
            }

            switch (procName)
            {
            case ": Rozliczenie podatku dochodowego":
            case ": Rozliczenie podatku dochodowego spółki":
            case ": Rozliczenie podatku dochodowego wspólnika":
            case ": Rozliczenie podatku VAT":
            case ": Rozliczenie ZUS":
                Array tasks = BLL.tabZadania.Get_GotoweZadaniaByProceduraId(web, procId);
                foreach (SPListItem task in tasks)
                {
                    //Sprawdź czy klient ma ustawiony serwis AD czy ADO
                    //w przypadku AD zablokuj automatyczną akceptację

                    if (BLL.tabKlienci.Has_ServiceById(task.Web, BLL.Tools.Get_LookupId(task, "selKlient"), "ADO"))
                    {
                        //uruchom proces zatwierdzenia
                        Update_msg(msg, procName, task);
                        BLL.Workflows.StartWorkflow(task, "Zatwierdzenie zadania", Microsoft.SharePoint.Workflow.SPWorkflowRunOptions.Asynchronous);
                    }
                }

                break;

            case ": Prośba o dokumenty":
            case ": Prośba o przesłanie wyciągu bankowego":
            case ": Rozliczenie z biurem rachunkowym":
                Array tasks2 = BLL.tabZadania.Get_AktywneZadaniaByProceduraId(web, procId);
                foreach (SPListItem task in tasks2)
                {
                    Update_msg(msg, procName, task);
                    BLL.Workflows.StartWorkflow(task, "Zatwierdzenie zadania");
                }
                break;

            default:
                break;
            }

            // info o zakończeniu procesu
            string bodyHTML = string.Empty;

            if (msg.Length > 0)
            {
                bodyHTML = string.Format(@"<ul>{0}</ul>", msg.ToString());
            }

            string subject = string.Format(@"Automatyczne zatwierdzenie zadań typu {0}", procName);

            SPEmail.EmailGenerator.SendProcessEndConfirmationMail(subject, bodyHTML, web, item);
        }