public ModelUser AuthUserService(FullSetting setting) { if (setting.ModelUser.Login != null) { using (PrincipalContext context = new PrincipalContext(ContextType.Domain, null, setting.ModelUser.Login, setting.ModelUser.Password)) { if (context.ValidateCredentials(setting.ModelUser.Login, setting.ModelUser.Password)) { using (var users = new UserPrincipal(context)) { users.SamAccountName = setting.ModelUser.Login; using (var searcher = new PrincipalSearcher(users)) { var user = searcher.FindOne() as UserPrincipal; if (user != null) { setting.ModelUser.UserName = user.Name; setting.ModelUser.UserNameGuide = user.Name + setting.ModelUser.Guid; return(setting.ModelUser); } } } setting.ModelUser.Error = "Пользователь не найден!!!"; return(setting.ModelUser); } setting.ModelUser.Error = "Не правильный логин/пароль!!!"; return(setting.ModelUser); } } setting.ModelUser.Error = "Пользователь не введен!!!"; return(setting.ModelUser); }
/// <summary> /// Создание процесса Прием КРСБ Наследника Массово /// </summary> /// <param name="conectstring">Строка соединения</param> /// <param name="setting">Настройки</param> /// <returns></returns> public string CreateKrsb(string conectstring, FullSetting setting) { try { var delocreate = new AddKrsb(); var sqlconnect = new SqlConnectionType(); SerializeJson serializeJson = new SerializeJson(); if (setting.DeloPriem.DelaPriem.Count > 0) { delocreate.CreateDelo(setting.DeloPriem.DelaPriem); sqlconnect.StartingProcedure <string, string>(conectstring, ((ServiceWcf) sqlconnect.SelectFullParametrSqlReader(conectstring, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand("19"))).ServiceWcfCommand.Command); return(serializeJson.JsonLibary((CreateDela)sqlconnect.SelectFullParametrSqlReader <string, string>(conectstring, ((ServiceWcf) sqlconnect.SelectFullParametrSqlReader(conectstring, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand("20"))).ServiceWcfCommand.Command, typeof(CreateDela)))); } Loggers.Log4NetLogger.Error(new Exception("Нет дел для создания процессов!!!")); return(null); } catch (Exception e) { Loggers.Log4NetLogger.Error(e); return(null); } }
/// <summary> /// Процедуры предпроверки /// </summary> /// <param name="connection">Строка соединения</param> /// <param name="seting">Настройки</param> /// <returns></returns> public async Task <string> TaskSqlProcedureSoprovod(string connection, FullSetting seting) { var sqlconnect = new SqlConnectionType(); GenerateParametrSql.GenerateParametrSql sql = new GenerateParametrSql.GenerateParametrSql(); Dictionary <string, string> listparametr = new Dictionary <string, string>(); if (seting.ParamPredproverka.N441 != 0) { sql.CreateParamert(ref listparametr, seting.ParamPredproverka.GetType(), seting.ParamPredproverka); } switch (seting.Id) { case 1: return(await Task.Factory.StartNew(() => sqlconnect.StartingProcedure(connection, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(connection, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand("15"))).ServiceWcfCommand.Command, listparametr))); case 2: return(await Task.Factory.StartNew(() => sqlconnect.StartingProcedure(connection, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(connection, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand("16"))).ServiceWcfCommand.Command, listparametr))); case 3: return(await Task.Factory.StartNew(() => sqlconnect.StartingProcedure(connection, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(connection, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand("17"))).ServiceWcfCommand.Command, listparametr))); default: return(null); } }
/// <summary> /// G /// </summary> /// <returns></returns> public async Task <string> ServerList(FullSetting setting) { var connect = setting.Db == "Work" ? _parametrService.ConectWork : _parametrService.ConectTest; var selectfull = new SelectFull(); return(await Task.Factory.StartNew(() => selectfull.SqlSelect(connect, setting))); }
/// <summary> /// Вытаскиваем внутреннею команду с сайта /// </summary> /// <param name="setting">Параметры</param> /// <returns></returns> private ServiceWcf Service(FullSetting setting) { var sqlConnect = new SqlConnectionType(); return ((ServiceWcf) sqlConnect.SelectFullParametrSqlReader(ConnectionString, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand(setting.Id.ToString()))); }
/// <summary> /// Вытягивание выборки на сайт для подставления в нее параметров данных /// </summary> /// <param name="conectionstring">Строка соединения</param> /// <param name="setting">Параметры настройки</param> /// <returns></returns> public string ServiceCommand(string conectionstring, FullSetting setting) { var sqlconnect = new SqlConnectionType(); SerializeJson serializeJson = new SerializeJson(); return(serializeJson.JsonLibary( (ServiceWcf) sqlconnect.SelectFullParametrSqlReader(conectionstring, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand(setting.ParamService.IdCommand.ToString())))); }
/// <summary> /// Шаблон который используем написано кустарно нужно давать Ун шаблона на вход!!! /// </summary> /// <param name="conectionstring">Строка соединения</param> /// <param name="setting">Параметры шаблона</param> /// <returns></returns> public Document Template(string conectionstring, FullSetting setting) { var sqlconnect = new SqlConnectionType(); Dictionary <string, string> listparametr = new Dictionary <string, string>(); GenerateParametrSql.GenerateParametrSql sql = new GenerateParametrSql.GenerateParametrSql(); if (setting.UseTemplate.IdTemplate != 0) { sql.CreateParamert(ref listparametr, setting.UseTemplate.GetType(), setting.UseTemplate); } return((Document)sqlconnect.SelectFullParametrSqlReader(conectionstring, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(conectionstring, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand("10"))).ServiceWcfCommand.Command, typeof(Document), listparametr)); }
/// <summary> /// Выполнения процедур по КРСБ /// </summary> /// <param name="setting"></param> /// <returns></returns> public async Task <string> StoreProcedureKrsb(FullSetting setting) { var taskcommand = new TaskResult(); switch (setting.Db) { case "Work": return(await taskcommand.TaskSqlProcedureKrsb(_parametrService.ConectWork, setting)); default: return(null); } }
public async Task <Stream> StoreProcedureKam5(FullSetting setting) { var taskcommand = new TaskResult(); DonloadsFile donloads = new DonloadsFile(); switch (setting.Db) { case "Work": return(await donloads.SelectDonloadsFile(_parametrService.Report, "Камеральный №5.xlsx", null, await taskcommand.TaskSqlProcedureKam5(_parametrService.ConectWork, setting))); default: return(null); } }
/// <summary> /// Шаблон писем по миграции НП /// </summary> /// <param name="connectionstringtemplate">Строка соединения</param> /// <param name="path">Путь к папке сохранения</param> /// <param name="model">Модель миграции</param> public void MigrationDoc(string connectionstringtemplate, string path, MigrationParse model) { SqlLibaryIfns.SqlModelReport.SqlTemplate.ModelTemplate template = new SqlLibaryIfns.SqlModelReport.SqlTemplate.ModelTemplate(); var setting = new FullSetting { UseTemplate = new UseTemplate() { IdTemplate = 3 } }; var documenttemplate = template.Template(connectionstringtemplate, setting); model.N280 = template.Inspection(connectionstringtemplate, "7746").Inspection.N280; var ul46 = model.ReportMigration.Where(code => (code.Kpp ?? string.Empty) != "" && code.Problem.Contains("Запись о налогоплательщике в ЦУН не содержит ОКТМО")).ToArray(); var fullpath = path + "7746" + "_ЮЛ_" + Constant.WordConstant.Formatword; GenerateDoc(fullpath, documenttemplate, ul46, model, 1, "7746"); setting.UseTemplate.IdTemplate = 2; documenttemplate = template.Template(connectionstringtemplate, setting); model.ReportMigration.GroupBy(x => x.CodeIfns).ToList().ForEach(key => { model.N280 = template.Inspection(connectionstringtemplate, key.Key).Inspection.N280; List <ReportMigration[]> report = new List <ReportMigration[]>(); var fl = model.ReportMigration.Where(code => code.CodeIfns == key.Key && string.IsNullOrWhiteSpace(code.Kpp)).ToArray(); var ul = model.ReportMigration.Where(code => code.CodeIfns == key.Key && (code.Kpp ?? string.Empty) != "" && !code.Problem.Contains("Запись о налогоплательщике в ЦУН не содержит ОКТМО")).ToArray(); if (fl.Length >= 1) { report.Add(fl); } if (ul.Length >= 1) { report.Add(ul); } foreach (var param in report) { int isshablon; if (!string.IsNullOrWhiteSpace(param[0].Kpp)) { isshablon = 1; fullpath = path + key.Key + "_ЮЛ_" + Constant.WordConstant.Formatword; } else { isshablon = 2; fullpath = path + key.Key + "_ФЛ_ИП_" + Constant.WordConstant.Formatword; } GenerateDoc(fullpath, documenttemplate, param, model, isshablon, key.Key); } report.Clear(); }); }
/// <summary> /// Модель для создания писем /// </summary> /// <param name="setting"></param> /// <returns></returns> public string StartNewOpenXmlTemplate(FullSetting setting) { try { Task.Factory.StartNew(() => { GenerateDocument report = new GenerateDocument(); report.GenerateOutBdk(_parametrService.ConectWork, _parametrService.ConnectionString, _parametrService.ReportMassTemplate, setting); }); return("Документы для печати запущены и сохраняются в папку " + _parametrService.ReportMassTemplate); } catch (Exception e) { Loggers.Log4NetLogger.Error(e); return(e.Message); } }
/// <summary> /// Процедуры выполнения создания КРСБ /// </summary> /// <param name="connection">Строка соединения</param> /// <param name="seting">Настройки</param> /// <returns></returns> public async Task <string> TaskSqlProcedureKrsb(string connection, FullSetting seting) { var sqlconnect = new SqlConnectionType(); Dictionary <string, dynamic> listparametr = new Dictionary <string, dynamic>(); if (seting.DeloCreate.DateDelo != System.DateTime.MinValue) { listparametr.Add("@DateStart", seting.DeloCreate.DateDelo.Date); } if (seting.DeloCreate.D3979 != 0) { listparametr.Add("@D3979", seting.DeloCreate.D3979); } if (!String.IsNullOrWhiteSpace(seting.DeloCreate.Okato)) { listparametr.Add("@Okato", seting.DeloCreate.Okato); } switch (seting.ParamService.IdCommand) { case 22: if (seting.DeloPriem.DelaPriem.Count > 0) { //Добавляем в таблицу данные для дальнейшего анализа AddKrsb krsb = new AddKrsb(); krsb.CreateDeloAnalizKrsb(seting.DeloPriem.DelaPriem); } return(await Task.Factory.StartNew(() => sqlconnect.StartingProcedure(connection, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(connection, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand(seting.ParamService.IdCommand.ToString()))).ServiceWcfCommand.Command, listparametr))); case 23: return(await Task.Factory.StartNew(() => sqlconnect.StartingProcedure(connection, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(connection, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand(seting.ParamService.IdCommand.ToString()))).ServiceWcfCommand.Command, listparametr))); case 24: return(await Task.Factory.StartNew(() => sqlconnect.StartingProcedure(connection, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(connection, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand(seting.ParamService.IdCommand.ToString()))).ServiceWcfCommand.Command, listparametr))); case 25: return(await Task.Factory.StartNew(() => sqlconnect.StartingProcedure(connection, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(connection, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand(seting.ParamService.IdCommand.ToString()))).ServiceWcfCommand.Command, listparametr))); case 27: return(await Task.Factory.StartNew(() => sqlconnect.StartingProcedure(connection, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(connection, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand(seting.ParamService.IdCommand.ToString()))).ServiceWcfCommand.Command, listparametr))); default: return(null); } }
public async Task <DataSet> TaskSqlProcedureKam5(string connection, FullSetting seting) { var sqlconnect = new SqlConnectionType(); GenerateParametrSql.GenerateParametrSql sql = new GenerateParametrSql.GenerateParametrSql(); Dictionary <string, string> listparametr = new Dictionary <string, string>(); if (seting.ReportRvs.Qvartal != 0) { sql.CreateParamert(ref listparametr, seting.ReportRvs.GetType(), seting.ReportRvs); } switch (seting.ParamService.IdCommand) { case 28: return(await await Task.Factory.StartNew(() => sqlconnect.ProcedureReturnTable(connection, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(connection, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand(seting.ParamService.IdCommand.ToString()))).ServiceWcfCommand.Command, seting.ModelUser.UserNameGuide, listparametr))); default: return(null); } }
/// <summary> /// Выполнение команды на сервере под номером /// </summary> /// <param name="setting">Параметры</param> /// <returns></returns> public string SqlSelect(FullSetting setting) { var sqlConnect = new SqlConnectionType(); SerializeJson serializeJson = new SerializeJson(); var ping = new PingIp.PingIp(); switch (setting.Id) { case 29: var server = ping.Ping( (ServerAndComputer) sqlConnect.SelectFullParametrSqlReader <string, string>(ConnectionString, Service(setting).ServiceWcfCommand.Command, typeof(ServerAndComputer))); return(serializeJson.JsonLibrary(server)); default: return("Данная команда не определена!!!"); } }
/// <summary> /// Подгрузка БДК Статистики /// </summary> /// <param name="setting"></param> /// <returns></returns> public async Task <string> LoaderBdk(FullSetting setting) { var selectfull = new SelectFull(); switch (setting.Db) { case "Work": var sqlconnect = new SqlConnectionType(); return (await Task.Factory.StartNew( () => selectfull.BdkSqlSelect(_parametrService.ConectWork, ((ServiceWcf) sqlconnect.SelectFullParametrSqlReader(_parametrService.ConectWork, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand("7"))).ServiceWcfCommand.Command))); default: return(null); } }
/// <summary> /// Выбор процедуры в зависимости от настроек: /// 1 - Процедура добавления значения на добавления а название под ун 3 /// 2 - Процедура запуска процесса решений а название под ун 4 /// 3 - Процедура запуска инкассовых поручений а название под ун 5 /// Процесс генерации параметров для процедуры нужно улучшить!!!! /// </summary> /// <param name="connection">Строка соединения</param> /// <param name="seting">Настойки</param> /// <returns>Строка с ответа с сервера</returns> public async Task <string> TaskSqlProcedure(string connection, FullSetting seting) { var sqlconnect = new SqlConnectionType(); Dictionary <string, int> listparametr = new Dictionary <string, int>(); if (seting.ParametrReshen.D270 != 0) { listparametr.Add("@D270", seting.ParametrReshen.D270); } switch (seting.Id) { case 1: return(await Task.Factory.StartNew(() => sqlconnect.StartingProcedure(connection, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(connection, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand("3"))).ServiceWcfCommand.Command, listparametr))); case 2: return(await Task.Factory.StartNew(() => sqlconnect.StartingProcedure(connection, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(connection, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand("4"))).ServiceWcfCommand.Command, listparametr))); case 3: return(await Task.Factory.StartNew(() => sqlconnect.StartingProcedure(connection, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(connection, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand("5"))).ServiceWcfCommand.Command, listparametr))); default: return(null); } }
/// <summary> /// Шаблон писем по миграции НП /// </summary> /// <param name="connectionStringTemplate">Строка соединения</param> /// <param name="path">Путь к папке сохранения</param> /// <param name="model">Модель миграции</param>\ /// <param name="postAddress">Модель адреса</param> public void MigrationDocument(string connectionStringTemplate, string path, MigrationParse model, string postAddress = null) { ServiceRestLotus lotus = new ServiceRestLotus(); SqlLibaryIfns.SqlModelReport.SqlTemplate.ModelTemplate template = new SqlLibaryIfns.SqlModelReport.SqlTemplate.ModelTemplate(); var setting = new FullSetting { UseTemplate = new UseTemplate() { IdTemplate = 3 } }; var documentTemplate = template.Template(connectionStringTemplate, setting); model.N280 = template.Inspection(connectionStringTemplate, "7746").Inspection.N280; var ul46 = model.ReportMigration.Where(code => (code.Kpp ?? string.Empty) != "" && code.Problem.Contains("Запись о налогоплательщике в ЦУН не содержит ОКТМО")).ToArray(); var fullPath = path + "7746" + "_ЮЛ_" + Constant.WordConstant.FormatWord; GenerateDoc(fullPath, documentTemplate, ul46, model, 1, "7746"); setting.UseTemplate.IdTemplate = 2; documentTemplate = template.Template(connectionStringTemplate, setting); model.ReportMigration.GroupBy(x => x.CodeIfns).ToList().ForEach(key => { model.N280 = template.Inspection(connectionStringTemplate, key.Key).Inspection.N280; List <ReportMigration[]> report = new List <ReportMigration[]>(); var fl = model.ReportMigration.Where(code => code.CodeIfns == key.Key && string.IsNullOrWhiteSpace(code.Kpp)).ToArray(); var ul = model.ReportMigration.Where(code => code.CodeIfns == key.Key && (code.Kpp ?? string.Empty) != "" && !code.Problem.Contains("Запись о налогоплательщике в ЦУН не содержит ОКТМО")).ToArray(); if (fl.Length >= 1) { report.Add(fl); } if (ul.Length >= 1) { report.Add(ul); } foreach (var param in report) { int isTemplate; string fileName; if (!string.IsNullOrWhiteSpace(param[0].Kpp)) { isTemplate = 1; fileName = key.Key + "_ЮЛ_" + Constant.WordConstant.FormatWord; fullPath = path + fileName; } else { isTemplate = 2; fileName = key.Key + "_ФЛ_ИП_" + Constant.WordConstant.FormatWord; fullPath = path + fileName; } GenerateDoc(fullPath, documentTemplate, param, model, isTemplate, key.Key); //Отправка на сервис в Lotus if (postAddress != null) { Letter modeLetter = new Letter() { Attachments = new Attachment[1], DestinationCodes = new string[1] }; modeLetter.Attachments[0] = new Attachment { FileName = fileName, Extension = Constant.WordConstant.FormatWord, Data = File.ReadAllBytes(fullPath) }; modeLetter.Id = Guid.NewGuid().ToString(); modeLetter.Subscriber = documentTemplate.Templates.Stone.Stone3; modeLetter.DestinationCodes[0] = key.Key; modeLetter.File = "07-10"; modeLetter.Author = null; lotus.ServicePostLotus(postAddress, modeLetter); } } report.Clear(); }); }
/// <summary> /// Генерация документа OutBdk /// </summary> /// <param name="connectionstringtemplate">Строка соединения с шаблоном</param> /// <param name="connectionstringtaxes">Строка соединения с данными</param> /// <param name="path">Путь сохранения файлов</param> /// <param name="setting">Настройки</param> public void GenerateOutBdk(string connectionstringtemplate, string connectionstringtaxes, string path, FullSetting setting) { try { var document = new Doc { Template = new TemplateOutBdk(), Model = new OutBdkModel(connectionstringtemplate, connectionstringtaxes, path, setting) }; document.DocumentOutBdk(); } catch (Exception e) { Loggers.Log4NetLogger.Error(e); } }
/// <summary> /// Данные которые будут раскладываться на шаблоне /// </summary> /// <param name="conectionstring">Строка соединения с сервером</param> /// <param name="connecttestsqlcommand">Строка соединения с таблицей комманд для запроса данных</param> /// <param name="setting">Настроики пользователя</param> /// <returns></returns> public Report ReportBdk(string conectionstring, string connecttestsqlcommand, FullSetting setting) { try { var sqlconnect = new SqlConnectionType(); Dictionary <string, string> listparametr = new Dictionary <string, string>(); GenerateParametrSql.GenerateParametrSql sql = new GenerateParametrSql.GenerateParametrSql(); if (setting.ParametrBdkOut.D85DateStart != DateTime.MinValue) { sql.CreateParamert(ref listparametr, setting.ParametrBdkOut.GetType(), setting.ParametrBdkOut); } return((Report)sqlconnect.SelectFullParametrSqlReader(conectionstring, ((ServiceWcf)sqlconnect.SelectFullParametrSqlReader(connecttestsqlcommand, ModelSqlFullService.ProcedureSelectParametr, typeof(ServiceWcf), ModelSqlFullService.ParamCommand("11"))).ServiceWcfCommand.Command, typeof(Report), listparametr)); } catch (Exception e) { Loggers.Log4NetLogger.Error(e); } return(null); }
/// <summary> /// Получение выборки для генерации командя на сайте /// </summary> /// <param name="setting">Параметры</param> /// <returns></returns> public async Task <string> ModelServiceCommand(FullSetting setting) { var selectfull = new SelectFull(); return(await Task.Factory.StartNew(() => selectfull.ServiceCommand(_parametrService.ConectWork, setting))); }
public async Task <string> AngularCreateKrsb(FullSetting setting) { var efangular = new AngularRestEf(); return(await Task.Factory.StartNew(() => efangular.CreateKrsb(_parametrService.ConectWork, setting))); }
public OutBdkModel(string connectionstringtemplate, string connectionstringtaxes, string path, FullSetting setting) { ModelFull modelFull = new ModelFull(); FileLogica.FileLogica logica = new FileLogica.FileLogica(); SqlLibaryIfns.SqlModelReport.SqlTemplate.ModelTemplate template = new SqlLibaryIfns.SqlModelReport.SqlTemplate.ModelTemplate(); logica.FileDelete(path); ConectionStringTemplate = connectionstringtemplate; PathSave = path; Report = modelFull.ReportBdk(connectionstringtaxes, connectionstringtemplate, setting); DocumentTemplate = template.Template(connectionstringtemplate, setting); }
/// <summary> /// Авторизация на сервере /// </summary> /// <param name="setting">Настройки</param> /// <param name="callback"></param> /// <param name="asyncState"></param> /// <returns></returns> public IAsyncResult BeginSampleMethod(FullSetting setting, AsyncCallback callback, object asyncState) { AuthUser.AuthUser authuser = new AuthUser.AuthUser(); return(new CompletedAsyncResult <ModelUser>(authuser.AuthUserService(setting))); }