protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { FormsAuthentication.SignOut(); Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); Tunnel.Common.GetValue.OffLine(ul.LoginID); ul.RemoveCache(ul.LoginID); // Cache.Remove(".TunnelLogin-CacheKey-" + ul.LoginID); //#region 为了看到脚本调用的时候改文件已经被执行 测试用; //string tempFilePaht = @"d:\test1.txt"; //if (!System.IO.File.Exists(tempFilePaht)) //{ // System.IO.FileStream f = System.IO.File.Create(tempFilePaht); // f.Close(); // f.Dispose(); //} //System.IO.StreamWriter f2 = new System.IO.StreamWriter(tempFilePaht, true, System.Text.Encoding.GetEncoding("gb2312")); //string Strings = "|" + ul.LoginID + "|"; //f2.WriteLine(Strings); //f2.Close(); //#endregion Thread.Sleep(5000); Response.Write("<script>window.close();</script>"); } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); ul.RemoveCache(ul.LoginID); Response.Write("<script>window.parent.location.href='Default.aspx'</script>"); Response.End(); }
void ShowInit() { if (!string.IsNullOrEmpty(Request.Params["File_Id"])) { try { Tunnel.BLL.Tunnel_bumf btb = new Tunnel.BLL.Tunnel_bumf(); Tunnel.Model.Tunnel_bumf mtb = new Tunnel.Model.Tunnel_bumf(); Tunnel.BLL.Tunnel_form tf = new Tunnel.BLL.Tunnel_form(); Tunnel.Model.Tunnel_form mtf = new Tunnel.Model.Tunnel_form(); Tunnel.Common.Form_Class fc = new Tunnel.Common.Form_Class(); Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); mtb = btb.GetModel(Convert.ToInt32(Request.Params["File_Id"])); formfile = getFile(mtb.b_file);//附件 Label1.Text = mtb.b_title; Label2.Text = fc.From_Content(mtb.b_formcontent, mtb.b_content, true);//取得替换后的表单数据 ul.UsbnLogin = ul.getUserModel(mtb.b_user); Label3.Text = "发布人:" + ul.UsbnLogin.m_name + " 发布时间:" + mtb.b_time.ToString(); } catch { Tunnel.Common.Message.back("不正确的ID"); return; } } }
protected void Button1_Click(object sender, EventArgs e) { try { string user = username.Value.Trim(); string pass = password.Value.Trim(); int userId = 0; Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); ul.UserLoginCheck(user, Tunnel.Data.DESEncrypt.Encrypt(pass), Tunnel.Common.Common.GetIp(), ref userId); if (userId > 0) { Tunnel.BLL.Tunnel_menber tm = new Tunnel.BLL.Tunnel_menber(); Tunnel.Common.GetValue.OnLine(userId); Response.Redirect("Index.aspx"); } else { Response.Write("<script>alert('账号或密码错误!');location.href='default.aspx';</script>"); Response.End(); } } catch (Exception ex) { throw ex; } }
protected void btnSave_Click(object sender, EventArgs e) { Tunnel.BLL.Tunnel_Profile pf = new Tunnel.BLL.Tunnel_Profile(); Tunnel.Model.Tunnel_Profile pff = new Tunnel.Model.Tunnel_Profile(); Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); if (pf.GetModelList("p_bum='" + DropDownList2.SelectedValue + "' and p_filetype='" + DropDownList3.SelectedValue + "' and p_name='" + TextBox1.Text + "' and p_year='" + DropDownList1.SelectedValue + "'").Count > 0) { Tunnel.Common.Message.Show("此文件已经存在,请重新命名!"); } else { pff.p_bum = DropDownList2.SelectedValue; pff.p_filetype = DropDownList3.SelectedValue; pff.p_name = TextBox1.Text; pff.p_uid = Convert.ToInt32(ul.LoginID); pff.p_year = Convert.ToInt32(DropDownList1.SelectedValue); if (pf.Add(pff) > 0) { Tunnel.Common.Message.Show("提交成功!"); string strsql = ""; strsql = "insert into tunnel_log(l_user,l_time,l_content,l_ip,l_sort) values(" + ul.LoginID + ",'" + DateTime.Now + "','公司事务>>档案管理>>新增档案。标题:" + pff.p_name + "','" + Tunnel.Common.Common.GetIp() + "',1)"; Tunnel.Data.DbHelperSQL.ExecuteSql(strsql); } } }
protected void Button1_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(TextBox1.Text.Trim())) { if (Tunnel.Common.RegexComm.IsValidTime(text1.Value, 1)) { Tunnel.BLL.Tunnel_workplan tw = new Tunnel.BLL.Tunnel_workplan(); Tunnel.Model.Tunnel_workplan tww = new Tunnel.Model.Tunnel_workplan(); Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); tww.w_user = ul.LoginID; tww.w_title = TextBox1.Text; tww.w_starttime = Convert.ToDateTime(text1.Value); switch (DropDownList1.SelectedValue) { case "0": tww.w_endtime = Convert.ToDateTime("1800-01-01"); break; case "1": tww.w_endtime = tww.w_starttime.AddMinutes(-10); break; case "2": tww.w_endtime = tww.w_starttime.AddMinutes(-30); break; case "3": tww.w_endtime = tww.w_starttime.AddMinutes(-60); break; case "4": tww.w_endtime = tww.w_starttime.Date; break; case "5": tww.w_endtime = tww.w_starttime; break; default: break; } tww.w_content = TextBox2.Text; int id = tw.Add(tww); //添加消息机制 call(tww.w_title, id.ToString(), tww.w_endtime); // Tunnel.Common.Message.Show("添加成功!"); } else { Tunnel.Common.Message.Show("日期格式不正确!"); } } else { Tunnel.Common.Message.Show("请填写标题!"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { id = Convert.ToInt32(Request.QueryString["id"].ToString()); Tunnel.BLL.Tunnel_Vote t = new Tunnel.BLL.Tunnel_Vote(); Tunnel.Model.Tunnel_Vote tt = new Tunnel.Model.Tunnel_Vote(); Tunnel.BLL.Tunnel_menber tm = new Tunnel.BLL.Tunnel_menber(); tt = t.GetModel(id); voteTitle = tt.vote_Title; voteUserName = tm.GetModel(Convert.ToInt32(tt.vote_userId)).m_name; voteDate = Convert.ToDateTime(tt.vote_startDate).ToShortDateString(); voteMark = tt.vote_mark; voteMax = tt.vote_max.ToString(); voteType = tt.vote_Type.ToString(); max.Value = voteMax; tvList = tv.GetModelList("ivote_voteId=" + id + ""); Repeater1.DataSource = tvList; Repeater1.DataBind(); if (voteType == "0") { foreach (RepeaterItem item in Repeater1.Items) { ((CheckBox)item.FindControl("CheckBox1")).Visible = false; } } else { foreach (RepeaterItem item in Repeater1.Items) { ((RadioButton)item.FindControl("RadioButton1")).Visible = false; } } Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); bool b = false; foreach (Tunnel.Model.Tunnel_Votei item in tvList) { string[] temp = item.ivote_yesUserId.Split(','); foreach (string item1 in temp) { if (ul.LoginID.ToString() == item1) { b = true; } } } if (b) { //Button1.Text = "查看结果"; Response.Redirect("VoteShow.aspx?id=" + Request.QueryString["id"].ToString()); } } } }
protected void Page_Load(object sender, EventArgs e) { Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); if (!IsPostBack) { HiddenField1.Value = ul.LoginID.ToString(); showHtml(-1); } }
/// <summary> /// 页面数据绑定 /// </summary> public void PageBind() { PageBase pb = new PageBase(); pb.TblName = "Tunnel_Vote"; pb.FldName = "vote_Id"; pb.ProcedureName = "pagination"; pb.PageSize = pageSize; if (cuttentPage == 0) { cuttentPage = pb.PageIndex; } pb.PageIndex = cuttentPage; Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); if (ul.LoginID == 1) { pb.StrWhere = ""; } else { Tunnel.BLL.Tunnel_menber tm = new Tunnel.BLL.Tunnel_menber(); Tunnel.Model.Tunnel_menber tmm = new Tunnel_menber(); tmm = tm.GetModel(Convert.ToInt64(ul.LoginID)); if (!string.IsNullOrEmpty(Convert.ToString(tmm.m_bum))) { pb.StrWhere = "(vote_bumGroup like '%" + tmm.m_bum + "%' or vote_bumgroup = '|' or vote_bumgroup ='') and (getdate()>vote_startDate and getdate()<vote_endDate) and vote_state=0"; } else { pb.StrWhere = "(vote_bumGroup like '%adfadfadfadfadfa%' or vote_bumgroup = '|' or vote_bumgroup ='') and (getdate()>vote_startDate and getdate()<vote_endDate) and vote_state=0"; } } int count = 0; List <Tunnel.Model.Tunnel_Vote> modelList = new List <Tunnel.Model.Tunnel_Vote>(); modelList = tbll.GetList(pb, ref count); //获取分页结果 pb.DoCount = 1; tbll.GetList(pb, ref count); //获取总条数 //数据绑定 Repeater1.DataSource = modelList; Repeater1.DataBind(); //数据分页 MTCPager1.PageSize = pageSize; MTCPager1.RecordCount = count; MTCPager1.PageIndex = cuttentPage; if (count <= pb.PageSize) { MTCPager1.Visible = false; } else { MTCPager1.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); userid.Value = ul.LoginID.ToString(); this.bind(); PageBind(); } }
public Tunnel.Model.Tunnel_menber GetUserInfo() { Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); Tunnel.Model.Tunnel_menber model = new Tunnel.Model.Tunnel_menber(); if (ul.LoginID > 0) { model = ul.GetUserBean(ul.LoginID); } return(model); }
protected void Button1_Click(object sender, EventArgs e) { Tunnel.Model.Tunnel_VoteRe tvr = new Tunnel_VoteRe(); Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); tvr.vate_userId = ul.LoginID; tvr.vate_voteId = voteId; tvr.vate_Date = DateTime.Now; tvr.vote_Message = Server.HtmlEncode(TextBox1.Text); if (tbll.Add(tvr) > 0) { PageBind(); } }
public string GetFontColor(object o) { string str = o.ToString(); Tunnel.BLL.UserLogin userlogin = new Tunnel.BLL.UserLogin(); if (userlogin.ValidateCache(str)) { return("red"); } else { return("gray"); } }
protected void Page_Load(object sender, EventArgs e) { Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); if (ul.LoginID != 1) { Response.Write("禁止访问!"); Response.End(); } if (!IsPostBack) { Repeater1.DataSource = tm.GetModelList("1=1"); Repeater1.DataBind(); } }
protected void btnAdd_Click(object sender, EventArgs e) { Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); Tunnel.Model.Tunnel_ProjectReport TpRModel = new Tunnel.Model.Tunnel_ProjectReport(); TpRModel.Report_Order = Convert.ToInt32(txtNum.Text.Trim()); TpRModel.Report_Name = txtName.Text; TpRModel.Report_Class = Convert.ToInt32(ddlType.SelectedValue); TpRModel.Report_Sort = Convert.ToInt32(RadioButtonList1.SelectedValue); TpRModel.Report_State = Convert.ToInt32(RadioButtonList3.SelectedValue); TpRModel.Report_UserID = ul.LoginID; TpRModel.Report_Shen = Convert.ToInt32(RadioButtonList2.SelectedValue); Tunnel.BLL.Tunnel_ProjectReport TpRBll = new Tunnel.BLL.Tunnel_ProjectReport(); TpRBll.Add(TpRModel); Tunnel.Common.Message.Show("添加成功!"); }
protected void Button1_Click(object sender, EventArgs e) { try { Tunnel.Model.Tunnel_Chat tc = new Tunnel.Model.Tunnel_Chat(); Tunnel.BLL.Tunnel_Chat btc = new Tunnel.BLL.Tunnel_Chat(); string content = TextBox1.Text; string tomen = Request.Form["DropDownList1"]; int state = 0; if (tomen != "0") { if (CheckBox1.Checked) { state = 2; Tunnel.Model.Tunnel_Remind tr = new Tunnel.Model.Tunnel_Remind(); Tunnel.BLL.Tunnel_Remind br = new Tunnel.BLL.Tunnel_Remind(); tr.m_title = "您有一条聊天信息" + "<font color=red>(待读)</font>"; tr.m_url = "N_Chat/Default.aspx"; tr.m_touser = Convert.ToInt32(tomen); tr.m_time = DateTime.Now; tr.m_type = 2; tr.m_typeid = 2; tr.m_bid = 1; tr.m_callTime = DateTime.Now.AddSeconds(2); tr.m_isread = 0; long messge = br.Add(tr); } else { state = 1; } } Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); ul.UsbnLogin = ul.getUserModel(ul.LoginID); tc.Chat_Content = content; tc.Chat_Date = DateTime.Now; tc.Chat_State = state; tc.Chat_UserID = ul.LoginID; tc.Chat_UserName = ul.UsbnLogin.m_name; tc.Chat_ToUserID = Convert.ToInt32(tomen); btc.Add(tc); Response.Redirect("Chat_Bottom.aspx"); } catch { return; } }
public void Del() { Tunnel.BLL.Tunnel_workplan tw = new Tunnel.BLL.Tunnel_workplan(); Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); tw.Delete(int.Parse(Request.QueryString["id"].ToString()), ul.LoginID, Tunnel.Common.Common.GetIp()); Tunnel.BLL.Tunnel_Remind tr = new Tunnel.BLL.Tunnel_Remind(); Tunnel.Model.Tunnel_Remind trr = new Tunnel.Model.Tunnel_Remind(); List <Tunnel.Model.Tunnel_Remind> trList = new List <Tunnel.Model.Tunnel_Remind>(); trList = tr.GetModelList("m_type=3 and m_typeid=" + Request.QueryString["id"].ToString() + ""); if (trList.Count > 0) { tr.Delete(trList[0].m_typeid); } }
public void call(string title, string id, DateTime calltime, long toId) { Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); Tunnel.Model.Tunnel_Remind remindmodel = new Tunnel.Model.Tunnel_Remind(); remindmodel.m_isread = 0; remindmodel.m_time = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); remindmodel.m_title = " 投票:" + title + "<font color=red>(未读)</font>"; remindmodel.m_touser = toId; remindmodel.m_url = "N_Exchange/N_Vote/Vote.aspx?id=" + id; remindmodel.m_callTime = calltime; remindmodel.m_type = 4; remindmodel.m_typeid = int.Parse(id); remindmodel.m_bid = 0; Tunnel.BLL.Tunnel_Remind rd = new Tunnel.BLL.Tunnel_Remind(); rd.Add(remindmodel); }
/// <summary> /// 页面数据绑定 /// </summary> public void PageBind() { PageBase pb = new PageBase(); pb.TblName = "Tunnel_Vote"; pb.FldName = "vote_Id"; pb.ProcedureName = "pagination"; pb.PageSize = pageSize; if (cuttentPage == 0) { cuttentPage = pb.PageIndex; } pb.PageIndex = cuttentPage; Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); if (ul.LoginID == 1) { pb.StrWhere = ""; } else { pb.StrWhere = "vote_userId = " + ul.LoginID + ""; } int count = 0; List <Tunnel.Model.Tunnel_Vote> modelList = new List <Tunnel.Model.Tunnel_Vote>(); modelList = tbll.GetList(pb, ref count); //获取分页结果 pb.DoCount = 1; tbll.GetList(pb, ref count); //获取总条数 //数据绑定 Repeater1.DataSource = modelList; Repeater1.DataBind(); //数据分页 MTCPager1.PageSize = pageSize; MTCPager1.RecordCount = count; MTCPager1.PageIndex = cuttentPage; if (count <= pb.PageSize) { MTCPager1.Visible = false; } else { MTCPager1.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); if (!IsPostBack) { HiddenField1.Value = ul.LoginID.ToString(); if (!string.IsNullOrEmpty(Request["id"])) { string id = Request["id"].ToString(); showHtml(Convert.ToInt32(id)); } else { showHtml(-1); } } }
public void call(string title, string id, DateTime calltime) { Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); Tunnel.Model.Tunnel_Remind remindmodel = new Tunnel.Model.Tunnel_Remind(); remindmodel.m_isread = 0; remindmodel.m_time = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); remindmodel.m_title = "日程提示:" + title + "<font color=red>(未读)</font>"; remindmodel.m_touser = ul.LoginID; remindmodel.m_url = "N_Calendar/CalendarInfo.aspx?id=" + id; remindmodel.m_callTime = calltime; remindmodel.m_typeid = int.Parse(id); remindmodel.m_type = 3; Tunnel.BLL.Tunnel_Remind rd = new Tunnel.BLL.Tunnel_Remind(); if (calltime != Convert.ToDateTime("1800-01-01")) { rd.Add(remindmodel); } }
public void PageBind() { PageBase pb = new PageBase(); pb.TblName = "Tunnel_file"; pb.FldName = "f_id"; pb.ProcedureName = "pagination"; pb.PageSize = pageSize; if (cuttentPage == 0) { cuttentPage = pb.PageIndex; } pb.PageIndex = cuttentPage; Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); pb.StrWhere = "( f_sort = 1) or (Charindex(',',f_juser," + ul.LoginID + ") > 0 )"; int count = 0; List <Tunnel.Model.Tunnel_file> modelList = new List <Tunnel.Model.Tunnel_file>(); modelList = rbll.GetList(pb, ref count);//获取分页结果 pb.DoCount = 1; rbll.GetList(pb, ref count); //获取总条数 //数据绑定 Repeater1.DataSource = modelList; Repeater1.DataBind(); //数据分页 MTCPager1.PageSize = pageSize; MTCPager1.RecordCount = count; MTCPager1.PageIndex = cuttentPage; if (count <= pb.PageSize) { MTCPager1.Visible = false; } else { MTCPager1.Visible = true; } }
protected void Button1_Click(object sender, EventArgs e) { if (Button1.Text == "投票") { Tunnel.BLL.Tunnel_Votei tvi = new Tunnel.BLL.Tunnel_Votei(); Tunnel.Model.Tunnel_Votei tvii = new Tunnel.Model.Tunnel_Votei(); if (voteType == "0") { for (int i = 0; i < Repeater1.Items.Count; i++) { if (((RadioButton)Repeater1.Items[i].FindControl("RadioButton1")).Checked) { tvii.ivote_Id = Convert.ToInt32(((RadioButton)Repeater1.Items[i].FindControl("RadioButton1")).ToolTip.ToString()); tvii = tvi.GetModel(tvii.ivote_Id); tvii.ivote_Count++; Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); tvii.ivote_yesUserId += ul.LoginID + ","; tvi.Update(tvii); } } } else { for (int i = 0; i < Repeater1.Items.Count; i++) { if (((CheckBox)Repeater1.Items[i].FindControl("CheckBox1")).Checked) { tvii.ivote_Id = Convert.ToInt32(((CheckBox)Repeater1.Items[i].FindControl("CheckBox1")).ToolTip.ToString()); tvii = tvi.GetModel(tvii.ivote_Id); tvii.ivote_Count++; Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); tvii.ivote_yesUserId += ul.LoginID + ","; tvi.Update(tvii); } } } Tunnel.Common.Message.Show("投票成功!"); } else { Response.Redirect("indexvoteshow.aspx?id=" + id + ""); } }
/// <summary> /// 显示对谁说 /// </summary> /// <param name="toid"></param> /// <param name="state"></param> /// <returns></returns> public string gettoUser(string toid, string state) { Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); ul.UsbnLogin = ul.getUserModel(Convert.ToInt32(toid)); if (state == "1") { return("对 <span style='color:green'>" + ul.UsbnLogin.m_name + "</span> "); } else if (state == "2") { if (ul.LoginID.ToString().Equals(toid)) { return("对 <span style='color:red'>你</span> 悄悄的"); } else { return("对 <span style='color:red'>" + ul.UsbnLogin.m_name + "</span> 悄悄的"); } } else { return(""); } }
/// <summary> /// 投票事件 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e) { string cmd = e.CommandName; if (cmd == "Ed") { int id = Convert.ToInt32(e.CommandArgument); Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); int UID = Convert.ToInt32(ul.LoginID); Tunnel.Model.VoteLog voteLog = new Tunnel.Model.VoteLog(); Tunnel.BLL.VoteLog voteLogBll = new Tunnel.BLL.VoteLog(); IList <Tunnel.Model.VoteLog> list_VoteLog = new List <Tunnel.Model.VoteLog>(); list_VoteLog = (new Tunnel.BLL.VoteLog()).GetModelList("vg_userId=" + UID + " and vg_voteId=" + id); //获取投票记录项 if (list_VoteLog.Count > 0) { voteLog = list_VoteLog[list_VoteLog.Count - 1]; } switch (VoteType) { case "1": #region 每人一天可以投一次 if (list_VoteLog.Count == 0) { //添加一条投票记录 voteLogModel.vg_setDate = DateTime.Now; voteLogModel.vg_userId = UID; voteLogModel.vg_voteId = id; voteLogBll.Add(voteLogModel); String Update_VoteCount = string.Format("update Vote_Info set v_count =v_count+1 where v_id={0} ", id); String Add_Date_Sys = String.Format("insert into Date_Sys values('{0}','{1}','{2}','{3}')", UID, DateTime.Now, DateTime.Now, null); //更新票数,对票数进行加1 int result = Tunnel.Data.DbHelperSQL.ExecuteSql(Update_VoteCount); //第一次投票 int Result = Tunnel.Data.DbHelperSQL.ExecuteSql(Add_Date_Sys); Label lb = (Label)e.Item.FindControl("lblCount"); int v_count = Convert.ToInt32(lb.Text.ToString()); v_count++; lb.Text = v_count.ToString(); ClientScript.RegisterStartupScript(GetType(), "确定", "<script>alert('投票成功!');</script>"); } else if (voteLog.vg_setDate.Date != DateTime.Now.Date) { //添加一条投票记录 voteLogModel.vg_setDate = DateTime.Now; voteLogModel.vg_userId = UID; voteLogModel.vg_voteId = id; voteLogBll.Add(voteLogModel); String Update_VoteCount = string.Format("update Vote_Info set v_count =v_count+1 where v_id={0} ", id); String Update_VoteLog = string.Format("update VoteLog set vg_setDate ='{0}' where vg_id='{1}' and vg_userId='{2}'", DateTime.Now, id, UID); String Update_VoteDate = string.Format("update Date_Sys set d_endPoll_Date='{0}'where d_userId={1} ", DateTime.Now, UID); //更新票数,对票数进行加1 int result = Tunnel.Data.DbHelperSQL.ExecuteSql(Update_VoteCount); //更新投票的时间,最后一次投票的时间 int count = Tunnel.Data.DbHelperSQL.ExecuteSql(Update_VoteDate); int record = Tunnel.Data.DbHelperSQL.ExecuteSql(Update_VoteLog); Label lb = (Label)e.Item.FindControl("lblCount"); int v_count = Convert.ToInt32(lb.Text.ToString()); v_count++; lb.Text = v_count.ToString(); ClientScript.RegisterStartupScript(GetType(), "确定", "<script>alert('投票成功!');</script>"); } else { ClientScript.RegisterStartupScript(GetType(), "确定", "<script>alert('每张图片,一天可以投一次!');</script>"); } #endregion break; case "0": #region 限定每人只能投一次票 if (list_VoteLog.Count == 0) { //添加一条投票记录 voteLogModel.vg_setDate = DateTime.Now; voteLogModel.vg_userId = UID; voteLogModel.vg_voteId = id; voteLogBll.Add(voteLogModel); String Update_VoteCount = string.Format("update Vote_Info set v_count =v_count+1 where v_id={0} ", id); String Add_Date_Sys = String.Format("insert into Date_Sys values('{0}','{1}','{2}','{3}')", UID, DateTime.Now, DateTime.Now, null); //更新票数,对票数进行加1 int result = Tunnel.Data.DbHelperSQL.ExecuteSql(Update_VoteCount); //第一次投票 int Result = Tunnel.Data.DbHelperSQL.ExecuteSql(Add_Date_Sys); Label lb = (Label)e.Item.FindControl("lblCount"); int v_count = Convert.ToInt32(lb.Text.ToString()); v_count++; lb.Text = v_count.ToString(); } else { Tunnel.Common.Message.Show("每人每张只能投一次票"); } #endregion break; } } }
protected void calSchedule_DayRender(object sender, DayRenderEventArgs e) { Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); Tunnel.BLL.Tunnel_menber tm = new Tunnel.BLL.Tunnel_menber(); Tunnel.Model.Tunnel_menber user = tm.GetModel(Convert.ToInt64(ul.LoginID.ToString())); //自定义显示内容 CalendarDay calDay = e.Day; //获取表示呈现在空间中的单元格 TableCell tc = e.Cell; if (calDay.IsOtherMonth) { tc.Controls.Clear(); } else { try { HtmlAnchor ahyperLink = new HtmlAnchor(); ahyperLink.InnerHtml = calDay.Date.Day > 9 ? "<img src='../image/notify_new.gif' />" : " <img src='../image/notify_new.gif' />"; ahyperLink.Title = "新增个人日程"; ahyperLink.HRef = "CalendarAdd.aspx?day=" + calDay.Date.ToShortDateString(); ahyperLink.ID = "ServerA"; tc.Controls.Add(new LiteralControl(" " + " " + " ")); tc.Controls.Add(ahyperLink); Tunnel.BLL.Tunnel_workplan tw = new Tunnel.BLL.Tunnel_workplan(); List <Tunnel.Model.Tunnel_workplan> wkList = tw.GetModelList("w_user="******" and w_starttime>='" + calDay.Date.ToShortDateString() + "' and w_starttime<'" + calDay.Date.AddDays(1).ToShortDateString() + "'"); if (wkList.Count > 0) { string str = null; foreach (Tunnel.Model.Tunnel_workplan schedule in wkList) { int tmpCount = imgCount++; HtmlAnchor ha = new HtmlAnchor(); ha.Attributes.Add("onmouseover", "javascript:show('img" + tmpCount + "')"); ha.HRef = "CalendarInfo.aspx?id=" + schedule.w_id + "&day=" + calDay.Date.ToShortDateString(); //try //{ // str = schedule.w_title.Substring(0, 3); //} //catch //{ // str = schedule.w_title.ToString(); //} ha.InnerHtml = "<img src='../image/atchm.gif' border=0 />" + schedule.w_starttime.Hour.ToString() + ":" + schedule.w_starttime.Minute.ToString() + " " + str + "..." + "<a href='?id=" + schedule.w_id + "' onClick=\"return confirm('是否删除此条记录?')\">" + "<img alt='删除日程' id=img" + tmpCount + " name=remove src='../image/remove.png' border=0 style='display:none'/></a>"; tc.Controls.Add(new LiteralControl(" " + " " + " ")); tc.Controls.Add(new LiteralControl("<br>")); tc.Controls.Add(ha); } } } catch (Exception) { //Response.Write(ex.ToString()); } e.Cell.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#fff7ce';cursor='hand';"; e.Cell.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#ffffff'"; } }
/// <summary> /// 查看是否有权限 /// </summary> /// <param name="userID">用户ID</param> /// <param name="XreqestStr">小类</param> /// <param name="BreqestStr">大类</param> /// <returns>true有权限</returns> public static bool IfHasPrimision(string userID, string XreqestStr, string BreqestStr, bool IfRead) { string tmpUid = string.Empty; string tmpBid = string.Empty; string tmpDid = string.Empty; string tmpJid = string.Empty; Tunnel.BLL.Tunnel_menber tm = new Tunnel_menber(); Tunnel.Model.Tunnel_menber tmm = new Tunnel.Model.Tunnel_menber(); List <Tunnel.Model.Tunnel_menber> tmlist = new List <Tunnel.Model.Tunnel_menber>(); Tunnel.BLL.Tunnel_jiaose tj = new Tunnel_jiaose(); Tunnel.Model.Tunnel_jiaose tjj = new Tunnel.Model.Tunnel_jiaose(); Tunnel.BLL.Tunnel_quanxian qx = new Tunnel_quanxian(); Tunnel.Model.Tunnel_quanxian qxx = new Tunnel.Model.Tunnel_quanxian(); List <Tunnel.Model.Tunnel_quanxian> qxlist = new List <Tunnel.Model.Tunnel_quanxian>(); Tunnel.BLL.Tunnel_yingshe tyj = new Tunnel_yingshe(); Tunnel.Model.Tunnel_yingshe tyjj = new Tunnel.Model.Tunnel_yingshe(); List <Tunnel.Model.Tunnel_yingshe> tyjlist = new List <Tunnel.Model.Tunnel_yingshe>(); Tunnel.BLL.Tunnel_uyingshe tyu = new Tunnel_uyingshe(); Tunnel.Model.Tunnel_uyingshe tyuu = new Tunnel.Model.Tunnel_uyingshe(); List <Tunnel.Model.Tunnel_uyingshe> tyulist = new List <Tunnel.Model.Tunnel_uyingshe>(); Tunnel.BLL.Tunnel_byingshe tyb = new Tunnel_byingshe(); Tunnel.Model.Tunnel_byingshe tybb = new Tunnel.Model.Tunnel_byingshe(); List <Tunnel.Model.Tunnel_byingshe> tyblist = new List <Tunnel.Model.Tunnel_byingshe>(); Tunnel.BLL.Tunnel_dyingshe tyd = new Tunnel_dyingshe(); Tunnel.Model.Tunnel_dyingshe tydd = new Tunnel.Model.Tunnel_dyingshe(); List <Tunnel.Model.Tunnel_dyingshe> tydlist = new List <Tunnel.Model.Tunnel_dyingshe>(); UserLogin ul = new UserLogin(); bool b = false; string qxStr = string.Empty; tmm = tm.GetModel(Convert.ToInt64(userID)); tmpBid = tmm.m_bum.ToString(); tmpJid = tmm.m_jiao.ToString(); tmpDid = tmm.m_duty.ToString(); tmpUid = userID; tyulist = tyu.GetModelList("uy_uid='" + tmpUid + "'"); if (tyulist.Count > 0) { if (tyulist[0].uy_list.Length > 0) { qxStr += tyulist[0].uy_list + "|"; } } tyjlist = tyj.GetModelList("y_jsid=" + tmpJid + ""); if (tyjlist.Count > 0) { if (tyjlist[0].y_qxlist.Length > 0) { qxStr += tyjlist[0].y_qxlist + "|"; } } tyblist = tyb.GetModelList("by_bid='" + tmpBid + "'"); if (tyblist.Count > 0) { if (tyblist[0].by_list.Length > 0) { qxStr += tyblist[0].by_list + "|"; } } tydlist = tyd.GetModelList("dy_did='" + tmpDid + "'"); if (tydlist.Count > 0) { if (tydlist[0].dy_list.Length > 0) { qxStr += tydlist[0].dy_list + "|"; } } if (qxStr.Length > 0) { qxStr = qxStr.Substring(0, qxStr.Length - 1); } if (userID != "1" && ul.JiaoSe(int.Parse(userID)) != "系统管理员") { if (IfRead) { if (tmpJid != "0") { if (ul.JiaoSe(int.Parse(userID)) == "总经理") { b = true; } } } if (!string.IsNullOrEmpty(qxStr)) { qxlist = qx.GetModelList("q_name='" + XreqestStr + "' and q_mark='" + BreqestStr + "'"); if (qxlist.Count > 0) { foreach (string item in qxStr.Split('|')) { if (qxlist[0].q_id.ToString().Equals(item.ToString())) { b = true; } } } } } else { b = true; } return(b); }
protected void btnSave_Click(object sender, EventArgs e) { Tunnel.BLL.Tunnel_Vote tv = new Tunnel.BLL.Tunnel_Vote(); Tunnel.Model.Tunnel_Vote tvv = new Tunnel.Model.Tunnel_Vote(); Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); tvv.vote_userId = Convert.ToInt32(ul.LoginID.ToString()); tvv.vote_bumGroup = TextbumId.Value; tvv.vote_startDate = TextBox1.Text.Trim().Length > 0 ? Convert.ToDateTime(TextBox1.Text) : DateTime.Now; tvv.vote_endDate = TextBox2.Text.Trim().Length > 0 ? Convert.ToDateTime(TextBox2.Text) : Convert.ToDateTime(tvv.vote_startDate).AddYears(1); tvv.vote_mark = txtText.Text; tvv.vote_state = 0; tvv.vote_Title = txtTitle.Text; tvv.vote_top = 0; tvv.vote_Type = Convert.ToInt32(DropDownList1.SelectedValue); tvv.vote_max = 1; if (tvv.vote_Type == 1) { if (TextBox3.Text.Length > 0) { tvv.vote_max = Convert.ToInt32(TextBox3.Text.Trim()); } else { tvv.vote_max = 1; } } int relf = tv.Add(tvv); if (relf > 0) { if (CheckBox1.Checked) { #region 发消息给大家////////////////////////////////////// //获得所需参数 string strToIds = tvv.vote_bumGroup; string strTitle = "投票:" + tvv.vote_Title; //写入数据库 if (strToIds != "" && strToIds != "|") { strToIds = strToIds.Split('|')[0].ToString(); if (strToIds.LastIndexOf(',') > 0) { strToIds = strToIds.Remove(strToIds.LastIndexOf(','), 1); } string[] arr = strToIds.Split(','); List <Tunnel.Model.Tunnel_menber> tmList = new List <Tunnel.Model.Tunnel_menber>(); foreach (string item in arr) { Tunnel.BLL.Tunnel_menber tm = new Tunnel.BLL.Tunnel_menber(); tmList = new List <Tunnel.Model.Tunnel_menber>(); tmList = tm.GetModelList("m_bum=" + item + ""); for (int j = 0; j < tmList.Count; j++) { call(strTitle, relf.ToString(), DateTime.Now, tmList[j].m_id); } } } else { List <Tunnel.Model.Tunnel_menber> tmList = new List <Tunnel.Model.Tunnel_menber>(); Tunnel.BLL.Tunnel_menber tm = new Tunnel.BLL.Tunnel_menber(); tmList = tm.GetModelList(""); foreach (Tunnel.Model.Tunnel_menber item in tmList) { call(strTitle, relf.ToString(), DateTime.Now, item.m_id); } } #endregion } Tunnel.Common.Message.Show("添加成功!", "VoteItemsAdd.aspx?id=" + relf + ""); } else { Tunnel.Common.Message.Show("添加失败!"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { id = Convert.ToInt32(Request.QueryString["id"].ToString()); Tunnel.BLL.Tunnel_Vote t = new Tunnel.BLL.Tunnel_Vote(); Tunnel.Model.Tunnel_Vote tt = new Tunnel.Model.Tunnel_Vote(); Tunnel.BLL.Tunnel_menber tm = new Tunnel.BLL.Tunnel_menber(); tt = t.GetModel(id); voteTitle = tt.vote_Title; voteUserName = tm.GetModel(Convert.ToInt32(tt.vote_userId)).m_name; voteDate = Convert.ToDateTime(tt.vote_startDate).ToShortDateString(); if (!string.IsNullOrEmpty(tt.vote_mark)) { voteMark = "<img src=../image/info.png width=20px />" + tt.vote_mark; } voteMax = tt.vote_max.ToString(); voteType = tt.vote_Type.ToString(); max.Value = voteMax; tvList = tv.GetModelList("ivote_voteId=" + id + ""); Repeater1.DataSource = tvList; Repeater1.DataBind(); if (voteType == "0") { for (int i = 0; i < Repeater1.Items.Count; i++) { ((CheckBox)Repeater1.Items[i].FindControl("CheckBox1")).Visible = false; } } else { for (int i = 0; i < Repeater1.Items.Count; i++) { ((RadioButton)Repeater1.Items[i].FindControl("RadioButton1")).Visible = false; } } Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin(); bool b = false; for (int i = 0; i < tvList.Count; i++) { string[] temp = tvList[i].ivote_yesUserId.Split(','); for (int j = 0; j < temp.Length; j++) { if (ul.LoginID.ToString() == temp[j]) { b = true; } } } if (b) { Button1.Text = "查看结果"; } } else { Tunnel.BLL.Tunnel_Vote tv = new Tunnel.BLL.Tunnel_Vote(); List <Tunnel.Model.Tunnel_Vote> tvList = new List <Tunnel.Model.Tunnel_Vote>(); tvList = tv.GetModelList("(getdate()>vote_startDate and getdate()<vote_endDate) and vote_state=0 and vote_top =1 order by vote_startDate desc"); if (tvList.Count > 0) { Response.Redirect("indexvote.aspx?id=" + tvList[0].vote_Id + ""); } } } }