コード例 #1
0
        internal DataTable BalanceSheetOnLoad(MasterModel objMaster)
        {
            try
            {
                ClsCon.cmd             = new SqlCommand();
                ClsCon.cmd.CommandType = CommandType.StoredProcedure;
                ClsCon.cmd.CommandText = "SPMasters";
                ClsCon.cmd.Parameters.AddWithValue("@DataInd", objMaster.Ind);
                ClsCon.cmd.Parameters.AddWithValue("@OrgID", objMaster.OrgID);
                ClsCon.cmd.Parameters.AddWithValue("@BrID", objMaster.BrID);
                ClsCon.cmd.Parameters.AddWithValue("@YrCD", objMaster.YrCD);
                ClsCon.cmd.Parameters.AddWithValue("@AsOnDate", objMaster.StartDate);

                con = ClsCon.SqlConn();
                ClsCon.cmd.Connection = con;
                dtReport  = new DataTable();
                ClsCon.da = new SqlDataAdapter(ClsCon.cmd);
                ClsCon.da.Fill(dtReport);
                dtReport.TableName = "success";
            }
            catch (Exception)
            {
                dtReport           = new DataTable();
                dtReport.TableName = "error";
                return(dtReport);
            }
            finally
            {
                con.Close();
                con.Dispose();
                ClsCon.da.Dispose();
                ClsCon.cmd.Dispose();
            }
            return(dtReport);
        }
