Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            lbAlertMessage.Text = "";
            if (GridUsertype.CurrentRow != null)
            {
                string UserID       = Convert1.ToString(GridUsertype.CurrentRow.Cells[1].Value);
                string UserName     = GridUsertype.CurrentRow.Cells[2].Value.ToString();
                var    listUserroom = (from t1 in dbc.mst_user_rooms
                                       where t1.mut_username == UserName
                                       select t1);
                dbc.mst_user_rooms.DeleteAllOnSubmit(listUserroom);

                for (int i = 0; i <= dataGridView1.Rows.Count - 1; i++)
                {
                    if (Convert1.ToBoolean(dataGridView1[0, i].Value) == true)
                    {
                        int mrmid = Utility.GetInteger(dataGridView1[1, i].Value);

                        mst_user_type usermut = (from t1 in dbc.mst_user_types where t1.mut_username == UserName select t1).FirstOrDefault();
                        mst_user_room newitem = new mst_user_room();
                        newitem.mst_user_type = usermut;
                        newitem.mut_id        = usermut.mut_id;
                        newitem.mut_username  = UserName;
                        newitem.mrm_id        = mrmid;
                        dbc.mst_user_rooms.InsertOnSubmit(newitem);
                    }
                }
                dbc.SubmitChanges();
                lbAlertMessage.Text = "Save data completed.";
            }
            else
            {
                lbAlertMessage.Text = "Please select user for edit.";
            }
        }
Пример #2
0
        private void btnUnlockRoom_Click(object sender, EventArgs e)
        {
            lbmsgAlert.Text = "";
            string   msgdisplay = "";
            DateTime dateNow    = Program.GetServerDateTime();

            for (int iRow = 0; iRow <= GridRoomLock.Rows.Count - 1; iRow++)
            {
                Boolean isselect = Convert1.ToBoolean(GridRoomLock["Colselect", iRow].Value);
                int     mrdid    = Convert1.ToInt32(GridRoomLock["Colmrd_id", iRow].Value);
                if (isselect == true)
                {
                    using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                    {
                        cdc.log_user_logins.Where(x => x.mrd_id == mrdid && x.lug_end_date == null).ToList()
                        .ForEach(x => x.lug_end_date = dateNow);
                        cdc.SubmitChanges();
                    }
                    msgdisplay = "Unlock completed.";
                }
            }
            btnsearch_Click(null, null);
            ShowRoomLock(0);
            lbmsgAlert.Text = msgdisplay;
        }
Пример #3
0
        private void btnsearch_Click(object sender, EventArgs e)
        {
            lbmsgAlert.Text = "";
            int mhsid = Convert1.ToInt32(DDSite.SelectedValue);
            int mrmid = Convert1.ToInt32(DDRoom.SelectedValue);

            LoadGrid(mhsid, mrmid);
        }
Пример #4
0
 public static int?GetValueComboBoxInt(ComboBox cmd)
 {
     try
     {
         DropdownData castedItem = (DropdownData)cmd.SelectedItem;
         return(Convert1.ToInt32(castedItem.Code));
     }
     catch (Exception)
     {
     }
     return(null);
 }
Пример #5
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dataGridView1.CurrentRow != null && dataGridView1.ReadOnly == false)
     {
         bool ischeck = Convert1.ToBoolean(dataGridView1[0, e.RowIndex].Value);
         if (ischeck == false)
         {
             dataGridView1[0, e.RowIndex].Value = true;
         }
         else
         {
             dataGridView1[0, e.RowIndex].Value = false;
         }
     }
 }
Пример #6
0
        private List <int> GetSelectEvent_mvtid()
        {
            List <int> mvtidlist = new List <int>();

            for (int iRow = 0; iRow <= GridRoomEvent_Event.Rows.Count - 1; iRow++)
            {
                Boolean isselect = Convert1.ToBoolean(GridRoomEvent_Event["ColRoomEvent_EventSelect", iRow].Value);
                int     mvtid    = Utility.GetInteger(GridRoomEvent_Event["ColRoomEvent_Event_mvtid", iRow].Value);
                if (isselect == true)
                {
                    mvtidlist.Add(mvtid);
                }
            }
            return(mvtidlist);
            //ColRoomEvent_Event_mvtid
        }
Пример #7
0
        private void mstroomdtlsBindingSource_CurrentItemChanged1(object sender, EventArgs e)
        {
            mst_room_dtl currentdtl = (mst_room_dtl)mstroomdtlsBindingSource.Current;

            if (currentdtl != null)
            {
                //status
                if (currentdtl.mrd_status == 'A')
                {
                    chRoomActive.Checked = true;
                }
                else
                {
                    chRoomActive.Checked = false;
                }

                //Type
                Program.SetValueRadioGroupBox(GBRoomType, Convert1.ToString(currentdtl.mrd_type));
                //
            }
        }
Пример #8
0
        private void ShowRoomLock(int rowid)
        {
            int mrmid = Convert1.ToInt32(GridSiteRoom["ColmrmID", rowid].Value);

            /*  select mrd.mrd_ename, COUNT(1)
             *  from mst_room_dtl mrd,
             *  log_user_login lug
             *  where mrd.mrd_id = lug.mrd_id
             *  and lug.lug_end_date is null
             *  and mrd.mrm_id = mrm_id
             *  group by mrd.mrd_ename
             * ]*/
            var objlistLock = (from lug in dbc.log_user_logins
                               from mrd in dbc.mst_room_dtls
                               from mut in dbc.mst_user_types
                               where mrd.mrd_id == lug.mrd_id &&
                               lug.lug_end_date == null &&
                               mrd.mrm_id == mrmid &&
                               lug.mut_id == mut.mut_id
                               select new
            {
                mrd.mrd_ename,
                mrd.mrd_id,
                mut.mut_username,
                name = mut.mut_t_fname + " " + mut.mut_t_lname
            }).ToList();
            var objgroup = objlistLock.GroupBy(x => x).Select(group => new
            {
                mrd_ename   = group.FirstOrDefault().mrd_ename,
                mrd_id      = group.FirstOrDefault().mrd_id,
                countperson = group.Count(),
                username    = group.FirstOrDefault().mut_username,
                name        = group.FirstOrDefault().name
            }).OrderBy(x => x.mrd_ename);

            GridRoomLock.DataSource = objgroup.ToList();
        }