Exemplo n.º 1
0
        public void MemoGen()
        {
            MemoReport memo = new MemoReport();
            //   memo.CreateDocument("D:\\Testing\\",null,null);
            ModelMemoReport memoReport = new ModelMemoReport()
            {
                SelectParameterDocument = new SelectParameterDocument()
                {
                    IdUser = 33, NameDocument = "RR", NumberDocument = 4, TabelNumber = "7751-00-099", TypeDocument = 1
                }
            };
            SelectSql         select       = new SelectSql();
            SelectImns        selectFrames = new SelectImns();
            SqlConnectionType sql          = new SqlConnectionType();
            XmlReadOrWrite    xml          = new XmlReadOrWrite();

            select.SelectMemoReport(ref memoReport);
            var commandOrders = string.Format(selectFrames.LastOrder, memoReport.UserDepartment.SmallTabelNumber);
            var userOrder     = sql.XmlString("Data Source=i7751-app020;Initial Catalog=imns51;Integrated Security=True;MultipleActiveResultSets=True", commandOrders);

            if (userOrder != null)
            {
                userOrder = string.Concat("<Orders>", userOrder, "</Orders>");
                memoReport.UserDepartment.Orders = ((Orders)xml.ReadXmlText(userOrder, typeof(Orders)));
            }
            memo.CreateDocument("D:\\Testing\\", memoReport);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Генерация для служебных записок модель
        /// </summary>
        /// <param name="memoReport">Модель для служебных записок</param>
        public void SelectMemoReport(ref ModelMemoReport memoReport)
        {
            try
            {
                ModelSelect selectModel = new ModelSelect {
                    LogicaSelect = SqlSelectModel(49)
                };

                memoReport.UserDepartment = Inventory.Database.SqlQuery <UserDepartment>(selectModel.LogicaSelect.SelectUser,
                                                                                         new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[0], 1),
                                                                                         new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[1], memoReport.SelectParameterDocument.IdUser),
                                                                                         new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[2], DBNull.Value),
                                                                                         new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[3], DBNull.Value)).FirstOrDefault();
                memoReport.Executor = Inventory.Database.SqlQuery <Executor>(selectModel.LogicaSelect.SelectUser,
                                                                             new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[0], 2),
                                                                             new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[1], memoReport.SelectParameterDocument.IdUser),
                                                                             new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[2], memoReport.SelectParameterDocument.TabelNumber),
                                                                             new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[3], DBNull.Value)).FirstOrDefault();
                memoReport.BossDepartment = Inventory.Database.SqlQuery <BossDepartment>(selectModel.LogicaSelect.SelectUser,
                                                                                         new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[0], 3),
                                                                                         new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[1], memoReport.SelectParameterDocument.IdUser),
                                                                                         new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[2], memoReport.SelectParameterDocument.TabelNumber),
                                                                                         new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[3], DBNull.Value)).FirstOrDefault();
                memoReport.BossAgreed = Inventory.Database.SqlQuery <BossAgreed>(selectModel.LogicaSelect.SelectUser,
                                                                                 new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[0], 4),
                                                                                 new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[1], memoReport.SelectParameterDocument.IdUser),
                                                                                 new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[2], memoReport.SelectParameterDocument.TabelNumber),
                                                                                 new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[3], memoReport.SelectParameterDocument.TypeDocument)).FirstOrDefault();
                memoReport.LeaderOrganization = Inventory.Database.SqlQuery <LeaderOrganization>(selectModel.LogicaSelect.SelectUser,
                                                                                                 new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[0], 5),
                                                                                                 new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[1], memoReport.SelectParameterDocument.IdUser),
                                                                                                 new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[2], DBNull.Value),
                                                                                                 new SqlParameter(selectModel.LogicaSelect.SelectedParametr.Split(',')[3], DBNull.Value)).FirstOrDefault();
            }
            catch (Exception e)
            {
                Loggers.Log4NetLogger.Error(e);
            }
        }