コード例 #2
0
        /// <summary>
        /// Insert or Update  Master
        /// </summary>
        /// <param name="objMasterModel"></param>
        /// <returns></returns>
        public MasterModel InsertUpdateMaster(MasterModel objMasterModel)
        {
            try
            {
                objMasterModel.MasterValue = objMasterModel.MasterValue.ToString().Trim();
                int          ErrorCode    = 0;
                string       ErrorMessage = "";
                SqlParameter pErrorCode   = new SqlParameter("@ErrorCode", ErrorCode);
                pErrorCode.Direction = ParameterDirection.Output;
                SqlParameter pErrorMessage = new SqlParameter("@ErrorMessage", ErrorMessage);
                pErrorMessage.Direction = ParameterDirection.Output;

                SqlParameter[] parmList =
                {
                    new SqlParameter("@MasterID", objMasterModel.MasterID)
                    ,                             new SqlParameter("@MasterValue", objMasterModel.MasterValue)
                    ,                             new SqlParameter("@Description", objMasterModel.Description)
                    ,                             new SqlParameter("@IsActive", objMasterModel.IsActive)
                    ,                             new SqlParameter("@CreatedBy", objMasterModel.CreatedBy)
                    ,                             pErrorCode
                    ,                             pErrorMessage
                };

                //If  MasterId is 0 Than Insert  Master else Update  Master
                SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, DBConstants.Admin_InsertUpdateMaster, parmList);
                //set error code and message
                objMasterModel.ErrorCode = Convert.ToInt32(pErrorCode.Value);
                objMasterModel.Message   = Convert.ToString(pErrorMessage.Value);
                return(objMasterModel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
 public void UpdateAllProjectStatuses(MasterModel model)
 {
     foreach (var project in model.Projects)
     {
         project.StatusMode = _stubStatus[project];
     }
 }
コード例 #4
0
            public void Should_include_the_name_of_the_parent_project()
            {
                var project = new MasterModel().CreateProject(x => x.Name = "Foo");
                var group   = project.CreateGroup(x => x.Name = "Bar");

                group.FullName.ShouldEqual("Foo.Bar");
            }
コード例 #5
0
        internal DataTable AccountHead(MasterModel ObjMM)
        {
            try
            {
                ClsCon.cmd             = new SqlCommand();
                ClsCon.cmd.CommandType = CommandType.StoredProcedure;
                ClsCon.cmd.CommandText = "SPMasters";
                ClsCon.cmd.Parameters.AddWithValue("@DataInd", ObjMM.Ind);
                ClsCon.cmd.Parameters.AddWithValue("@OrgID", ObjMM.OrgID);
                ClsCon.cmd.Parameters.AddWithValue("@BrID", ObjMM.BrID);
                ClsCon.cmd.Parameters.AddWithValue("@YrCD", ObjMM.YrCD);
                ClsCon.cmd.Parameters.AddWithValue("@VchType", ObjMM.VchType);

                con = ClsCon.SqlConn();
                ClsCon.cmd.Connection = con;
                dtMaster  = new DataTable();
                ClsCon.da = new SqlDataAdapter(ClsCon.cmd);
                ClsCon.da.Fill(dtMaster);
                dtMaster.TableName = "success";
            }
            catch (Exception)
            {
                dtMaster           = new DataTable();
                dtMaster.TableName = "error";
                return(dtMaster);
            }
            finally
            {
                con.Close();
                con.Dispose();
                ClsCon.da.Dispose();
                ClsCon.cmd.Dispose();
            }
            return(dtMaster);
        }
コード例 #6
0
 public void ContextSetup()
 {
     _id          = Guid.NewGuid();
     _masterModel = new MasterModel();
     _project     = _masterModel.CreateProject();
     _group       = _project.CreateGroup(x => x.Id = _id);
 }
コード例 #7
0
            public void Should_set_parentProject()
            {
                var project = new MasterModel().CreateProject();
                var group   = project.CreateGroup();

                group.ParentProject.ShouldBeSameAs(project);
            }
コード例 #8
0
        public ActionResult Index()
        {
            MasterModel models = new MasterModel();

            models.User = messageHandler.GetUser();
            return(View("Index", models));
        }
コード例 #9
0
ファイル: VMmasterModel.cs プロジェクト: raket124/thesis
 public VMmasterModel(MasterModel root)
 {
     this.root          = root;
     this.model         = new VMdataModel(this.root.Model); //Instantiate model first!
     this.contracts     = new VMcontractCollection(this.root.Contracts, this);
     this.authorization = null;
 }
コード例 #10
0
            public void ContextSetup()
            {
                var existingMasterModel = new MasterModel();

                _serverId = Guid.NewGuid();
                var existingCruiseProjectAssociations = new[]
                {
                    new CruiseProjectAssociation {
                        ServerId = _serverId, Name = "Project Foo"
                    },
                };
                var projectToEdit = existingMasterModel.CreateProject(x =>
                {
                    x.Name = "Existing Project";
                    x.CruiseProjectAssociations = existingCruiseProjectAssociations;
                });

                _expectedId = projectToEdit.Id;

                var repository = new StubMasterModelRepository();

                repository.UseCurrentModel(existingMasterModel);

                var manager   = new ProjectManager(repository);
                var editModel = new EditProject
                {
                    ProjectId      = projectToEdit.Id,
                    Name           = "Existing Project",
                    CruiseProjects = null,
                };

                _result = manager.Update(editModel);

                _savedModel = repository.LastSaved;
            }
コード例 #11
0
 public SearchController()
 {
     model    = new MasterModel();
     DbObject = new RFahDBEntities1();
     logics   = new MyLogicsController();
     ViewBag.SearchCategory = logics.Category();
 }
コード例 #12
0
            public void ContextSetup()
            {
                _serverId1 = Guid.NewGuid();
                _serverId2 = Guid.NewGuid();
                var existingMasterModel = new MasterModel();

                existingMasterModel.CreateProject(x => x.Name = "Existing Project");
                var cruiseProjects = new[]
                {
                    new EditProjectCruiseProject {
                        Server = _serverId1, Project = "Project 1.1"
                    },
                    new EditProjectCruiseProject {
                        Server = _serverId1, Project = "Project 1.2"
                    },
                    new EditProjectCruiseProject {
                        Server = _serverId2, Project = "Project 2.1"
                    },
                    new EditProjectCruiseProject {
                        Server = _serverId2, Project = "Project 2.2"
                    }
                };

                var repository = new StubMasterModelRepository();

                repository.UseCurrentModel(existingMasterModel);

                var creator = new ProjectManager(repository);

                _result = creator.Create(new EditProject {
                    Name = "My New Project", CruiseProjects = cruiseProjects
                });

                _savedModel = repository.LastSaved;
            }
コード例 #13
0
            public void ContextSetup()
            {
                var masterModel  = new MasterModel();
                var server1      = masterModel.CreateCruiseServer(x => x.Url = "http://www.example.com/1");
                var server2      = masterModel.CreateCruiseServer(x => x.Url = "http://www.example.com/2");
                var ccReaderData = new Projects {
                    Items = new[] { new ProjectsProject(), new ProjectsProject() }
                };
                var mappedData = new CcProjectCollectionViewModel
                {
                    Items = new[] { new CcProjectViewModel {
                                        Name = "Homer Wuz Here"
                                    } }
                };

                var ccReaderResponse =
                    NetworkResponse.Success(ccReaderData);

                var statusProvider = S <ISystemStatusProvider>();

                statusProvider.Stub(x => x.GetSystemStatus()).Return(masterModel);

                var ccReader = S <ICcReader>();

                ccReader.Stub(x => x.GetStatus("http://www.example.com/1")).Return(ccReaderResponse);

                var mapper = S <IMapper>();

                mapper.Stub(x => x.Map <Projects, CcProjectCollectionViewModel>(ccReaderData)).Return(mappedData);

                var provider = new CruiseProjectModelProvider(ccReader, mapper, statusProvider);

                _result = provider.GetProjects(server1.Id);
            }
コード例 #14
0
        public Task InsertObs(MasterModel obs)
        {
            string sql = @"insert into OBS_Master(PICCode,Observer)
                            Values(@PICCode,@Observer);";

            return(_db.SaveData(sql, obs));
        }
コード例 #15
0
        /// <summary>
        /// Used to render the search result listing (virtual node)
        /// </summary>
        /// <param name="model"></param>
        /// <param name="term">
        /// The search term
        /// </param>
        /// <param name="provider">
        /// The search provider name (optional)
        /// </param>
        /// <param name="p"></param>
        /// <returns></returns>
        public ActionResult Search(RenderModel model, string term, string provider = null, int?p = null)
        {
            var searchPage = model.Content as ArticulateVirtualPage;

            if (searchPage == null)
            {
                throw new InvalidOperationException("The RenderModel.Content instance must be of type " + typeof(ArticulateVirtualPage));
            }

            //create a master model
            var masterModel = new MasterModel(model.Content);

            if (term == null)
            {
                //nothing to search, just render the view
                var emptyList = new ListModel(searchPage, Enumerable.Empty <IPublishedContent>(), new PagerModel(masterModel.PageSize, 0, 0));
                return(View(PathHelper.GetThemeViewPath(emptyList, "List"), emptyList));
            }

            if (p != null && p.Value == 1)
            {
                return(new RedirectToUmbracoPageResult(model.Content, UmbracoContext));
            }

            if (p == null || p.Value <= 0)
            {
                p = 1;
            }

            int totalPosts;
            var searchResult = ArticulateSearcher.Search(term, provider, masterModel.BlogArchiveNode.Id, masterModel.PageSize, p.Value - 1, out totalPosts);

            return(GetPagedListView(masterModel, searchPage, searchResult, totalPosts, p));
        }
コード例 #16
0
        /// <summary>
        /// Release all allocated/locked resources
        /// </summary>
        public void Dispose()
        {
            if (MasterBitmap != null)
            {
                MasterBitmap.Dispose(); MasterBitmap = null;
            }
            if (CapturedBitmapBeforeFilters != null)
            {
                CapturedBitmapBeforeFilters.Dispose(); CapturedBitmapBeforeFilters = null;
            }
            if (CapturedBitmap != null)
            {
                CapturedBitmap.Dispose(); CapturedBitmap = null;
            }

            if (MasterModel != null)
            {
                MasterModel.Close(); MasterModel = null;
            }
            if (CapturedModelBeforeFilters != null)
            {
                CapturedModelBeforeFilters.Close(); CapturedModelBeforeFilters = null;
            }
            if (CapturedModel != null)
            {
                CapturedModel.Close(); CapturedModel = null;
            }
        }
コード例 #17
0
        private static void Validate()
        {
            Console.WriteLine(
                "################ MasterModelValidator ##################");
            var model = new MasterModel
            {
                Title         = "Master-Title",
                TrackingState = TrackingState.Added,
                Details       = new List <DetailModel>
                {
                    new DetailModel
                    {
                        Title         = "Detail-Title",
                        TrackingState = TrackingState.Added,
                        Details       = new List <DetailOfDetailModel>
                        {
                            new DetailOfDetailModel
                            {
                                Title         = string.Empty,
                                TrackingState = TrackingState.Added,
                            }
                        }
                    }
                }
            };

            var validator = new MasterValidator();
            var result    = validator.Validate(model);

            foreach (var error in result.Errors)
            {
                Console.WriteLine($"property: {error.PropertyName}\nmessage: {error.ErrorMessage}");
            }
        }
コード例 #18
0
        private static void Create()
        {
            var masterModel = new MasterModel
            {
                Title         = "Master-Title",
                TrackingState = TrackingState.Added,
                Details       = new List <DetailModel>
                {
                    new DetailModel
                    {
                        Title         = "Detail-Title",
                        TrackingState = TrackingState.Added,
                        Details       = new List <DetailOfDetailModel>
                        {
                            new DetailOfDetailModel
                            {
                                Title         = "DetailOfDetail-Title",
                                TrackingState = TrackingState.Added,
                            }
                        }
                    }
                }
            };

            Console.WriteLine("################ Create Master and Details and DetailsOfDetail ##################");
            Print(masterModel);

            var masterEntity = Mapper.Map <Master>(masterModel);

            using (var context = new ProjectDbContext())
            {
                context.SaveAggregate(masterEntity);
            }
        }
コード例 #19
0
            public void ContextSetup()
            {
                var masterModel = new MasterModel();

                masterModel.CreateProject(); //1
                masterModel.CreateProject(); //2
                masterModel.CreateProject(); //3
                masterModel.CreateProject(); //4
                masterModel.CreateProject(); //5

                masterModel.AddUnassignedLight(new Light(new ZWaveValueIdentity(1, 22, 123)));

                var statusProvider = S <ISystemStatusProvider>();

                statusProvider.Stub(x => x.GetSystemStatus())
                .Return(masterModel);

                var mapper = S <IMapper>();

                mapper.Stub(x => x.Map <Project[], AdminProjectViewModel[]>(masterModel.Projects))
                .Return(new AdminProjectViewModel[3]);
                mapper.Stub(x => x.Map <Light[], AdminLightViewModel[]>(masterModel.UnassignedLights))
                .IgnoreArguments()
                .Return(new[] { new AdminLightViewModel {
                                    ZWaveIdentity = new ZWaveValueIdentity(1, 22, 444)
                                } });

                var provider = new AdminViewModelProvider(statusProvider, mapper, null);

                _result = provider.GetIndexViewModel();
            }
コード例 #20
0
ファイル: MasterBll.cs プロジェクト: jtdotnetgroup/Hn_Arrow
        public string AddMaster(MasterModel u)
        {
            string uid = "0";
            string msg = "技师添加失败!";

            if (HasMasterNo(u.PHONE, u.FID))
            {
                uid = "-2";
                msg = "手机号码已存在。";
                return(new JsonMessage {
                    Data = uid.ToString(), Message = msg, Success = false
                }.ToString());
            }
            else
            {
                u.MASTER_NO = MasterDal.Instance.GetNewNo();
                uid         = MasterDal.Instance.Insert(u);
                if (uid != "")
                {
                    msg = "添加APP技师成功!";
                    LogBll <MasterModel> log = new LogBll <MasterModel>();
                    u.FID = uid;
                    log.AddLog(u);
                }
            }
            return(new JsonMessage {
                Data = uid.ToString(), Message = msg, Success = (uid != "")
            }.ToString());
        }
コード例 #21
0
        private ActionResult RenderArticleListByCategory(IRenderModel model, string tag, int?p)
        {
            var tagPage = model.Content as TravelBlog.Models.VirtualPage;

            if (tagPage == null)
            {
                throw new InvalidOperationException("The RenderModel.Content instance must be of type " + typeof(VirtualPage));
            }

            //create a master model
            var masterModel = new MasterModel(model.Content);

            var contentByTag = Umbraco.GetContentByTag(masterModel, tagPage.Name, p ?? 1, masterModel.PageSize);

            //this is a special case in the event that a tag contains a '.', when this happens we change it to a '-'
            // when generating the URL. So if the above doesn't return any tags and the tag contains a '-', then we
            // will replace them with '.' and do the lookup again
            if ((contentByTag == null || contentByTag.PostCount == 0) && tagPage.Name.Contains("-"))
            {
                contentByTag = Umbraco.GetContentByTag(
                    masterModel,
                    tagPage.Name.Replace('-', '.'),
                    p ?? 1, masterModel.PageSize);
            }

            if (contentByTag == null)
            {
                return(new HttpNotFoundResult());
            }

            return(GetPagedListView(masterModel, tagPage, contentByTag.Posts, contentByTag.PostCount, p));
        }
コード例 #22
0
ファイル: MasterBll.cs プロジェクト: jtdotnetgroup/Hn_Arrow
        public string EditMaster(MasterModel u)
        {
            int    k;
            string msg = "技师编辑失败。";

            if (HasMasterNo(u.PHONE, u.FID))
            {
                k   = -2;
                msg = "手机号码已存在。";
                return(new JsonMessage {
                    Data = "", Message = msg, Success = false
                }.ToString());
            }
            else
            {
                var oldMaster = MasterDal.Instance.Get(u.FID);
                k = MasterDal.Instance.Update(u);
                if (k > 0)
                {
                    msg = "编辑APP技师成功。";
                    LogBll <MasterModel> log = new LogBll <MasterModel>();
                    log.AddLog(u);
                }
            }
            return(new JsonMessage {
                Data = k.ToString(), Message = msg, Success = k > 0
            }.ToString());
        }
コード例 #23
0
        public ActionResult Index(RenderModel model, int?p)
        {
            //create a master model
            var masterModel = new MasterModel(model.Content);

            var listNodes = masterModel.RootBlogNode.Children("ArticulateArchive").ToArray();

            if (listNodes.Length == 0)
            {
                throw new InvalidOperationException("An ArticulateArchive document must exist under the root Articulate document");
            }

            var totalPosts = Umbraco.GetPostCount(model.Content.Name, listNodes.Select(x => x.Id).ToArray());

            PagerModel pager;

            if (!GetPagerModel(masterModel, totalPosts, p, out pager))
            {
                return(new RedirectToUmbracoPageResult(model.Content.Parent, UmbracoContext));
            }

            var authorPosts = Umbraco.GetContentByAuthor(listNodes, model.Content.Name, pager);
            var author      = new AuthorModel(model.Content, authorPosts, pager, totalPosts);

            return(View(PathHelper.GetThemeViewPath(author, "Author"), author));
        }
コード例 #24
0
            public void ContextSetup()
            {
                _masterModel = new MasterModel();
                var cruiseServer = _masterModel.CreateCruiseServer(x =>
                {
                    x.Url  = "https://example.com/server1";
                    x.Name = "Server 1";
                });

                _zBuildLightsProject = _masterModel.CreateProject();
                _zBuildLightsProject.CruiseProjectAssociations = new[]
                {
                    new CruiseProjectAssociation {
                        Name = "Project 1.1", ServerId = cruiseServer.Id
                    },
                    new CruiseProjectAssociation {
                        Name = "Project 1.2", ServerId = cruiseServer.Id
                    }
                };

                var cruiseReader = new StubCcReader()
                                   .WithResponse(cruiseServer.Url,
                                                 NetworkResponse.Fail <Projects>("Could not reach server or something bad happened."));

                var updater = new ProjectStatusUpdater(cruiseReader);

                updater.UpdateAllProjectStatuses(_masterModel);
            }
コード例 #25
0
        /// <summary>
        /// Creates a master model for the current page.
        /// </summary>
        /// <returns>A <see cref="MasterModel"/> object.</returns>
        private MasterModel CreateMasterModel()
        {
            var home  = CurrentPage.Site();
            var model = new MasterModel(CurrentPage)
            {
                InitialState = new InitialState
                {
                    content        = GetContentPages(),
                    homeUrl        = home.Url,
                    siteLogo       = home.GetPropertyValue <string>("siteLogo"),
                    siteTitle      = home.GetPropertyValue <string>("siteTitle"),
                    location       = Request.Url.AbsolutePath,
                    currentContent = new InitialState.CurrentContent
                    {
                        Name    = CurrentPage.Name,
                        Url     = Request.Url.AbsolutePath,
                        Content = ViewFromContentId(CurrentPage.Id).RenderToString()
                    },
                    currentPageName = CurrentPage.Name
                },
                SiteDescription = CurrentPage.GetPropertyValue <string>("siteDescription")
            };

            // Render navigation partials
            var mainNavigationView   = View("Partials/MainNavigation", model);
            var bottomNavigationView = View("Partials/BottomNavigation", model);

            model.InitialState.mainNavigation   = mainNavigationView.RenderToString();
            model.InitialState.bottomNavigation = bottomNavigationView.RenderToString();

            return(model);
        }
コード例 #26
0
        public ActionResult Author(RenderModel model, int authorId, int?maxItems)
        {
            var author = Umbraco.TypedContent(authorId);

            if (author == null)
            {
                throw new ArgumentNullException(nameof(author));
            }

            if (!maxItems.HasValue)
            {
                maxItems = 25;
            }

            //create a master model
            var masterModel = new MasterModel(author);

            var listNodes = masterModel.RootBlogNode.Children("ArticulateArchive").ToArray();

            var authorContenet = Umbraco.GetContentByAuthor(listNodes, author.Name, new PagerModel(maxItems.Value, 0, 1));

            var feed = FeedGenerator.GetFeed(masterModel, authorContenet.Select(x => new PostModel(x)));

            return(new RssResult(feed, masterModel));
        }
コード例 #27
0
            public void ContextSetup()
            {
                var groupId = Guid.NewGuid();

                _masterModel = new MasterModel();
                var project = _masterModel.CreateProject(x => x.Name = "Existing Project");

                project.CreateGroup(x => x.Id = groupId)
                .AddLight(new Light(new ZWaveValueIdentity(1, 11, 123)))
                .AddLight(new Light(new ZWaveValueIdentity(1, 12, 123)));

                _zWaveIdentity = new ZWaveValueIdentity(1, 14, 123);
                var unassignedLights = new[]
                {
                    new Light(new ZWaveValueIdentity(1, 51, 123)),
                    new Light(_zWaveIdentity),
                    new Light(new ZWaveValueIdentity(1, 53, 123))
                };

                _masterModel.AddUnassignedLights(unassignedLights);

                var repository = S <IMasterModelRepository>();

                repository.Stub(x => x.GetCurrent()).Return(_masterModel);

                var updater = new LightModelUpdater(repository);

                updater.Update(_zWaveIdentity, groupId, LightColor.Red.Value);
            }
コード例 #28
0
 MasterRepository()
     : base(null)
 {
     DataSource = new MasterModel();
     OnPlatformServiceCallBack =
         new List <Action <string, IPlatformModelBase> >();
 }
コード例 #29
0
 public void SetUnassignedLights(MasterModel masterModel)
 {
     if (!_initialized)
     {
         throw new InvalidOperationException("The stub is not initialized.");
     }
     masterModel.AddUnassignedLights(_stubbed);
 }
コード例 #30
0
        public CustomResponse InsertSemester(MasterModel _semester)
        {
            Semester semester = _mapper.Map <Semester>(_semester);

            semester.CreateTs = DateTime.Now;
            semester.IsActive = true;
            return(_repo.Insert(semester));
        }