public bool Check_Congviec_Nguoitao(string _ID) { bool _return; CongviecDAL _dal = new CongviecDAL(); return(_return = _dal.Check_Nguoitao_Congviec(Convert.ToDouble(_ID), _user.UserID)); }
private void GetItem(double _id) { T_Congviec _objCongViec = new T_Congviec(); CongviecDAL _CongViecDAL = new CongviecDAL(); _objCongViec = _CongViecDAL.GetOneFromT_CongviecByID(_id); txt_tencongviec.Text = _objCongViec.Tencongviec; this.txt_NoidungCV.Text = _objCongViec.Noidung_Congviec; if (_objCongViec.Phong_ID > 0) { this.cbo_room.SelectedIndex = CommonLib.GetIndexControl(cbo_room, _objCongViec.Phong_ID.ToString()); } BinddDropDownList(double.Parse(cbo_room.SelectedValue)); if (_objCongViec.NguoiNhan > 0) { this.cbo_nguoinhan.SelectedIndex = CommonLib.GetIndexControl(cbo_nguoinhan, _objCongViec.NguoiNhan.ToString()); } this.txt_NgayHT.Text = _objCongViec.NgayHoanthanh.ToString("dd/MM/yyyy"); txt_phanhoi.Text = _objCongViec.Vet; if (_objCongViec.Attachfile != "") { txt_attachfile.Visible = true; txt_attachfile.HRef = System.Configuration.ConfigurationManager.AppSettings["viewimg"].ToString() + _objCongViec.Attachfile; } else { txt_attachfile.Visible = false; } }
public void BindList_CongViec() { string where = " NguoiNhan = " + _user.UserID.ToString(); if (ddl_User.SelectedIndex > 0) { where += " AND ( NguoiTao = " + ddl_User.SelectedValue.ToString() + " OR NguoiGiaoViec = " + ddl_User.SelectedValue.ToString() + ")"; } if (!String.IsNullOrEmpty(txt_NgayTao.Text.Trim())) { where += " AND " + string.Format(" NgayTao >='{0}'", this.txt_NgayTao.Text.Trim() + " 00:00:00"); } if (!String.IsNullOrEmpty(txt_Ngayhoanthanh.Text.Trim())) { where += " AND " + string.Format(" NgayHoanthanh <='{0}'", this.txt_Ngayhoanthanh.Text.Trim() + " 23:59:59"); } CongviecDAL _DAL = new CongviecDAL(); DataSet _ds; pages.PageSize = Global.MembersPerPage; _ds = _DAL.BindGridT_Congviec(pages.PageIndex, pages.PageSize, where); int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _DAL.BindGridT_Congviec(pages.PageIndex - 1, pages.PageSize, where); } if (_ds.Tables[0].Rows.Count > 0) { grdListCVCanLam.DataSource = _ds; grdListCVCanLam.DataBind(); } else { _ds.Tables[0].Rows.Add(_ds.Tables[0].NewRow()); grdListCVCanLam.DataSource = _ds; grdListCVCanLam.DataBind(); int columncount = grdListCVCanLam.Items[0].Cells.Count; grdListCVCanLam.Items[0].Cells.Clear(); grdListCVCanLam.Items[0].Cells.Add(new TableCell()); grdListCVCanLam.Items[0].Cells[0].ColumnSpan = columncount; grdListCVCanLam.Items[0].Cells[0].Text = "Không có bản ghi nào"; } pages.TotalRecords = curentPages.TotalRecords = TotalRecords; curentPages.TotalPages = pages.CalculateTotalPages(); curentPages.PageIndex = pages.PageIndex; Session["CurrentPage"] = pages.PageIndex; }
protected string GetURL(string str, string _ID) { string strReturn = ""; CongviecDAL _dal = new CongviecDAL(); if (str == "1") //da hoan thanh { strReturn = Global.ApplicationPath + "/Dungchung/Images/Icons/OK.gif"; } if (str == "0") //chua duyet { //strReturn = Global.ApplicationPath + "/Dungchung/Images/Warning32.png"; } return(strReturn); }
protected void Save_Click(object sender, EventArgs e) { string Thaotac = string.Empty; this.Page.Validate(vs_Themmoi.ValidationGroup); if (!Page.IsValid) { return; } if (txt_tencongviec.Text.Trim() == "") { FuncAlert.AlertJS(this, "bạn chưa nhập tên công việc"); return; } if (txt_NoidungCV.Text.Trim() == "") { FuncAlert.AlertJS(this, "bạn chưa nhập nội dung công việc"); return; } if (txt_NgayHT.Text.Trim() == "") { FuncAlert.AlertJS(this, "bạn chưa nhập ngày hoàn thành công việc"); return; } CongviecDAL _cvDAL = new CongviecDAL(); T_Congviec _cv = SetItem(); double _return = _cvDAL.InsertT_Congviec(_cv); if (_Filename.Length > 0 && _FileExt.Length > 0) { Uploadfile(_Pathfolder, _Filename, _FileExt); } if (Page.Request.Params["id"] == null) { Thaotac = "[Thêm mới công việc]-->[mã CV:" + _return.ToString() + " ]"; } if (Page.Request.Params["id"] != null) { Thaotac = "[Sửa công việc]-->[Mã CV:" + Page.Request["id"].ToString() + " ]"; } UltilFunc.Log_Action(_user.UserID, _user.UserFullName, DateTime.Now, int.Parse(Request["Menu_ID"]), Thaotac); Page.Response.Redirect("~/Congviec/EditCongviec.aspx?Menu_ID=" + Request["Menu_ID"].ToString() + "&ID=" + _return + "&Tab=1"); }
public void grdListCVCanLam_EditCommand(object source, DataGridCommandEventArgs e) { #region GhiLog Lichsu_Thaotac_HethongDAL actionDAL = new Lichsu_Thaotac_HethongDAL(); T_Lichsu_Thaotac_Hethong action = new T_Lichsu_Thaotac_Hethong(); action.Ma_Nguoidung = _user.UserID; action.TenDaydu = _user.UserFullName; action.HostIP = IpAddress(); action.NgayThaotac = DateTime.Now; #endregion CongviecDAL objDAL = new CongviecDAL(); if (e.CommandArgument.ToString().ToLower() == "edit") { int cvID = Convert.ToInt32(this.grdListCVCanLam.DataKeys[e.Item.ItemIndex].ToString()); Response.Redirect("~/Congviec/EditCongviec.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + cvID); } if (e.CommandArgument.ToString().ToLower() == "delete") { //objDAL.DeleteOneFromT_Congviec(Convert.ToDouble(this.grdList.DataKeys[e.Item.ItemIndex].ToString())); //action.Thaotac = "[Xóa T_Congviec]-->[Thao tác Xóa Trong Bảng T_Congviec][ID:" + this.grdList.DataKeys[e.Item.ItemIndex].ToString() + " ]"; //this.BindList_CongViec(); } if (e.CommandArgument.ToString().ToLower() == "isedit") { int cvID = Convert.ToInt32(this.grdListCVCanLam.DataKeys[e.Item.ItemIndex].ToString()); Label lblStatus = (Label)e.Item.FindControl("lblStatus"); CongviecDAL _dal = new CongviecDAL(); if (lblStatus != null) { if (lblStatus.Text == "1") { _dal.UpdateStatusCongViec(cvID, 0); action.Thaotac = "[Update T_Congviec]-->[Status = 0][ID:" + this.grdListCVCanLam.DataKeys[e.Item.ItemIndex].ToString() + " ]"; } else { _dal.UpdateStatusCongViec(cvID, 1); action.Thaotac = "[Update T_Congviec]-->[Status = 1][ID:" + this.grdListCVCanLam.DataKeys[e.Item.ItemIndex].ToString() + " ]"; } } BindList_CongViec(); } }
//Phần danh sách công việc #region public void BindList_CongViec() { string where = " NguoiNhan = " + _user.UserID.ToString() + " OR NguoiTao = " + _user.UserID.ToString() + " OR NguoiGiaoViec = " + _user.UserID.ToString() + " "; CongviecDAL _DAL = new CongviecDAL(); DataSet _ds; pages.PageSize = 8; _ds = _DAL.BindGridT_Congviec(pages.PageIndex, pages.PageSize, where); int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _DAL.BindGridT_Congviec(pages.PageIndex - 1, pages.PageSize, where); } if (_ds.Tables[0].Rows.Count > 0) { grdList.DataSource = _ds; grdList.DataBind(); } else { _ds.Tables[0].Rows.Add(_ds.Tables[0].NewRow()); grdList.DataSource = _ds; grdList.DataBind(); int columncount = grdList.Items[0].Cells.Count; grdList.Items[0].Cells.Clear(); grdList.Items[0].Cells.Add(new TableCell()); grdList.Items[0].Cells[0].ColumnSpan = columncount; grdList.Items[0].Cells[0].Text = "Không có bản ghi nào"; } pages.TotalRecords = curentPages.TotalRecords = TotalRecords; curentPages.TotalPages = pages.CalculateTotalPages(); curentPages.PageIndex = pages.PageIndex; Session["CurrentPage"] = pages.PageIndex; }
public void grdList_EditCommand(object source, DataGridCommandEventArgs e) { #region GhiLog Lichsu_Thaotac_HethongDAL actionDAL = new Lichsu_Thaotac_HethongDAL(); T_Lichsu_Thaotac_Hethong action = new T_Lichsu_Thaotac_Hethong(); action.Ma_Nguoidung = _user.UserID; action.TenDaydu = _user.UserFullName; action.HostIP = IpAddress(); action.NgayThaotac = DateTime.Now; #endregion CongviecDAL objDAL = new CongviecDAL(); if (e.CommandArgument.ToString().ToLower() == "edit") { int cvID = Convert.ToInt32(this.grdList.DataKeys[e.Item.ItemIndex].ToString()); Response.Redirect("~/Congviec/EditCongviec.aspx?Menu_ID=" + Page.Request["Menu_ID"].ToString() + "&ID=" + cvID); } if (e.CommandArgument.ToString().ToLower() == "delete") { objDAL.DeleteOneFromT_Congviec(Convert.ToDouble(this.grdList.DataKeys[e.Item.ItemIndex].ToString()), _user.UserID); action.Thaotac = "[Xóa T_Congviec]-->[Thao tác Xóa Trong Bảng T_Congviec][ID:" + this.grdList.DataKeys[e.Item.ItemIndex].ToString() + " ]"; this.BindList_CongViec(); } }
public void BindListGiaoViec() { string where = _GetWhereGiaoViec(); CongviecDAL _DAL = new CongviecDAL(); DataSet _ds; pages.PageSize = Global.MembersPerPage; _ds = _DAL.BindGridT_Congviec(pages.PageIndex, pages.PageSize, where); int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _DAL.BindGridT_Congviec(pages.PageIndex - 1, pages.PageSize, where); } if (_ds.Tables[0].Rows.Count > 0) { grdListTheodoi.DataSource = _ds; grdListTheodoi.DataBind(); } else { _ds.Tables[0].Rows.Add(_ds.Tables[0].NewRow()); grdListTheodoi.DataSource = _ds; grdListTheodoi.DataBind(); int columncount = grdListTheodoi.Items[0].Cells.Count; grdListTheodoi.Items[0].Cells.Clear(); grdListTheodoi.Items[0].Cells.Add(new TableCell()); grdListTheodoi.Items[0].Cells[0].ColumnSpan = columncount; grdListTheodoi.Items[0].Cells[0].Text = "Không có bản ghi nào"; } pages.TotalRecords = curentPages.TotalRecords = TotalRecords; curentPages.TotalPages = pages.CalculateTotalPages(); curentPages.PageIndex = pages.PageIndex; Session["CurrentPage"] = pages.PageIndex; }
protected void Save_Click() { int Menu_ID = 0; string NoiDung = string.Empty; string SoTu = string.Empty; string NgayHT = string.Empty; string NguoiNhan = string.Empty; string tieudecv = string.Empty; string ip = string.Empty; try { System.Globalization.CultureInfo mProvider = new System.Globalization.CultureInfo("en-US", false); if (mContext.Request.QueryString["mn_id"] != "undefined") { Menu_ID = int.Parse(mContext.Request.QueryString["mn_id"], mProvider); } if (mContext.Request.QueryString["nguoinhan"] != "undefined") { NguoiNhan = mContext.Request.QueryString["nguoinhan"].ToString(); } if (mContext.Request.QueryString["tieudecv"] != "undefined") { tieudecv = mContext.Request.QueryString["tieudecv"].ToString(); } if (mContext.Request.QueryString["noidung"] != "undefined") { NoiDung = mContext.Request.QueryString["noidung"].ToString(); } if (mContext.Request.QueryString["sotu"] != "undefined") { SoTu = mContext.Request.QueryString["sotu"].ToString(); } if (mContext.Request.QueryString["ngayht"] != "undefined") { NgayHT = mContext.Request.QueryString["ngayht"].ToString(); } if (mContext.Request.QueryString["ip"] != "undefined") { ip = mContext.Request.QueryString["ip"].ToString(); } HPCBusinessLogic.NguoidungDAL _NguoidungDAL = new NguoidungDAL(); T_Users _user; T_RolePermission _Role = null; _user = _NguoidungDAL.GetUserByUserName(HPCSecurity.CurrentUser.Identity.Name); _Role = _NguoidungDAL.GetRole4UserMenu(_user.UserID, Menu_ID); #region GhiLog Lichsu_Thaotac_HethongDAL actionDAL = new Lichsu_Thaotac_HethongDAL(); T_Lichsu_Thaotac_Hethong action = new T_Lichsu_Thaotac_Hethong(); action.Ma_Nguoidung = _user.UserID; action.TenDaydu = _user.UserFullName; action.HostIP = ip; action.NgayThaotac = DateTime.Now; #endregion CongviecDAL _cvDAL = new CongviecDAL(); T_Congviec _cv = SetItem(NoiDung, SoTu, NgayHT, NguoiNhan, tieudecv); double _return = _cvDAL.InsertT_Congviec(_cv); action.Thaotac = "[Thêm mới công việc]-->[mã công việc:" + _return.ToString() + " ]"; actionDAL.InserT_Lichsu_Thaotac_Hethong(action); mContext.Response.Write("1"); } catch { mContext.Response.Write("0"); } }