Found 3 repositories(showing 3)
Bablu011
Logic Class * Date Created : 11/20/2013 1:11:42 AM * Created By : /dev7 * Developer Name: TODO enter_your_name_here ****************************************************************************************** Bug Fix / Change Request (CR) INSTRUCTIONS For each fix or CR, please add the following section: Change DateTime : ___________ Fix/CR Description : ___________ Developer Name : ___________ ********************************/ using System; using Project.Web.Common.BaseClasses; using Project.Helper.Framework; using Project.BO.Framework.EnumClass.SortBy; using Project.BO.EDU.Courses; using System.Diagnostics.Contracts; using Project.Web.Common.Helper; using Project.BO.EDU.Administration.Addons; namespace Project.Web.Modules.EDU.Administration.Add_ons { /// Logic Class (L_Add_ons.cs) /// The primary purpose of this class is to update model and execute business logic. /// Logic classes are created by the Presenter class. /// Logic class will update model, but will not create a instance of view. /// Code behinds must not create logic classes (they may ONLY create presenter classes). /// Otherwise, the logic class becomes tightly coupled and cannot be migrated to a seperate remote WCF service. /// ALL methods and functions in this class must use entry and exit parameter code contracts. /// All public methods and functions in this class must be unit tested. /// 1. Unit tests will create a presenter class and inject properties. /// 2. Presenter methods or functions will create logic classes and call logic class functions/methods. /// 3. Use unit test to perform the runtime debugging, instead of relying on run time code behind calls. public class L_Add_ons : L_Base { /// <summary> /// Convert Model Property into BO Property /// </summary> private void SetSorting() { if (SortCollection != null) foreach (SortExpression expr in this.SortCollection) { MasterAddonsSortBy SortBy = MasterAddonsSortBy.ID; switch (expr.SortBy) { case "ID": SortBy = MasterAddonsSortBy.ID; break; case "Detail": SortBy = MasterAddonsSortBy.Detail; break; case "Name": SortBy = MasterAddonsSortBy.Title; break; case "Enabled": SortBy = MasterAddonsSortBy.Is_Enabled; break; } //add SortBy & SortOrder to Sorting Collection _serviceFactory.EDU.Administration.MasterAddons.SortMasterAddonsCollection(SortBy, expr.SortOrder); } } /// <summary> /// /// </summary> /// <param name="pAddOnsCollection"></param> /// <returns></returns> public bool GetAddOnsList(ref M_Add_onsCollection pAddOnsCollection) { _serviceFactory.EDU.Administration.MasterAddons.PageNumber = this.PageNumber; _serviceFactory.EDU.Administration.MasterAddons.PageSize = this.PageSize; if (pAddOnsCollection == null) { pAddOnsCollection = new M_Add_onsCollection(); } EDU_Master_AddonsCollection objAddOnsCollection = new EDU_Master_AddonsCollection(); //Apply sorting SetSorting(); //Todo: DAL layer error use hardcode data now if (!_serviceFactory.EDU.Administration.MasterAddons.ListMasterAddons(ref objAddOnsCollection)) { gProcessFailure = _serviceFactory.ProcessFailedInfo; switch (gProcessFailure.Severity) { case ErrorSeverity.GPF: //is the error a GPF? (must abort) return false; case ErrorSeverity.AbortWarning: //is the error an abort warning? (cannot continue) return false; case ErrorSeverity.ContinueWarning: break; case ErrorSeverity.None: break; } return false; } foreach (EDU_Master_Addons AddonItem in objAddOnsCollection) { pAddOnsCollection.Add(GetAddOnsItem(AddonItem)); } return true; } private M_Add_ons GetAddOnsItem(EDU_Master_Addons item) { M_Add_ons objPricing = new M_Add_ons { ID = item.ID, Details = item.Detail, Name = item.Title, Enabled = (item.IsEnabled.Value != null) ? Convert.ToBoolean(item.IsEnabled) : false, }; return objPricing; } /// <summary> /// /// </summary> /// <param name="pID"></param> /// <returns></returns> public bool DeleteAddOnsID(int pID) { if (!_serviceFactory.EDU.Administration.MasterAddons.DeleteMasterAddons(pID)) { gProcessFailure = _serviceFactory.ProcessFailedInfo; switch (gProcessFailure.Severity) { case ErrorSeverity.GPF: //is the error a GPF? (must abort) return false; case ErrorSeverity.AbortWarning: //is the error an abort warning? (cannot continue) return false; case ErrorSeverity.ContinueWarning: break; case ErrorSeverity.None: break; } return false; } return true; } /// <summary> /// /// </summary> /// <param name="pID"></param> /// <param name="pDetail"></param> /// <param name="pName"></param> /// <param name="pEnabled"></param> /// <returns></returns> public bool UpdateAddons(int pID, string pDetail, string pName, bool pEnabled) { if (!_serviceFactory.EDU.Administration.MasterAddons.ChangeMasterAddons(pID,pName, pDetail, pEnabled)) { //error saving content gProcessFailure = _serviceFactory.ProcessFailedInfo; switch (gProcessFailure.Severity) { case ErrorSeverity.GPF: //is the error a GPF? (must abort) return false; case ErrorSeverity.AbortWarning: //is the error an abort warning? (cannot continue) return false; case ErrorSeverity.ContinueWarning: return false; case ErrorSeverity.None: break; } } return true; } /// <summary> /// /// </summary> /// <param name="pRecordID"></param> /// <param name="pDetail"></param> /// <param name="pName"></param> /// <param name="pEnabled"></param> /// <returns></returns> public bool InsertAddOns(ref int pRecordID, string pDetail,string pName, bool pEnabled) { if (!_serviceFactory.EDU.Administration.MasterAddons.AddMasterAddons(pName,pDetail,pEnabled,ref pRecordID)) { //error saving content gProcessFailure = _serviceFactory.ProcessFailedInfo; switch (gProcessFailure.Severity) { case ErrorSeverity.GPF: //is the error a GPF? (must abort) return false; case ErrorSeverity.AbortWarning: //is the error an abort warning? (cannot continue) return false; case ErrorSeverity.ContinueWarning: return false; case ErrorSeverity.None: break; } } return true; } } }
tempbottle
WindowsSDK7 Samples; multimedia/directshow/baseclasses/*
Amansingh717
Sample application to learn, 1-MVVM architecture with BaseClasses and Clean Architecture, 2-Coroutines, and Flow in Android
All 3 repositories loaded