public object Updateuser(RegisterTable ast)
        {
            try
            {
                var obj = DB.RegisterTables.Where(x => x.ID == ast.ID).ToList().FirstOrDefault();

                if (obj.ID > 0)

                {
                    obj.Name       = ast.Name;
                    obj.Mobile     = ast.Mobile;
                    obj.Email      = ast.Email;
                    obj.Department = ast.Department;
                    obj.Password   = ast.Password;
                    DB.SaveChanges();

                    return(new Response
                    {
                        Status = "Updated",
                        Message = "Updated Successfully"
                    });
                }
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(new Response
            {
                Status = "Error",
                Message = "Invalid Data."
            });
        }
Exemple #2
0
 public byte[] this[RegisterTable table, RegisterCapacity cap, XRegCode register]
 {
     // An easy way to fetch a register given its information.
     // Returns a byte[] of length $cap consisting of the bottom $cap bytes of $Registers[$table+$register]
     // Access to upper byte registers such as AH can be done artifically by fetching AX then using $AX[1] as the upper byte.
     get
     {
         byte[] Output = new byte[(int)cap];
         for (int i = 0; i < Output.Length; i++)
         {
             Output[i] = Registers[(int)register + (int)table][i];
         }
         return(Output);
     }
     set
     {
         // If the length of the input byte array is greater than the capacity, data would be lost. Something wrong here would most likely be on my part.
         if (value.Length > ((int)cap))
         {
             throw new Exception("RegisterGroup.cs Attempt to overflow register in base class");
         }
         // Overwrite the bytes in $Registers[] with $value[]
         for (int i = 0; i < value.Length; i++)
         {
             Registers[(int)register + (int)table][i] = value[i];
         }
     }
 }
 public object Insert(RegisterTable Reg)
 {
     try
     {
         RegisterTable EL = new RegisterTable();
         if (EL.ID == 0)
         {
             EL.Name       = Reg.Name;
             EL.Mobile     = Reg.Mobile;
             EL.Email      = Reg.Email;
             EL.Department = Reg.Department;
             EL.Password   = Reg.Password;
             DB.RegisterTables.Add(EL);
             DB.SaveChanges();
             return(new Response
             {
                 Status = "Success", Message = "Record SuccessFully Saved."
             });
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     return(new Response
     {
         Status = "Error", Message = "Invalid Data."
     });
 }
 public AdminDashboardViewModel(RegisterTable SelectedContents)
 {
     ClientID          = SelectedContents.UserId.ToString();
     _SelectedContents = SelectedContents;
     GetUserTasks();
     DeleteCommand         = new Command(DeleteLabelSelected);
     UpdateDatabaseCommand = new Command(async() => await UpdateUserDataBase());
 }
        //metodo para cargar el contenido de las tablelayoutpanel sin tanto delay y de forma mas optima
        private void OptimizeTableLayoutPanel()
        {
            Type tp = RegisterTable.GetType().BaseType;

            System.Reflection.PropertyInfo pi =
                tp.GetProperty("DoubleBuffered",
                               System.Reflection.BindingFlags.Instance
                               | System.Reflection.BindingFlags.NonPublic);
            pi.SetValue(RegisterTable, true, null);
        }
 public ActionResult Edit([Bind(Include = "Account_Number,Account_Holdername,Email_id,Password,Confirm_Password,Mobile_Number,Address")] RegisterTable registerTable)
 {
     if (ModelState.IsValid)
     {
         db.Entry(registerTable).State = EntityState.Modified;
         db.SaveChanges();
         TempData["SuccessMessage"] = "updated Successfully";
         return(RedirectToAction("Index"));
     }
     return(View(registerTable));
 }
Exemple #7
0
 public ActionResult Register(RegisterTable Rg)
 {
     using (PecuniaBankEntities DB = new PecuniaBankEntities()) //create an instance for table name to adding the data in the table
     {
         DB.RegisterTables.Add(Rg);                             //Add the data in table
         DB.SaveChanges();                                      //save the data
     }
     ModelState.Clear();
     ViewBag.SuccessMessage = "Registration Successfully.";
     return(View("Register", new RegisterTable()));
 }
 public ActionResult SaveData(RegisterTable objRegister)
 {
     if (ModelState.IsValid)
     {
         using (HotelDBEntities objHotelDBEntities = new HotelDBEntities())
         {
             objHotelDBEntities.RegisterTables.Add(objRegister);
             objHotelDBEntities.SaveChanges();
         }
         ModelState.Clear();
     }
     return(RedirectToAction("Index"));
 }
        // GET: RegisterTables/Delete/5
        public ActionResult Delete(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RegisterTable registerTable = db.RegisterTables.Find(id);

            if (registerTable == null)
            {
                return(HttpNotFound());
            }
            return(View(registerTable));
        }
        public ActionResult DeleteConfirmed(long id)
        {
            RegisterTable registerTable = db.RegisterTables.Find(id);

            db.RegisterTables.Remove(registerTable);

            db.SaveChanges();
            //ViewBag.Message = "Are you sure to delete this record";
            //return Content("<script language='javascript' type='text/javascript'>('Are you sure to delete this record.');" +
            //    "window.location='Index';</script>");

            TempData["SuccessMessage"] = "Deleted Successfully";
            return(RedirectToAction("Index"));
        }
Exemple #11
0
            public RegisterHandle(XRegCode registerCode, RegisterTable table, RegisterCapacity size = RegisterCapacity.NONE, RegisterHandleSettings settings = RegisterHandleSettings.NONE)
            {
                // A constructor for infering a register from a set of arguments.
                // Strictly this isnt done here, rather in the Fetch() and Set() methods
                Code     = registerCode;
                Table    = table;
                Settings = settings;

                // If the input register capacity is NONE(or there wasn't one passed in the arguments), do not initialise the size.
                // This means that attempting to use the register handle before it is initialised will consistently throw the same exception.
                if (size != RegisterCapacity.NONE)
                {
                    Size = size;
                }

                // If $size was NONE, and the register handle has NO_INIT set, there would never be a possibility of the register handle being used, so throw an exception now.
                // This rounds down the problem a little more than a "variable not initialised" exception or alike, as it would be a typo or improper class usage.
                else if ((Settings | RegisterHandleSettings.NO_INIT) == Settings)
                {
                    throw new System.Exception("Must be a possibility of register size initialising.");
                }
            }
Exemple #12
0
        // GET: Register

        public ActionResult Index(RegisterTable regDetails)
        {
            dbContext.RegisterTables.Add(regDetails);
            dbContext.SaveChanges();
            return(View());
        }
Exemple #13
0
        public ActionResult Register(int id = 0)           //get the data from table
        {
            RegisterTable usermodel = new RegisterTable(); //create instance for Model table

            return(View(usermodel));                       //View data in the table
        }
 public AdminDashboardDetails(RegisterTable registerTable)
 {
     InitializeComponent();
     BindingContext = new AdminDashboardViewModel(registerTable);
 }