public async Task <HttpResponseMessage> GetModuleReference(int ModuleID)
        {
            try
            {
                ModuleDAL dal = new ModuleDAL();
                List <ModuleReferenceInfo> data = await dal.GetModuleReference(ModuleID);

                if (data != null)
                {
                    return(Request.CreateResponse <List <ModuleReferenceInfo> >(HttpStatusCode.OK, data));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Constants.ErrorNotFound));
                }
            }
            catch (DbEntityValidationException ex)
            {
                var    controllerName = ControllerContext.RouteData.Values["controller"].ToString();
                var    actionName     = ControllerContext.RouteData.Values["action"].ToString();
                Logger log            = new Logger();
                log.ErrorLog(ex, controllerName, actionName);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, Constants.ErrorSysError));
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ModuleDAL newDal = new ModuleDAL();

            grdModule.DataSource = newDal.GetAllModules();
            grdModule.DataBind();
        }
 /**
  * Método para actualizar un nuevo registro
  */
 public static void update(long id, String name, int state)
 {
     try {
         ModuleDAL.update(id, name, state);
     } catch (Exception e) {
         throw e;
     }
 }
 /**
  * Método para obtener la lista de datos realizando el mapeo desde la capa de datos
  */
 public static List <Module> fetchAll()
 {
     try {
         return(ModuleDAL.fetchAll().Select(x => new Module {
             id = long.Parse(x.id + ""),
             name = x.name,
             state = int.Parse(x.state + "")
         }).ToList());
     } catch (Exception e) {
         throw e;
     }
 }
示例#5
0
        public void PopulateModule()
        {
            ModuleDAL      newDAL  = new ModuleDAL();
            IList <Module> modules = newDAL.GetAllModules();

            foreach (Module module in modules)
            {
                ListItem newItem = new ListItem();
                newItem.Text  = module.ModuleName;
                newItem.Value = module.ModuleID.ToString();
                ddlModule.Items.Add(newItem);
            }
        }
示例#6
0
        public static DataSet ModulesAllAction(int Action, int ModuleID, int TopicID, int CompId, string Title, string Overview, string Description, string SrNo, string IsPublished, string SkipFlashcard, string CreatedBy)
        {
            DataSet data = new DataSet();

            try
            {
                data = ModuleDAL.ModulessAllAction(Action, ModuleID, TopicID, CompId, Title, Overview, Description, SrNo, IsPublished, SkipFlashcard, CreatedBy);
            }
            catch (Exception ex)
            {
                Log(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            return(data);
        }
示例#7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         PopulateProject();
         if (ModuleID > 0)
         {
             ModuleDAL newDal    = new ModuleDAL();
             Module    newModule = newDal.GetModuleByID(ModuleID);
             PopulateModule(newModule);
             btnSave.Text = "Update Module";
         }
     }
 }
示例#8
0
        public void PopulateModule()
        {
            ModuleDAL      newDAL  = new ModuleDAL();
            IList <Module> modules = newDAL.GetAllModulesByProjectID(Convert.ToInt32(ddlProject.SelectedValue));

            ddlModule.Items.Clear();
            foreach (Module module in modules)
            {
                ListItem newItem = new ListItem();
                newItem.Text  = module.ModuleName;
                newItem.Value = module.ModuleID.ToString();
                ddlModule.Items.Add(newItem);
            }
        }
 /**
  * Método para crear un nuevo registro
  */
 public static void insert(String name)
 {
     try {
         if (ModuleDAL.exists(name))
         {
             throw new ExistsException();
         }
         else
         {
             ModuleDAL.insert(name);
         }
     } catch (Exception e) {
         throw e;
     }
 }
示例#10
0
        public static UserLogin signIn(String email, String password)
        {
            try {
                String    token = randomString();
                var       x     = UserDAL.signIn(email, encodeTo64(password), token);
                UserLogin user  = new UserLogin();
                user.id    = long.Parse(x.id + "");
                user.name  = x.name;
                user.email = x.email;
                user.rol   = x.rol_id == null ? null : RolDAL.fetchAll().Where(y => y.id == x.rol_id).Select(z => new Rol()
                {
                    id    = long.Parse(z.id + ""),
                    name  = z.name,
                    state = int.Parse(z.state + "")
                }).FirstOrDefault();
                user.unit = x.unit_id == null ? null : UnitDAL.fetchAll().Where(y => y.id == x.unit_id).Select(z => new Unit()
                {
                    id    = long.Parse(z.id + ""),
                    name  = z.name,
                    state = int.Parse(z.state + "")
                }).FirstOrDefault();
                user.state         = int.Parse(x.state + "");
                user.token_session = x.token_session;


                List <Module> modulesDomain = new List <Module>();

                var modules = RolModuleDAL.fetchAll().Where(rm => rm.rol_id == user.rol.id).ToList();
                foreach (roles_modules rm in modules)
                {
                    var md = ModuleDAL.fetchAll().Where(mo => mo.id == rm.module_id).Select(y =>
                                                                                            new Module()
                    {
                        id    = long.Parse(y.id + ""),
                        name  = y.name,
                        state = int.Parse(y.state + ""),
                        code  = y.code
                    }).FirstOrDefault();
                    modulesDomain.Add(md);
                }
                user.rol.modules = modulesDomain;


                return(user);
            } catch (Exception e) {
                throw e;
            }
        }
示例#11
0
        protected void SaveModule()
        {
            Module newModule = new Module();

            if (ViewState["moduleid"] != null)
            {
                newModule.ModuleID = Convert.ToInt32(ViewState["moduleid"]);
            }
            newModule.ModuleName  = txtModule.Text;
            newModule.ProjectID   = Convert.ToInt32(ddlProject.SelectedValue);
            newModule.Description = txtDesc.Text;
            newModule.Creator     = GetLoggedUser();
            newModule.CreateDate  = System.DateTime.Now;
            ModuleDAL newDal = new ModuleDAL();

            newDal.SaveModule(newModule);
        }
        /**
         * Método para obtener la lista de datos realizando el mapeo desde la capa de datos
         */
        public static List <Rol> fetchAll()
        {
            try {
                List <Rol> rolesDomain = new List <Rol>();
                var        rolesList   = RolDAL.fetchAll();

                foreach (roles item in rolesList)
                {
                    Rol rol = new Rol();
                    rol.id    = long.Parse(item.id + "");
                    rol.name  = item.name;
                    rol.state = int.Parse(item.state + "");
                    List <Module> modulesDomain = new List <Module>();

                    var modules = RolModuleDAL.fetchAll().Where(x => x.rol_id == item.id).ToList();
                    foreach (roles_modules rm in modules)
                    {
                        var md = ModuleDAL.fetchAll().Where(x => x.id == rm.module_id).Select(y =>
                                                                                              new Module()
                        {
                            id    = long.Parse(y.id + ""),
                            name  = y.name,
                            state = int.Parse(y.state + ""),
                            code  = y.code
                        }).FirstOrDefault();
                        modulesDomain.Add(md);
                    }
                    rol.modules = modulesDomain;

                    rolesDomain.Add(rol);
                }
                return(rolesDomain);
            } catch (Exception e) {
                throw e;
            }
        }