예제 #1
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckInput())
         {
             if (function.Equals("add"))
             {
                 objSuCo           = new SuCoPhong();
                 objSuCo.ten       = txtTen.Text;
                 objSuCo.phong     = objPhong;
                 objSuCo.tinhtrang = lookUpEditTinhTrang.GetSelectedDataRow() as TinhTrang;
                 objSuCo.mota      = txtMota.Text;
                 //objSuCo.phisuachua = spinPhiSuaChua != null ? long.Parse(spinPhiSuaChua.EditValue.ToString()) : 0;
                 objSuCo.hinhanhs = listHinhs;
                 objSuCo.ngay     = dateEdit1.EditValue != null ? dateEdit1.DateTime : DateTime.Now;
                 if (objSuCo.add() > 0 && DBInstance.commit() > 0)
                 {
                     DevExpress.XtraEditors.XtraMessageBox.Show("Thêm sự cố thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     Guid id = objSuCo.id;
                     reLoadAndFocused(id);
                 }
                 else
                 {
                     DevExpress.XtraEditors.XtraMessageBox.Show("Thêm sự cố không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else if (function.Equals("edit"))
             {
                 if (checkworking())
                 {
                     objSuCo.ten       = txtTen.Text;
                     objSuCo.tinhtrang = lookUpEditTinhTrang.GetSelectedDataRow() as TinhTrang;
                     objSuCo.mota      = txtMota.Text;
                     //objSuCo.phisuachua = spinPhiSuaChua != null ? long.Parse(spinPhiSuaChua.EditValue.ToString()) : 0;
                     objSuCo.hinhanhs = listHinhs;
                     objSuCo.ngay     = dateEdit1.EditValue != null ? dateEdit1.DateTime : DateTime.Now;
                     if (objSuCo.update() > 0 && DBInstance.commit() > 0)
                     {
                         DevExpress.XtraEditors.XtraMessageBox.Show("Sửa sự cố thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         Guid id = objSuCo.id;
                         reLoadAndFocused(id);
                     }
                     else
                     {
                         DevExpress.XtraEditors.XtraMessageBox.Show("Sửa sự cố không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
                 else
                 {
                     DevExpress.XtraEditors.XtraMessageBox.Show("Không thể cập nhật nếu không có thay đổi!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(this.Name + "->btnOK_Click: " + ex.Message);
     }
 }
예제 #2
0
 private void SearchFunction()
 {
     if (Request.QueryString["Search"] != null)
     {
         Guid SearchID = Guid.Empty;
         try
         {
             SearchID     = GUID.From(Request.QueryString["Search"]);
             objSuCoPhong = PTB.Entities.SuCoPhong.getById(SearchID);
         }
         catch
         {
             Response.Redirect(Request.Url.AbsolutePath);
         }
         PTB.Entities.Phong PhongSearch = objSuCoPhong.phong;
         if (PhongSearch != null)
         {
             Guid nodeGuid = PhongSearch.id;
             DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.GetAllNodes().Where(item => Object.Equals(item.GetValue("id").ToString(), nodeGuid.ToString())).FirstOrDefault();
             if (node != null)
             {
                 int Page = SearchPage(nodeGuid, SearchID);
                 if (Page != -1)
                 {
                     Session["ShowInfo"] = "1";
                     Response.Redirect(string.Format("{0}?key={1}&id={2}&Page={3}", Request.Url.AbsolutePath, node.Key.ToString(), SearchID.ToString(), Page.ToString()));
                 }
                 else
                 {
                     Response.Redirect(Request.Url.AbsolutePath);
                 }
             }
             else
             {
                 Response.Redirect(Request.Url.AbsolutePath);
             }
         }
         else
         {
             Response.Redirect(Request.Url.AbsolutePath);
         }
     }
     else
     {
         return;
     }
 }
예제 #3
0
 public void LoadData()
 {
     listViTriHienThi = ViTriHienThi.getAllHavePhong();
     if (listViTriHienThi.Count > 0)
     {
         if (listViTriHienThi.Where(item => Object.Equals(item.loai, typeof(PTB.Entities.Phong).Name)).FirstOrDefault() != null)
         {
             Panel_Chinh.Visible = true;
             _ucTreeViTri.CreateTreeList();
             _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listViTriHienThi;
             _ucTreeViTri.ASPxTreeList_ViTri.DataBind();
             SearchFunction();
             if (Convert.ToString(Page.Session["ShowInfo"]) == "1")
             {
                 PanelChangePage.Visible = false;
                 Session["ShowInfo"]     = null;
             }
             else
             {
                 _ucCollectionPager_DanhSachSuCo.ShowPanelPage(PanelChangePage);
             }
             if (Request.QueryString["key"] != null)
             {
                 string key = "";
                 try
                 {
                     key = Request.QueryString["key"].ToString();
                 }
                 catch
                 {
                     Response.Redirect(Request.Url.AbsolutePath);
                 }
                 DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key);
                 if (node != null)
                 {
                     _ucTreeViTri.FocusAndExpandToNode(node);
                     objPhong = PTB.Entities.Phong.getById(GUID.From(node.GetValue("id")));
                     if (objPhong != null)
                     {
                         LoadDataObjPhong();
                         if (Request.QueryString["id"] != null)
                         {
                             idSuCo = Guid.Empty;
                             try
                             {
                                 idSuCo = GUID.From(Request.QueryString["id"]);
                             }
                             catch
                             {
                                 Response.Redirect(Request.Url.AbsolutePath);
                             }
                             objSuCoPhong = PTB.Entities.SuCoPhong.getById(idSuCo);
                             if (objSuCoPhong != null)
                             {
                                 Panel_SuCo.Visible      = true;
                                 Label_SuCo.Visible      = false;
                                 Label_SuCo.Text         = "";
                                 Label_ThongTinSuCo.Text = "Thông tin " + objSuCoPhong.ten;
                                 Libraries.ImageHelper.LoadImageWeb(objSuCoPhong.hinhanhs.ToList(), _ucASPxImageSlider_Web.ASPxImageSlider_Object);
                                 _ucASPxImageSlider_Web.urlHinhAnh = string.Format("http://{0}/HinhAnh.aspx?id={1}&type=SUCOPHONG", HttpContext.Current.Request.Url.Authority, objSuCoPhong.id);
                                 Session["TenSuCo"]          = Label_TenSuCo.Text = objSuCoPhong.ten;
                                 Label_TinhTrang.Text        = objSuCoPhong.tinhtrang != null ? objSuCoPhong.tinhtrang.value : "[Tình trạng]";
                                 Label_NgayTao.Text          = ((DateTime)objSuCoPhong.date_create).ToString();
                                 Label_MoTa.Text             = Libraries.StringHelper.ConvertRNToBR(objSuCoPhong.mota);
                                 Button_XemLog.OnClientClick = string.Format("OnMoreInfoClick('{0}'); return false;", Libraries.StringHelper.AddParameter(new Uri("http://" + Request.Url.Authority + "/" + ResolveClientUrl("~/LogSuCo.aspx")), "id", idSuCo.ToString()));
                             }
                             else
                             {
                                 Response.Redirect(Request.Url.AbsolutePath);
                             }
                         }
                         else
                         {
                             Panel_SuCo.Visible = false;
                             Label_SuCo.Visible = true;
                             Label_SuCo.Text    = "Chưa chọn sự cố";
                         }
                     }
                     else
                     {
                         Response.Redirect(Request.Url.AbsolutePath);
                     }
                 }
                 else
                 {
                     Response.Redirect(Request.Url.AbsolutePath);
                 }
             }
             else
             {
                 DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue("");
                 node.Focus();
                 Label_DanhSachSuCo.Text = "Chưa chọn phòng";
                 ClearData();
             }
         }
         else
         {
             ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
             ucThongBaoLoi.Label_ThongBaoLoi.Text    = "Chưa có phòng";
         }
     }
     else
     {
         ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
         ucThongBaoLoi.Label_ThongBaoLoi.Text    = "Chưa có sự cố";
     }
 }
예제 #4
0
 private void setDataView(bool isLog = false, DevExpress.XtraGrid.Views.Grid.GridView view = null)
 {
     try
     {
         //errorProvider1.Clear();
         clearText();
         if (gridViewSuCo.RowCount > 0)
         {
             if (gridViewSuCo.FocusedRowHandle > -1 && gridViewSuCo.GetFocusedRow() != null)
             {
                 objSuCo = gridViewSuCo.GetFocusedRow() as SuCoPhong;
                 txtTen.Text = objSuCo.ten;
                 lblPhong.Text = objSuCo.phong.ten;
                 dateEdit1.EditValue = objSuCo.ngay;
                 //spinPhiSuaChua.EditValue = objSuCo.phisuachua;
                 if (!isLog)
                 {
                     lookUpEditTinhTrang.EditValue = objSuCo.tinhtrang_id;
                     txtMota.Text = objSuCo.mota;
                     if (objSuCo.hinhanhs.Count > 0)
                     {
                         listHinhs = objSuCo.hinhanhs.ToList();
                         reloadImage();
                     }
                 }
                 else if (isLog && view.FocusedRowHandle > -1 && view.GetFocusedRow() != null)
                 {
                     LogSuCoPhong obj = view.GetFocusedRow() as LogSuCoPhong;
                     //dateEdit1.EditValue = obj.ngay;
                     lblNhanVien.Text = obj.quantrivien != null ? obj.quantrivien.hoten : "";
                     lookUpEditTinhTrang.EditValue = obj.tinhtrang_id;
                     txtMota.Text = obj.mota;
                     dateEdit1.EditValue = obj.date_create;
                     //spinPhiSuaChua.EditValue = obj.phisuachua;
                     if (obj.hinhanhs.Count > 0)
                     {
                         listHinhs = obj.hinhanhs.ToList();
                         reloadImage();
                     }
                 }
             }
             else
             {
                 objSuCo = new SuCoPhong();
             }
         }
         else
         {
             enableButton(false);
             objSuCo = new SuCoPhong();
         }
         if (isLog)
         {
             //if (!function.Equals("onlyview"))
             editGUI("onlyview");
         }
         else
         {
             //if (!function.Equals("view"))
             editGUI("view");
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(this.Name + "->setDataView: " + ex.Message);
     }
 }
예제 #5
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckInput())
         {
             if (function.Equals("add"))
             {
                 objSuCo = new SuCoPhong();
                 objSuCo.ten = txtTen.Text;
                 objSuCo.phong = objPhong;
                 objSuCo.tinhtrang = lookUpEditTinhTrang.GetSelectedDataRow() as TinhTrang;
                 objSuCo.mota = txtMota.Text;
                 //objSuCo.phisuachua = spinPhiSuaChua != null ? long.Parse(spinPhiSuaChua.EditValue.ToString()) : 0;
                 objSuCo.hinhanhs = listHinhs;
                 objSuCo.ngay = dateEdit1.EditValue != null ? dateEdit1.DateTime : DateTime.Now;
                 if (objSuCo.add() > 0 && DBInstance.commit() > 0)
                 {
                     DevExpress.XtraEditors.XtraMessageBox.Show("Thêm sự cố thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     Guid id = objSuCo.id;
                     reLoadAndFocused(id);
                 }
                 else
                 {
                     DevExpress.XtraEditors.XtraMessageBox.Show("Thêm sự cố không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else if (function.Equals("edit"))
             {
                 if (checkworking())
                 {
                     objSuCo.ten = txtTen.Text;
                     objSuCo.tinhtrang = lookUpEditTinhTrang.GetSelectedDataRow() as TinhTrang;
                     objSuCo.mota = txtMota.Text;
                     //objSuCo.phisuachua = spinPhiSuaChua != null ? long.Parse(spinPhiSuaChua.EditValue.ToString()) : 0;
                     objSuCo.hinhanhs = listHinhs;
                     objSuCo.ngay = dateEdit1.EditValue != null ? dateEdit1.DateTime : DateTime.Now;
                     if (objSuCo.update() > 0 && DBInstance.commit() > 0)
                     {
                         DevExpress.XtraEditors.XtraMessageBox.Show("Sửa sự cố thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         Guid id = objSuCo.id;
                         reLoadAndFocused(id);
                     }
                     else
                     {
                         DevExpress.XtraEditors.XtraMessageBox.Show("Sửa sự cố không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
                 }
                 else
                 {
                     DevExpress.XtraEditors.XtraMessageBox.Show("Không thể cập nhật nếu không có thay đổi!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(this.Name + "->btnOK_Click: " + ex.Message);
     }
 }
예제 #6
0
        public void LoadData()
        {
            listViTriHienThi = ViTriHienThi.getAllHavePhong();
            if (listViTriHienThi.Count > 0)
            {
                if (listViTriHienThi.Where(item => Object.Equals(item.loai, typeof(PTB.Entities.Phong).Name)).FirstOrDefault() != null)
                {
                    Panel_Chinh.Visible = true;
                    _ucTreeViTri.CreateTreeList();
                    _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listViTriHienThi;
                    _ucTreeViTri.ASPxTreeList_ViTri.DataBind();
                    SearchFunction();
                    if (Convert.ToString(Page.Session["ShowInfo"]) == "1")
                    {
                        PanelChangePage.Visible = false;
                        Session["ShowInfo"] = null;
                    }
                    else
                    {
                        _ucCollectionPager_DanhSachSuCo.ShowPanelPage(PanelChangePage);
                    }
                    if (Request.QueryString["key"] != null)
                    {
                        string key = "";
                        try
                        {
                            key = Request.QueryString["key"].ToString();
                        }
                        catch
                        {
                            Response.Redirect(Request.Url.AbsolutePath);
                        }
                        DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key);
                        if (node != null)
                        {
                            _ucTreeViTri.FocusAndExpandToNode(node);
                            objPhong = PTB.Entities.Phong.getById(GUID.From(node.GetValue("id")));
                            if (objPhong != null)
                            {
                                LoadDataObjPhong();
                                if (Request.QueryString["id"] != null)
                                {
                                    idSuCo = Guid.Empty;
                                    try
                                    {
                                        idSuCo = GUID.From(Request.QueryString["id"]);
                                    }
                                    catch
                                    {
                                        Response.Redirect(Request.Url.AbsolutePath);
                                    }
                                    objSuCoPhong = PTB.Entities.SuCoPhong.getById(idSuCo);
                                    if (objSuCoPhong != null)
                                    {
                                        Panel_SuCo.Visible = true;
                                        Label_SuCo.Visible = false;
                                        Label_SuCo.Text = "";
                                        Label_ThongTinSuCo.Text = "Thông tin " + objSuCoPhong.ten;
                                        Libraries.ImageHelper.LoadImageWeb(objSuCoPhong.hinhanhs.ToList(), _ucASPxImageSlider_Web.ASPxImageSlider_Object);
                                        _ucASPxImageSlider_Web.urlHinhAnh = string.Format("http://{0}/HinhAnh.aspx?id={1}&type=SUCOPHONG", HttpContext.Current.Request.Url.Authority, objSuCoPhong.id);
                                        Session["TenSuCo"] = Label_TenSuCo.Text = objSuCoPhong.ten;
                                        Label_TinhTrang.Text = objSuCoPhong.tinhtrang != null ? objSuCoPhong.tinhtrang.value : "[Tình trạng]";
                                        Label_NgayTao.Text = ((DateTime)objSuCoPhong.date_create).ToString();
                                        Label_MoTa.Text = Libraries.StringHelper.ConvertRNToBR(objSuCoPhong.mota);
                                        Button_XemLog.OnClientClick = string.Format("OnMoreInfoClick('{0}'); return false;", Libraries.StringHelper.AddParameter(new Uri("http://" + Request.Url.Authority + "/" + ResolveClientUrl("~/LogSuCo.aspx")), "id", idSuCo.ToString()));
                                    }
                                    else
                                    {
                                        Response.Redirect(Request.Url.AbsolutePath);
                                    }
                                }
                                else
                                {
                                    Panel_SuCo.Visible = false;
                                    Label_SuCo.Visible = true;
                                    Label_SuCo.Text = "Chưa chọn sự cố";
                                }
                            }
                            else
                            {
                                Response.Redirect(Request.Url.AbsolutePath);
                            }
                        }
                        else
                            Response.Redirect(Request.Url.AbsolutePath);
                    }
                    else
                    {
                        DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue("");
                        node.Focus();
                        Label_DanhSachSuCo.Text = "Chưa chọn phòng";
                        ClearData();
                    }
                }
                else
                {

                    ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
                    ucThongBaoLoi.Label_ThongBaoLoi.Text = "Chưa có phòng";
                }
            }
            else
            {
                ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
                ucThongBaoLoi.Label_ThongBaoLoi.Text = "Chưa có sự cố";
            }
        }
예제 #7
0
 private void SearchFunction()
 {
     if (Request.QueryString["Search"] != null)
     {
         Guid SearchID = Guid.Empty;
         try
         {
             SearchID = GUID.From(Request.QueryString["Search"]);
             objSuCoPhong = PTB.Entities.SuCoPhong.getById(SearchID);
         }
         catch
         {
             Response.Redirect(Request.Url.AbsolutePath);
         }
         PTB.Entities.Phong PhongSearch = objSuCoPhong.phong;
         if (PhongSearch != null)
         {
             Guid nodeGuid = PhongSearch.id;
             DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.GetAllNodes().Where(item => Object.Equals(item.GetValue("id").ToString(), nodeGuid.ToString())).FirstOrDefault();
             if (node != null)
             {
                 int Page = SearchPage(nodeGuid, SearchID);
                 if (Page != -1)
                 {
                     Session["ShowInfo"] = "1";
                     Response.Redirect(string.Format("{0}?key={1}&id={2}&Page={3}", Request.Url.AbsolutePath, node.Key.ToString(), SearchID.ToString(), Page.ToString()));
                 }
                 else
                 {
                     Response.Redirect(Request.Url.AbsolutePath);
                 }
             }
             else
             {
                 Response.Redirect(Request.Url.AbsolutePath);
             }
         }
         else
             Response.Redirect(Request.Url.AbsolutePath);
     }
     else
     {
         return;
     }
 }
 public void LoadData()
 {
     listViTriHienThi = ViTriHienThi.getAllHavePhong();
     if (listViTriHienThi.Count > 0)
     {
         if (listViTriHienThi.Where(item => Object.Equals(item.loai, typeof(PTB.Entities.Phong).Name)).FirstOrDefault() != null)
         {
             _ucTreeViTri.CreateTreeList();
             _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listViTriHienThi;
             _ucTreeViTri.ASPxTreeList_ViTri.DataBind();
             if (Request.QueryString["key"] != null)
             {
                 key = "";
                 try
                 {
                     key = Request.QueryString["key"].ToString();
                 }
                 catch
                 {
                     Response.Redirect(Request.Url.AbsolutePath);
                 }
                 DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key);
                 if (node != null)
                 {
                     node.Focus();
                     objPhong = PTB.Entities.Phong.getById(GUID.From(node.GetValue("id")));
                     if (objPhong != null)
                     {
                         if (Request.QueryString["id"] != null)
                         {
                             idSuCo = Guid.Empty;
                             try
                             {
                                 idSuCo = GUID.From(Request.QueryString["id"]);
                             }
                             catch
                             {
                                 Response.Redirect(Request.Url.AbsolutePath);
                             }
                             objSuCoPhong = PTB.Entities.SuCoPhong.getById(idSuCo);
                             if (objSuCoPhong != null)
                             {
                                 Panel_SuCo.Visible = true;
                                 Label_ThongTinSuCo.Text = "Thông tin " + objSuCoPhong.ten;
                                 Libraries.ImageHelper.LoadImageWeb(objSuCoPhong.hinhanhs.ToList(), _ucASPxImageSlider_Mobile.ASPxImageSlider_Object);
                                 Session["TenSuCo"] = Label_TenSuCo.Text = objSuCoPhong.ten;
                                 Label_TinhTrang.Text = objSuCoPhong.tinhtrang != null ? objSuCoPhong.tinhtrang.value : "[Tình trạng]";
                                 Label_NgayTao.Text = ((DateTime)objSuCoPhong.date_create).ToString();
                                 Label_MoTa.Text = Libraries.StringHelper.ConvertRNToBR(objSuCoPhong.mota);
                                 Button_XemLog.OnClientClick = string.Format("location.href='{0}'; return false;", Libraries.StringHelper.AddParameter(new Uri("http://" + Request.Url.Authority + "/" + ResolveClientUrl("~/LogSuCo.aspx")), "id", idSuCo.ToString()));
                             }
                             else
                             {
                                 Response.Redirect(Request.Url.AbsolutePath);
                             }
                         }
                         else
                         {
                             LoadDataObjPhong();
                             Panel_DanhSachSuCo.Visible = true;
                         }
                     }
                     else
                     {
                         Response.Redirect(Request.Url.AbsolutePath);
                     }
                 }
                 else
                 {
                     Response.Redirect(Request.Url.AbsolutePath);
                 }
             }
             else
             {
                 Panel_TreeViTri.Visible = true;
             }
         }
         else
         {
             ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
             ucThongBaoLoi.Label_ThongBaoLoi.Text = "Chưa có phòng";
         }
     }
     else
     {
         ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
         ucThongBaoLoi.Label_ThongBaoLoi.Text = "Chưa có vị trí";
     }
 }
예제 #9
0
 public void LoadData()
 {
     listViTriHienThi = ViTriHienThi.getAllHavePhong();
     if (listViTriHienThi.Count > 0)
     {
         if (listViTriHienThi.Where(item => Object.Equals(item.loai, typeof(PTB.Entities.Phong).Name)).FirstOrDefault() != null)
         {
             _ucTreeViTri.CreateTreeList();
             _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listViTriHienThi;
             _ucTreeViTri.ASPxTreeList_ViTri.DataBind();
             if (Request.QueryString["key"] != null)
             {
                 key = "";
                 try
                 {
                     key = Request.QueryString["key"].ToString();
                 }
                 catch
                 {
                     Response.Redirect(Request.Url.AbsolutePath);
                 }
                 DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key);
                 if (node != null)
                 {
                     node.Focus();
                     objPhong = PTB.Entities.Phong.getById(GUID.From(node.GetValue("id")));
                     if (objPhong != null)
                     {
                         if (Request.QueryString["id"] != null)
                         {
                             idSuCo = Guid.Empty;
                             try
                             {
                                 idSuCo = GUID.From(Request.QueryString["id"]);
                             }
                             catch
                             {
                                 Response.Redirect(Request.Url.AbsolutePath);
                             }
                             objSuCoPhong = PTB.Entities.SuCoPhong.getById(idSuCo);
                             if (objSuCoPhong != null)
                             {
                                 Panel_SuCo.Visible      = true;
                                 Label_ThongTinSuCo.Text = "Thông tin " + objSuCoPhong.ten;
                                 Libraries.ImageHelper.LoadImageWeb(objSuCoPhong.hinhanhs.ToList(), _ucASPxImageSlider_Mobile.ASPxImageSlider_Object);
                                 Session["TenSuCo"]          = Label_TenSuCo.Text = objSuCoPhong.ten;
                                 Label_TinhTrang.Text        = objSuCoPhong.tinhtrang != null ? objSuCoPhong.tinhtrang.value : "[Tình trạng]";
                                 Label_NgayTao.Text          = ((DateTime)objSuCoPhong.date_create).ToString();
                                 Label_MoTa.Text             = Libraries.StringHelper.ConvertRNToBR(objSuCoPhong.mota);
                                 Button_XemLog.OnClientClick = string.Format("location.href='{0}'; return false;", Libraries.StringHelper.AddParameter(new Uri("http://" + Request.Url.Authority + "/" + ResolveClientUrl("~/LogSuCo.aspx")), "id", idSuCo.ToString()));
                             }
                             else
                             {
                                 Response.Redirect(Request.Url.AbsolutePath);
                             }
                         }
                         else
                         {
                             LoadDataObjPhong();
                             Panel_DanhSachSuCo.Visible = true;
                         }
                     }
                     else
                     {
                         Response.Redirect(Request.Url.AbsolutePath);
                     }
                 }
                 else
                 {
                     Response.Redirect(Request.Url.AbsolutePath);
                 }
             }
             else
             {
                 Panel_TreeViTri.Visible = true;
             }
         }
         else
         {
             ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
             ucThongBaoLoi.Label_ThongBaoLoi.Text    = "Chưa có phòng";
         }
     }
     else
     {
         ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
         ucThongBaoLoi.Label_ThongBaoLoi.Text    = "Chưa có vị trí";
     }
 }
예제 #10
0
        private void gridViewSuCo_MasterRowGetChildList(object sender, DevExpress.XtraGrid.Views.Grid.MasterRowGetChildListEventArgs e)
        {
            SuCoPhong c = (SuCoPhong)gridViewSuCo.GetRow(e.RowHandle);

            e.ChildList = c.logsucophongs.OrderByDescending(p => p.date_create).ToList();
        }
예제 #11
0
        private void gridViewSuCo_MasterRowEmpty(object sender, DevExpress.XtraGrid.Views.Grid.MasterRowEmptyEventArgs e)
        {
            SuCoPhong c = (SuCoPhong)gridViewSuCo.GetRow(e.RowHandle);

            e.IsEmpty = c.logsucophongs.Count == 0;
        }
예제 #12
0
 private void setDataView(bool isLog = false, DevExpress.XtraGrid.Views.Grid.GridView view = null)
 {
     try
     {
         //errorProvider1.Clear();
         clearText();
         if (gridViewSuCo.RowCount > 0)
         {
             if (gridViewSuCo.FocusedRowHandle > -1 && gridViewSuCo.GetFocusedRow() != null)
             {
                 objSuCo             = gridViewSuCo.GetFocusedRow() as SuCoPhong;
                 txtTen.Text         = objSuCo.ten;
                 lblPhong.Text       = objSuCo.phong.ten;
                 dateEdit1.EditValue = objSuCo.ngay;
                 //spinPhiSuaChua.EditValue = objSuCo.phisuachua;
                 if (!isLog)
                 {
                     lookUpEditTinhTrang.EditValue = objSuCo.tinhtrang_id;
                     txtMota.Text = objSuCo.mota;
                     if (objSuCo.hinhanhs.Count > 0)
                     {
                         listHinhs = objSuCo.hinhanhs.ToList();
                         reloadImage();
                     }
                 }
                 else if (isLog && view.FocusedRowHandle > -1 && view.GetFocusedRow() != null)
                 {
                     LogSuCoPhong obj = view.GetFocusedRow() as LogSuCoPhong;
                     //dateEdit1.EditValue = obj.ngay;
                     lblNhanVien.Text = obj.quantrivien != null ? obj.quantrivien.hoten : "";
                     lookUpEditTinhTrang.EditValue = obj.tinhtrang_id;
                     txtMota.Text        = obj.mota;
                     dateEdit1.EditValue = obj.date_create;
                     //spinPhiSuaChua.EditValue = obj.phisuachua;
                     if (obj.hinhanhs.Count > 0)
                     {
                         listHinhs = obj.hinhanhs.ToList();
                         reloadImage();
                     }
                 }
             }
             else
             {
                 objSuCo = new SuCoPhong();
             }
         }
         else
         {
             enableButton(false);
             objSuCo = new SuCoPhong();
         }
         if (isLog)
         {
             //if (!function.Equals("onlyview"))
             editGUI("onlyview");
         }
         else
         {
             //if (!function.Equals("view"))
             editGUI("view");
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(this.Name + "->setDataView: " + ex.Message);
     }
 }