protected void insert_gurdian()
 {
     try {
         using (databaseDataContext dbcon = new databaseDataContext())
         {   //without date of birth
             gurdian reg_gurdian = new gurdian
             {
                 name     = name.Text,
                 username = username.Text,
                 password = password.Text,
                 gender   = gender.SelectedItem.ToString(),
                 id       = int.Parse(id.Text),
                 // dob=dob_g.Value,
                 family_member = int.Parse(family.Text),
                 month_sal     = int.Parse(salary.Text)
             };
             dbcon.gurdians.InsertOnSubmit(reg_gurdian);
             dbcon.SubmitChanges();
         }
         MessageBox.Show("registration complete");
         Form1 fm1 = new Form1();
         this.Hide();
         fm1.Show();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
Exemple #2
0
        private bool YourValidationFunction(string UserName, string Password)

        {
            bool boolReturnValue     = false;
            databaseDataContext myDB = new databaseDataContext();



            var user = (from u in myDB.UserManagers

                        select u).FirstOrDefault();



            if ((UserName == user.UserID) & (Password == user.Password.ToString()))

            {
                boolReturnValue = true;

                Response.Redirect("actionregaddforall.aspx");
            }



            return(boolReturnValue);
        }
Exemple #3
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            String  id  = Session["id"].ToString();
            decimal dec = System.Convert.ToDecimal(id);



            String acitvity_id = activity_name.SelectedItem.Value;

            databaseDataContext up = new databaseDataContext();
            //Get Single course which need to update
            RefComplaint obj = up.RefComplaints.Single(c => c.complaint_id.Equals(dec));

            //Field which will be update

            int activity_id = System.Convert.ToInt16(activity_name.SelectedItem.Value);

            obj.ActivityID = activity_id;

            // executes the appropriate commands to implement the changes to the database
            up.SubmitChanges();

            databaseDataContext up1 = new databaseDataContext();

            RefActivityDetail activity = new RefActivityDetail {
                complaint_id = dec, ActivityID = activity_id
            };

            up1.RefActivityDetails.InsertOnSubmit(activity);
            up1.SubmitChanges();

            Response.Redirect("compaint_list.aspx");
        }
Exemple #4
0
        private void addexpense(object sender, EventArgs e)
        {
            databaseDataContext db  = new databaseDataContext();
            cost_table          c   = new cost_table();
            databaseDataContext db1 = new databaseDataContext();
            gurdian             g   = new gurdian();
            budget_setting      bs  = new budget_setting();

            try
            {
                //     Form1 f = new Form1();
                //  MessageBox.Show(dateTimePicker1.Value.Month.ToString());
                bs     = db1.budget_settings.SingleOrDefault(x => x.year == dateTimePicker1.Value.Year && x.month == convertdate(dateTimePicker1.Value.Month.ToString()));
                bs.max = bs.max + Int32.Parse(textBoxCostAmount.Text);

                c.cost_title  = textBoxCostTitle.Text;
                c.cost_amount = Int32.Parse(textBoxCostAmount.Text);
                g             = db1.gurdians.SingleOrDefault(x => x.id == gid);
                // string s = f.gid.ToString();
                c.username = g.username;
                c.date     = dateTimePicker1.Value;
                db.cost_tables.InsertOnSubmit(c);
                db1.SubmitChanges();
                db.SubmitChanges();
                MessageBox.Show("expense added");
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Exemple #5
0
        public static List <UserDTO> JoinedUsers(int planId)
        {
            List <UserDTO> users = new List <UserDTO>();;

            try
            {
                databaseDataContext db = new databaseDataContext();

                var find =
                    (from up in db.UserPlans
                     where up.PlanId == planId
                     select up.UserId);

                foreach (int userId in find)
                {
                    UserDTO user = Users.Read(userId);

                    users.Add(user);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return(users);
        }
Exemple #6
0
        public static void Update(DoorDTO updateDoor)
        {
            try
            {
                databaseDataContext db = new databaseDataContext();

                var find =
                    (from door in db.Doors
                     where door.Id == updateDoor.Id
                     select door).Single();

                find.BoxId     = updateDoor.BoxId;
                find.Width     = updateDoor.Width;
                find.Height    = updateDoor.Height;
                find.Depth     = updateDoor.Depth;
                find.PositionX = updateDoor.PositionX;
                find.PositionY = updateDoor.PositionY;
                find.PositionZ = updateDoor.PositionZ;
                find.Name      = updateDoor.Name;
                find.Texture   = updateDoor.Texture;
                find.pregrada  = updateDoor.pregrada;

                db.SubmitChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemple #7
0
        public static int Create(UserDTO userCreate)
        {
            try
            {
                databaseDataContext db = new databaseDataContext();

                User user = new User()
                {
                    FirstName = userCreate.FirstName,
                    LastName  = userCreate.LastName,
                    UserName  = userCreate.UserName,
                    Password  = userCreate.Password,
                    Status    = userCreate.Status
                };

                db.Users.InsertOnSubmit(user);
                db.SubmitChanges();

                return(user.Id);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(-1);
        }
Exemple #8
0
        public static UserPlanDTO ReadPlanId(int planId)
        {
            UserPlanDTO upRead = null;

            try
            {
                databaseDataContext db = new databaseDataContext();

                var find =
                    (from up in db.UserPlans
                     where up.PlanId == planId
                     select up).First();

                upRead = new UserPlanDTO()
                {
                    Id     = find.Id,
                    UserId = find.UserId,
                    PlanId = find.PlanId
                };
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(upRead);
        }
Exemple #9
0
        public static PlanDTO Read(int planId)
        {
            PlanDTO planRead = null;

            try
            {
                databaseDataContext db = new databaseDataContext();

                var find =
                    (from plan in db.Plans
                     where plan.Id == planId
                     select plan).FirstOrDefault();

                planRead = new PlanDTO()
                {
                    Id     = find.Id,
                    UserId = find.UserId,
                    Name   = find.Name
                };
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(planRead);
        }
Exemple #10
0
        public static List <PlanDTO> ReadAll()
        {
            List <PlanDTO> plans = new List <PlanDTO>();;

            try
            {
                databaseDataContext db = new databaseDataContext();

                var find =
                    (from plan in db.Plans
                     select plan);

                foreach (Plan plan in find)
                {
                    PlanDTO planRead = new PlanDTO()
                    {
                        Id     = plan.Id,
                        UserId = plan.UserId,
                        Name   = plan.Name
                    };

                    plans.Add(planRead);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return(plans);
        }
Exemple #11
0
        public static void Update(BoxDTO updateBox)
        {
            try
            {
                databaseDataContext db = new databaseDataContext();

                var find =
                    (from box in db.Boxes
                     where box.Id == updateBox.Id
                     select box).Single();

                find.PlanId         = updateBox.PlanId;
                find.Width          = updateBox.Width;
                find.Height         = updateBox.Height;
                find.Depth          = updateBox.Depth;
                find.BoardThickness = updateBox.BoardThickness;
                find.PositionX      = updateBox.PositionX;
                find.PositionY      = updateBox.PositionY;
                find.PositionZ      = updateBox.PositionZ;
                find.Name           = updateBox.Name;
                find.Texture        = updateBox.Texture;
                find.vertikalno     = updateBox.vertikalno;
                find.horizontalno   = updateBox.horizontalno;
                find.globalX        = updateBox.globalX;
                find.globalY        = updateBox.globalY;
                find.globalZ        = updateBox.globalZ;

                db.SubmitChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemple #12
0
        public static Dictionary <int, Queue <int> > CreateRooms()
        {
            Dictionary <int, Queue <int> > Rooms = new Dictionary <int, Queue <int> >();

            try
            {
                databaseDataContext db = new databaseDataContext();

                var plans =
                    (from p in db.Plans
                     select p);

                foreach (Plan plan in plans)
                {
                    Queue <int> queue = new Queue <int>();
                    queue.Enqueue(plan.UserId); //master

                    foreach (UserDTO user in UserPlans.JoinedUsers(plan.Id))
                    {
                        queue.Enqueue(user.Id);
                    }

                    Rooms.Add(plan.Id, queue);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(Rooms);
        }
Exemple #13
0
        public static void Update(BoardDTO updateBoard)
        {
            try
            {
                databaseDataContext db = new databaseDataContext();

                var find =
                    (from board in db.Boards
                     where board.Id == updateBoard.Id
                     select board).Single();

                find.BoxId          = updateBoard.BoxId;
                find.Width          = updateBoard.Width;
                find.Height         = updateBoard.Height;
                find.Depth          = updateBoard.Depth;
                find.BoardThickness = updateBoard.BoardThickness;
                find.PositionX      = updateBoard.PositionX;
                find.PositionY      = updateBoard.PositionY;
                find.PositionZ      = updateBoard.PositionZ;
                find.Name           = updateBoard.Name;
                find.Texture        = updateBoard.Texture;

                db.SubmitChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemple #14
0
        public static BoardDTO Read(int boardId)
        {
            BoardDTO boardRead = null;

            try
            {
                databaseDataContext db = new databaseDataContext();

                var find =
                    (from board in db.Boards
                     where board.Id == boardId
                     select board).Single();

                boardRead = new BoardDTO()
                {
                    Id             = find.Id,
                    BoxId          = find.BoxId,
                    Width          = find.Width,
                    Height         = find.Height,
                    Depth          = find.Depth,
                    BoardThickness = find.BoardThickness,
                    PositionX      = find.PositionX,
                    PositionY      = find.PositionY,
                    PositionZ      = find.PositionZ,
                    Name           = find.Name,
                    Texture        = find.Texture
                };
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(boardRead);
        }
Exemple #15
0
        public static int Create(BoardDTO boardCreate)
        {
            try
            {
                databaseDataContext db = new databaseDataContext();

                Board board = new Board()
                {
                    BoxId          = boardCreate.BoxId,
                    Width          = boardCreate.Width,
                    Height         = boardCreate.Height,
                    Depth          = boardCreate.Depth,
                    BoardThickness = boardCreate.BoardThickness,
                    PositionX      = boardCreate.PositionX,
                    PositionY      = boardCreate.PositionY,
                    PositionZ      = boardCreate.PositionZ,
                    Name           = boardCreate.Name,
                    Texture        = boardCreate.Texture
                };

                db.Boards.InsertOnSubmit(board);
                db.SubmitChanges();

                return(board.Id);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(-1);
        }
Exemple #16
0
        public static List <UserPlanDTO> ReadAll()
        {
            List <UserPlanDTO> ups = new List <UserPlanDTO>();;

            try
            {
                databaseDataContext db = new databaseDataContext();

                var find =
                    (from up in db.UserPlans
                     select up);

                foreach (UserPlan up in find)
                {
                    UserPlanDTO upRead = new UserPlanDTO()
                    {
                        Id     = up.Id,
                        UserId = up.UserId,
                        PlanId = up.PlanId
                    };

                    ups.Add(upRead);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return(ups);
        }
Exemple #17
0
        private void set_budget(object sender, EventArgs e)
        {
            databaseDataContext db  = new databaseDataContext();
            budget_setting      bs  = new budget_setting();
            databaseDataContext db1 = new databaseDataContext();
            int            s        = Int32.Parse(comboBoxYear.GetItemText(this.comboBoxYear.SelectedItem));
            string         n        = comboBoxMonth.GetItemText(this.comboBoxMonth.SelectedItem);
            budget_setting bs1      = new budget_setting();

            try{
                bs1 = db1.budget_settings.SingleOrDefault(x => x.year == s && x.month == n);


                if (bs1 == null)
                {
                    bs.year        = s;
                    bs.month       = n;
                    bs.max         = 0;
                    bs.budget      = Int32.Parse(textBoxBudget.Text);
                    bs.guardian_id = gid;
                    db.budget_settings.InsertOnSubmit(bs);
                    db.SubmitChanges();
                    MessageBox.Show("budget set");
                }
                else
                {
                    MessageBox.Show("item already exist");
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Exemple #18
0
        public static UserDTO Read(int userId)
        {
            UserDTO userRead = null;

            try
            {
                databaseDataContext db = new databaseDataContext();

                var find =
                    (from user in db.Users
                     where user.Id == userId
                     select user).Single();

                userRead = new UserDTO()
                {
                    Id        = find.Id,
                    FirstName = find.FirstName,
                    LastName  = find.LastName,
                    UserName  = find.UserName,
                    Password  = find.Password,
                    Status    = find.Status
                };
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(userRead);
        }
        private void addmemexp(object sender, EventArgs e)
        {
            databaseDataContext db  = new databaseDataContext();
            cost_table          c   = new cost_table();
            databaseDataContext db1 = new databaseDataContext();
            // member m = new member();
            balance b = new balance();

            try {
                c.cost_title  = textBox3.Text;
                c.cost_amount = Int32.Parse(textBox4.Text);
                // m = db1.members.SingleOrDefault(x=>x.username==mid);
                // string s = f.gid.ToString();
                c.username = mid;
                c.date     = dateTimePicker1.Value;
                db.cost_tables.InsertOnSubmit(c);
                db.SubmitChanges();

                b        = db1.balances.SingleOrDefault(x => x.membername == mid);
                b.amount = b.amount - Int32.Parse(textBox4.Text);
                db1.SubmitChanges();


                MessageBox.Show("expense added");
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
        public void acceptreq(object sender, EventArgs e)
        {
            databaseDataContext db3 = new databaseDataContext();
            budget_setting      bs  = new budget_setting();
            //DateTime dt = new DateTime();
            databaseDataContext db = new databaseDataContext();
            balance             b  = new balance();
            request             r  = new request();
            admin adm = new admin(gid);
            databaseDataContext db1 = new databaseDataContext();

            try {
                string s  = comboBox1.GetItemText(this.comboBox1.SelectedItem);
                int    es = Int32.Parse(s);

                b        = db.balances.SingleOrDefault(x => x.membername == textBox1.Text);
                b.amount = b.amount + es;


                db.SubmitChanges();
                r = db1.requests.SingleOrDefault(x => x.amount == es);
                db1.requests.DeleteOnSubmit(r);
                db1.SubmitChanges();
                //following 3 lines don't work
                //bs = db3.budget_settings.SingleOrDefault(x => x.guardian_id == gid && x.year==dateTimePicker1.Value.Month && x.month==adm.convertdate(dateTimePicker1.Value.Month.ToString()));
                //bs.max = bs.max + es;

                //db3.SubmitChanges();



                MessageBox.Show("request accepted");
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Exemple #21
0
        public static int Create(DoorDTO doorCreate)
        {
            try
            {
                databaseDataContext db = new databaseDataContext();

                Door door = new Door()
                {
                    BoxId     = doorCreate.BoxId,
                    Width     = doorCreate.Width,
                    Height    = doorCreate.Height,
                    Depth     = doorCreate.Depth,
                    PositionX = doorCreate.PositionX,
                    PositionY = doorCreate.PositionY,
                    PositionZ = doorCreate.PositionZ,
                    Name      = doorCreate.Name,
                    Texture   = doorCreate.Texture,
                    pregrada  = doorCreate.pregrada
                };

                db.Doors.InsertOnSubmit(door);
                db.SubmitChanges();

                return(door.Id);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(-1);
        }
        private void changemempass(object sender, EventArgs e)
        {
            databaseDataContext db = new databaseDataContext();
            member m = new member();


            try
            {
                m = db.members.SingleOrDefault(x => x.username == mid);

                if (textBox7.Text == textBox8.Text)
                {
                    m.password = textBox8.Text;

                    db.SubmitChanges();

                    MessageBox.Show("Password change successfully!");
                }
                else
                {
                    MessageBox.Show("Passwords didn't match");
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
        private void deletereq(object sender, EventArgs e)
        {
            //databaseDataContext db = new databaseDataContext();
            //   balance b = new balance();
            request             r   = new request();
            databaseDataContext db1 = new databaseDataContext();

            // budget_setting bs = new budget_setting();


            try {
                string s  = comboBox1.GetItemText(this.comboBox1.SelectedItem);
                int    es = Int32.Parse(s);

                //     b = db.balances.SingleOrDefault(x => x.membername == textBox1.Text);
                //   b.balance1 = b.balance1 + es;


                // db.SubmitChanges();
                r = db1.requests.SingleOrDefault(x => x.amount == es);
                db1.requests.DeleteOnSubmit(r);
                db1.SubmitChanges();
                MessageBox.Show("request deleted");
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Exemple #24
0
        public static DoorDTO Read(int doorId)
        {
            DoorDTO doorRead = null;

            try
            {
                databaseDataContext db = new databaseDataContext();

                var find =
                    (from door in db.Doors
                     where door.Id == doorId
                     select door).Single();

                doorRead = new DoorDTO()
                {
                    Id        = find.Id,
                    BoxId     = find.BoxId,
                    Width     = find.Width,
                    Height    = find.Height,
                    Depth     = find.Depth,
                    PositionX = find.PositionX,
                    PositionY = find.PositionY,
                    PositionZ = find.PositionZ,
                    Name      = find.Name,
                    Texture   = find.Texture,
                    pregrada  = find.pregrada
                };
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            return(doorRead);
        }
Exemple #25
0
        public void SendEmail()
        {
            String  id        = Session["id"].ToString();
            decimal dec       = System.Convert.ToDecimal(id);
            string  struserid = Session["UserID"].ToString();

            databaseDataContext data = new databaseDataContext();

            var complaint = (from u in data.RefComplaints
                             where u.complaint_id.Equals(dec)
                             select u).FirstOrDefault();

            String assigne_by = complaint.Reporters_email.ToString();


            String subject = complaint.subject + " " + complaint.category + " ( ID: " + complaint.complaint_id.ToString() + " )";

            //  String bodyforemail =  + "\n\n" + ;



            //var email_to = (from u in data.UserManagers
            //            where u.UserID.Equals()
            //            select u).FirstOrDefault();

            var email_from = (from u in data.UserManagers
                              where u.UserID.Equals(struserid)
                              select u).FirstOrDefault();

            Session["subject"] = subject;
            Session["date"]    = complaint.date;
            Session["from"]    = email_from.OrgEmail;
            Session["to"]      = "IT Help Desk";
            Session["channel"] = complaint.Reported_channel_ID;
            Session["problem"] = complaint.Reported_problem_ID;
            Session["system"]  = complaint.subject;
            Session["module"]  = complaint.category;



            MailMessage message = new System.Net.Mail.MailMessage();

            message.To.Add("*****@*****.**");
            //  message.To.Add(email_to.OrgEmail);
            message.CC.Add(email_from.OrgEmail);
            message.Subject = subject;
            message.From    = new System.Net.Mail.MailAddress("*****@*****.**");
            //message.Body = bodyforemail;
            message.Body = "Dear Ashi Irum" + "\n The issue of " + complaint.category + " module of " + complaint.subject + " created on  DATE: " + complaint.date.ToString() + " .\n"
                           + email_from.UserName + " is resolving the complaint which is generated by You.\n\n Problem Status : " + activity.SelectedItem.Text + "\n " + TextBox1.Text + ".\n Kindly check and confirm.\n\n Thank you & Regards \n UBank \n\n\n This Email is Auto-Generated by Ubank Support Incident Record Portal."
                           + "\n Following are the steps to view the pending tasks that are posted in your account " + "\n1.  Open website http://localhost:2045/Default.aspx \n 2.  Logon to the website \n 3.  Click on Action Register \n 4.  Click on Update Request Status \n\n If you don’t have rights, please contact Web administrator";
            System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(ConfigurationManager.AppSettings["smtpServer"].ToString());
            smtp.Send(message);

            Response.Redirect("validation_resolve.aspx");

            //return true;
        }
Exemple #26
0
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            String  id  = Session["id"].ToString();
            decimal dec = System.Convert.ToDecimal(id);

            string struserid = Session["UserID"].ToString();

            Session["check"]   = 1;
            Session["subject"] = "complaint";
            Session["subject"] = "complaint";
            Session["to"]      = "hh";
            Session["date"]    = DateTime.Now.ToString();
            Session["channel"] = "";
            Session["problem"] = "";
            Session["system"]  = "";
            Session["module"]  = "";
            int    actvity_id = System.Convert.ToInt16(activity.SelectedItem.Value);
            string des        = TextBox1.Text;
            string time       = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            databaseDataContext data = new databaseDataContext();


            RefActivityDetail obj = new RefActivityDetail
            {
                complaint_id          = dec,
                ActivityID            = actvity_id,
                Activity_description  = des,
                Activity_time         = System.Convert.ToDateTime(time),
                Activity_performed_by = struserid
            };

            data.RefActivityDetails.InsertOnSubmit(obj);

            RefComplaint obj11 = data.RefComplaints.Single(c => c.complaint_id.Equals(dec));



            if (actvity_id.Equals(2) || actvity_id.Equals(10) || actvity_id.Equals(12))
            {
                obj11.status = "Close";
            }
            else
            {
                obj11.status = "Open";
            }



            obj11.ActivityID = actvity_id;
            obj11.Assigne_to = struserid;
            data.SubmitChanges();



            SendEmail();
        }
Exemple #27
0
        protected void budget_set()
        {
            // Form1 f1 =  new Form1();
            //Null reference exception here
            databaseDataContext db = new databaseDataContext();

            try
            {
                budget_setting b = new budget_setting();
                b.year        = int.Parse(comboBox1.SelectedItem.ToString());
                b.month       = comboBox2.SelectedItem.ToString();
                b.max         = 0;
                b.budget      = int.Parse(textBoxBudget.Text);
                b.guardian_id = gid;
                // b.guardian_id = f1.gid;


                db.budget_settings.InsertOnSubmit(b);
                db.SubmitChanges();

                MessageBox.Show("budget setting done!");
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show(ex.Message);
            }



            /*try
             * {
             *  using (databaseDataContext dbcon = new databaseDataContext())
             *  {
             *      budget_setting bd=new budget_setting
             *      {
             *          year = int.Parse(comboBox1.SelectedItem.ToString()),
             *          month = comboBox2.SelectedItem.ToString(),
             *          budget = int.Parse(textBoxBudget.SelectedText),
             *          max = int.Parse(textBoxMAX.SelectedText),
             *          budget_id=int.Parse(textBoxBudgetId.SelectedText)
             *          //month_id=tex
             *      };
             *      dbcon.budget_settings.InsertOnSubmit(bd);
             *      dbcon.SubmitChanges();
             *
             *  }
             *  //label17.Text = "Successfullt Done!";
             *
             *  //MessageBox.Show("Done");
             * }
             * catch (Exception ex)
             * {
             *  MessageBox.Show(ex.Message);
             *
             * }*/
        }
Exemple #28
0
        private void grid_view_Load(object sender, EventArgs e)
        {
            try
            {
                databaseDataContext db1 = new databaseDataContext();

                Grid.DataSource = db1.cost_tables.Where(x => x.username == id).Select(x => new { x.cost_amount, x.cost_title, x.date });
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
        private void select1stcombo(object sender, EventArgs e)
        {
            request             r  = new request();
            databaseDataContext db = new databaseDataContext();
            int a = int.Parse(comboBox1.GetItemText(this.comboBox1.SelectedItem));

            r                 = db.requests.SingleOrDefault(x => x.amount == a);
            textBox1.Text     = r.username;
            richTextBox1.Text = r.description;
            button1.Enabled   = true;
            button2.Enabled   = true;
        }
        private void showbalance(object sender, EventArgs e)
        {
            databaseDataContext db = new databaseDataContext();
            member  m = new member();
            balance b = new balance();

            try {
                b           = db.balances.SingleOrDefault(x => x.membername == mid);
                label5.Text = b.amount.ToString();
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }