//单击已完成项目、发放、删除按钮 protected void completedBtn_Click(object sender, EventArgs e) { if (NoticeMidList1.Visible) { string deleteIds = NoticeMidList1.GetCheckdId(); if (deleteIds.Length != 0) { try { dalAnnounement.Delete(deleteIds); GetNoticeMidList(0); GetAnnounceList(); scripthelp.Alert("删除公告成功!", Page); } catch(Exception ex) { ControlLog controlLog = new ControlLog("home"); controlLog.WriteDebugLog("completedBtn_Click-删除公告", ex.ToString(), user.realName); scripthelp.Alert("删除公告失败!", Page); } } else scripthelp.Alert("没有选中任何公告,不可以进行删除。", Page); } else if (FinancialMidList1.Visible) { string giveFIds = FinancialMidList1.GetCheckdId(); if (giveFIds.Length != 0) { string[] ids = Common.StringToArray(giveFIds); try { if (dalFinance.Set("actionStatus", 1, "actionDate", DateTime.Now, giveFIds) == ids.Length) { GetAnnounceList(); GetFinanceMidList("[actionStatus]=0", 1); scripthelp.Alert("发放财务成功!", Page); } else scripthelp.Alert("发放财务失败!", Page); } catch(Exception ex) { ControlLog controlLog = new ControlLog("home"); controlLog.WriteDebugLog("completedBtn_Click", ex.ToString(), user.realName); scripthelp.Alert("发放财务失败!", Page); } } else scripthelp.Alert("没有选中任何财务,不可以进行发放。", Page); } else GetItemList(1, "[status]=100", false); }
protected void DeleteBtn_Click(object sender, EventArgs e) { if (menberHid.Value != null) { try { userDal.Delete(menberHid.Value.Trim()); scripthelp.Alert("删除人员成功!", Page); GetListAfterGet(GroupNameLitr.Text); } catch(Exception ex) { ControlLog controlLog = new ControlLog("manager"); controlLog.WriteDebugLog("DeleteBtn_Click-删除人员失败", ex.ToString(), user.realName); scripthelp.Alert("删除人员失败!", Page); } } else scripthelp.Alert("没有选中任何人员,不可以进行删除。", Page); }
public void uploading_Click(object sender, EventArgs e) { if (this.InputFile.HasFile) { ProgressBar.Visible = true; OA_item item = new OA_item(); item = itemDal.GetModel(Convert.ToInt32(Request.QueryString["id"]), "id"); string fileName = InputFile.FileName; string extendName = System.IO.Path.GetExtension(fileName); //前后台都验证,以防客户浏览器禁用js或更改js if (extendName == ".rar" || extendName == ".zip" || extendName == ".gz" || extendName == ".7z" || extendName == ".7Z" || extendName == ".RAR" || extendName == ".ZIP" || extendName == ".GZ") { try { string Path = "upFile/" + DateTime.Now.Year + "/" + item.itemName + "/"; string saveFileUrl = System.Web.HttpContext.Current.Request.MapPath(Path); string saveFileName = System.IO.Path.Combine(saveFileUrl, fileName); if (!Directory.Exists(saveFileUrl)) { Directory.CreateDirectory(saveFileUrl); } InputFile.MoveTo(saveFileName, Brettle.Web.NeatUpload.MoveToOptions.Overwrite); if (!item.zipUrl.Equals(Path + fileName)) { item.zipUrl = Path + fileName; itemDal.Update(item); } } catch (Exception ex) { ControlLog controlLog = new ControlLog("read"); controlLog.WriteDebugLog("uploading_Click", ex.ToString(), user.realName); scripthelp.Alert("上传文件失败!",Page); } } } }
public void submitBtn_Click(object sender, EventArgs e) { try { user = userDal.GetModel(user.id, "id"); int addFlag = 0;//记录保存的操作是否成功 int itemMessId = Convert.ToInt32(itemMessageIdHidden.Value);//绑定用户组信息时读取出来的itemMessage.id OA_itemMessage groupMess = new OA_itemMessage(); int origiGroupStatus = -1; if (itemMessId == 0)//用户在该项目的小组信息不存在,初始化groupMess { groupMess.userName = user.realName; groupMess.itemId = item.id; groupMess.groupStatus = 0; groupMess.postDate = DateTime.Now; } else groupMess = itemMessageDal.GetModel(itemMessId, "id"); groupMess.message = messageTextarea.Value; if (groupProLenHid.Value != (5.54 * groupMess.groupStatus + "px;"))//组的进度条有变化 { int statusLength = groupProLenHid.Value.Length - 2; origiGroupStatus = groupMess.groupStatus; groupMess.groupStatus = Convert.ToInt32(Convert.ToDouble(groupProLenHid.Value.Substring(0, statusLength)) / 5.54); if (itemMessageIdHidden.Value == "0") { itemMessageDal.Add(groupMess);//改组信息不存在则add groupMess = itemMessageDal.GetList(1, 1, "[itemId]=" + item.id + " and [userName]='" + user.realName + "'", "")[0]; if (groupMess.id != 0) addFlag = 1; } else { groupMess.id = Convert.ToInt32(itemMessageIdHidden.Value); addFlag = itemMessageDal.Update(groupMess);//改组信息存在则update } if (addFlag == 0) scripthelp.Alert("项目小组进度和留言保存失败!", this.Page); else addFlag = 0; int groupCount = 0;//计算该项目的参与的小组数0~4 if (item.frontendName != null & item.frontendName != "") groupCount++; if (item.planeName != null & item.planeName != "") groupCount++; if (item.programName != null & item.programName != "") groupCount++; if (item.flashName != null & item.flashName != "") groupCount++; if(groupCount>0)item.status += (groupMess.groupStatus - origiGroupStatus) * 9 / (groupCount * 10);//根据用户更改后自己的进度而计算项目的总进度0~90 } else//用户进度条无变化 { itemMessageDal.Add(groupMess); groupMess = itemMessageDal.GetList(1, 1, "[itemId]=" + item.id + " and [userName]='" + user.realName + "'", "")[0];//获取刚add的itemMessage对象 if (groupMess.id != 0) addFlag = 1; } OA_step steps = stepDal.GetModel(groupMess.id, "[itemMessageId]"); string[] stepsArray; if (steps == null)//数据库不存在该组步骤信息则加载原始步骤 stepsArray = Common.setOrigiStepList(user.groups); else stepsArray = Common.StringToArray(steps.step); if (stepHiddens.Value.Trim() != Common.ArrayToString(stepsArray))//隐藏的步骤记录input的值有变化 { try { if (steps == null) { OA_step newStep = new OA_step(); newStep.step = stepHiddens.Value.Trim(); newStep.itemMessageId = groupMess.id; stepDal.Add(newStep); addFlag = 1; } else { steps.step = stepHiddens.Value.Trim(); addFlag += stepDal.Update(steps); } } catch(Exception ex) { ControlLog controlLog = new ControlLog("edit"); controlLog.WriteDebugLog("submitBtn_Click-项目步骤保存失败!", ex.ToString(), user.realName); scripthelp.Alert("项目步骤保存失败!", this.Page); } if (addFlag == 0) scripthelp.Alert("项目步骤保存失败!", this.Page); else addFlag = 0; } if (user.realName == item.leaderName)//是项目负责人则要保存其对项目信息的更改 { item.leaderName = leaderInput.Value.Trim(); if (linkInput.Value.Trim() == "暂无") { item.linkUrl = ""; } else item.linkUrl = linkInput.Value.Trim(); item.client = clientInput.Value.Trim(); item.money = Convert.ToInt32(moneyInput.Value.Trim()); item.completeDate = Convert.ToDateTime(yearIn.Value.Trim() + "-" + monthIn.Value.Trim() + "-" + dayIn.Value.Trim()); item.itemDetials = itemDetialsIn.InnerText.Trim(); item.zipUrl = ""; } addFlag = itemDal.Update(item); int userItemsCount = DataBind(item); if (origiGroupStatus != -1 && userItemsCount != 0) { user.status += (groupMess.groupStatus - origiGroupStatus) / userItemsCount; if (user.status > 100) user.status = 100; else if (user.status < 0) user.status = 0; userDal.Update(user); } else DataBind(item); if (addFlag != 0) scripthelp.Alert("保存成功!", this.Page); } catch (Exception ex) { ControlLog controlLog = new ControlLog("edit"); controlLog.WriteDebugLog("submitBtn_Click-项目详细信息保存失败!", ex.ToString(), user.realName); scripthelp.Alert("项目详细信息保存失败!", this.Page); } }
//发布公告 protected void NoticeSubmit_Click(object sender, EventArgs e) { if (notice_heading.Value != "") { OA_announcement newNotice = new OA_announcement(); newNotice.title = notice_heading.Value.Trim(); newNotice.poster = user.realName; newNotice.content = notice_decoration.Value.Trim() == "" ? "无" : notice_decoration.Value.Trim(); string[] columnA = { "poster", "title", "content" }; try { dalAnnounement.insert(columnA, newNotice, new ArrayList { newNotice.poster, newNotice.title, newNotice.content }); scripthelp.Alert("创建" + newNotice.title + "公告成功!", Page); } catch(Exception ex) { ControlLog controlLog = new ControlLog("home"); controlLog.WriteDebugLog("NoticeSubmit_Click", ex.ToString(), user.realName); scripthelp.Alert("创建" + newNotice.title + "公告失败!", Page); } GetAnnounceList(); if (NoticeMidList1.Visible) GetNoticeMidList(0); } }
//单击创建项目的创建button protected void itemSubmitBtn_click(object sender, EventArgs e) { if (principle.Text != "" & project_name.Text != "" & bailer.Text != "" & money.Text != "") { OA_item item = new OA_item(); List<string> failNameList = new List<string>(); string[] itemMenbers = { item.leaderName, item.planeName, item.frontendName, item.programName, item.flashName }; string[] itemTextMenbers = { principle.Text.Trim(), pingmian.Text.Trim(), qianduan.Text.Trim(), flashzu.Text.Trim(), houtai.Text.Trim() }; for (int i = 0; i < 5; i++) { if (dalUser.GetUser("realName", itemTextMenbers[i]) != null) { itemMenbers[i] = itemTextMenbers[i]; } } item.leaderName = SetTipsByText(itemMenbers[0], principle.Text.Trim(), failNameList); item.planeName = SetTipsByText(itemMenbers[1], pingmian.Text.Trim(), failNameList); item.frontendName = SetTipsByText(itemMenbers[2], qianduan.Text.Trim(), failNameList); item.flashName = SetTipsByText(itemMenbers[3], flashzu.Text.Trim(), failNameList); item.programName = SetTipsByText(itemMenbers[4], houtai.Text.Trim(), failNameList); if (failNameList.Count != 0) { string failNameStr = ""; foreach (string failName in failNameList) { failNameStr += failName + ","; } string tips = string.Format("工作室不存在{0}哦,请重新填写别人的名字啦。", failNameStr.Remove(failNameStr.LastIndexOf(','))).Trim(); scripthelp.Alert(tips, this.Page); scripthelp.RunScript(this.Page, "document.getElementById('edit').style.display='block';document.getElementById('create').style.display = 'block';"); } else { item.itemName = project_name.Text.Trim(); item.client = bailer.Text.Trim(); item.money = Convert.ToInt32(money.Text.Trim()); try { item.completeDate = Convert.ToDateTime(year.Text.Trim() + "-" + month.Text.Trim() + "-" + day.Text.Trim()); item.itemDetials = decoration.InnerText.Trim(); string[] columnArray = { "itemName", "client", "money", "status", "itemDetials", "leaderName", "planeName", "frontendName", "programName", "flashName", "completeDate" }; ArrayList al = new ArrayList { item.itemName, item.client, item.money, item.status, item.itemDetials, item.leaderName, item.planeName, item.frontendName, item.programName, item.flashName, item.completeDate }; dalItem.insert(columnArray, item, al); SetNewItemUserStatus(new string[] { item.planeName, item.frontendName, item.programName, item.flashName }); scripthelp.Alert("创建" + item.itemName + "项目成功!", Page); } catch(Exception ex) { ControlLog controlLog = new ControlLog("home"); controlLog.WriteDebugLog("itemSubmitBtn_click", ex.ToString(),user.realName); scripthelp.Alert("创建" + item.itemName + "项目失败!", Page); } GetItemList(1, "", true); GetUserList(1, dalUser.GetList(1, userPageCount,"", "[status]", out userCount), userCount); }//end of if (failNameList.Count == 0) } else { scripthelp.Alert("负责人,项目名称,委托方,金额都不能空哦。", this.Page); scripthelp.RunScript(this.Page, "document.getElementById('edit').style.display='block';document.getElementById('create').style.display = 'block';"); principle.Focus(); }//end of if(principle.Text != "".... }
//添加财务 protected void FinancialSubmit_Click(object sender, EventArgs e) { if (financial_event.Value != "" & moneyIn.Value != "") { OA_finance newFinance = new OA_finance(); if (inOrOutDropL.SelectedValue == "收入") newFinance.money = int.Parse(moneyIn.Value.Trim()); else newFinance.money = int.Parse("-" + moneyIn.Value.Trim()); newFinance.actionName = financial_event.Value.Trim(); newFinance.actionDetails = financial_decoration.Value.Trim(); newFinance.actionStatus = 1; try { newFinance.actionDate = Convert.ToDateTime(get_year.Value.Trim() + "-" + get_month.Value.Trim() + "-" + get_day.Value.Trim()); dalFinance.Add(newFinance); scripthelp.Alert("添加" + newFinance.actionName + "财务事件成功!", Page); GetFinanceList(); string bigOrSmall = newFinance.money > 0 ? ">" : "<"; GetFinanceMidList("money" + bigOrSmall + "0 AND [actionStatus]=1", 1); } catch(Exception ex) { ControlLog controlLog = new ControlLog("home"); controlLog.WriteDebugLog("FinancialSubmit_Click", ex.ToString(), user.realName); scripthelp.Alert("添加" + newFinance.actionName + "财务失败!", Page); } } }
//删除财务事件 protected void deleteFinanceBtn_Click(object sender, EventArgs e) { string deleteIds = FinancialMidList1.GetCheckdId(); if (deleteIds.Length != 0) { try { this.dalFinance.Delete(deleteIds); GetFinanceList(); GetFinanceMidList("money>0 AND [actionStatus]=1", 1); scripthelp.Alert("删除财务成功!", Page); } catch(Exception ex) { ControlLog controlLog = new ControlLog("home"); controlLog.WriteDebugLog("deleteFinanceBtn_Click", ex.ToString(), user.realName); scripthelp.Alert("删除财务失败!", Page); } } else scripthelp.Alert("没有选中任何财务,不可以进行删除。", Page); }
//添加人员 protected void SubmitBtn_Click(object sender, EventArgs e) { if (UserIn.Value != "" & GradeIn.Value != "") { OA_users newUser = new OA_users(); newUser.realName = UserIn.Value.Trim(); if (userDal.GetUser("realName", newUser.realName) != null) { scripthelp.Alert("工作室已经存在" + newUser.realName + ",若真的要添加,请为该同学加不同的标识,如加上届数:10小花!", Page); scripthelp.RunScript(this.Page, "document.getElementById('edit').style.display='block'"); UserIn.Focus(); } else { newUser.loginName = newUser.realName; newUser.groups = this.GroupDropList.SelectedValue.Trim(); newUser.grade = GradeIn.Value.Trim(); newUser.roles = RolesDropList.SelectedValue.Trim(); newUser.school = SchoolIn.Value.Trim(); newUser.major = MajorIn.Value.Trim(); newUser.longNumber = LongNumIn.Value.Trim(); newUser.shortNumber = ShortNumIn.Value.Trim(); string[] columnArray = { "loginName", "realName", "groups", "roles", "grade", "school", "major", "longNumber", "shortNumber" }; ArrayList al = new ArrayList { newUser.loginName, newUser.realName, newUser.groups, newUser.roles, newUser.grade, newUser.school, newUser.major, newUser.longNumber, newUser.shortNumber }; try { userDal.insert(columnArray, newUser, al); scripthelp.Alert("添加" + newUser.realName + "成功!", Page); } catch(Exception ex) { ControlLog controlLog = new ControlLog("manager"); controlLog.WriteDebugLog("SubmitBtn_Click-添加"+newUser.realName+"人员失败", ex.ToString(), user.realName); scripthelp.Alert("添加" + newUser.realName + "失败!", Page); } GetListAfterGet(newUser.groups); } } else { scripthelp.Alert("姓名和届都不能空哦。", this.Page); scripthelp.RunScript(this.Page, "document.getElementById('edit').style.display='block'"); UserIn.Focus(); }//else }
protected void save_Click(object sender, EventArgs e) { string[] ids = Common.StringToArray(changeMenHid.Value); string[] colArray = { "roles", "grade", "school", "major", "longNumber", "shortNumber" }; int gross = 0; OA_users cUser = new OA_users(); try { for (int i = 0; i < userListRpt.Items.Count; i++) { cUser.id = Convert.ToInt32(ids[i]); string roles = ((HtmlInputText)userListRpt.Items[i].FindControl("roles")).Value.Trim(); if (roles == "负责人" | roles == "组长" | roles == "组员" | roles == "往届") { ArrayList al = new ArrayList {roles,((HtmlInputText)userListRpt.Items[i].FindControl("grade")).Value.Trim(), ((HtmlInputText)userListRpt.Items[i].FindControl("school")).Value.Trim(), ((HtmlInputText)userListRpt.Items[i].FindControl("major")).Value.Trim(), ((HtmlInputText)userListRpt.Items[i].FindControl("longNumber")).Value.Trim(), ((HtmlInputText)userListRpt.Items[i].FindControl("shortNumber")).Value.Trim()}; gross += userDal.Update(colArray, cUser, al); } else { scripthelp.Alert("职务只能是负责人或组长或组员或往届,请重新修改再保存!", Page); ((HtmlInputText)userListRpt.Items[i].FindControl("roles")).Focus(); return; } } if (gross == userListRpt.Items.Count) { scripthelp.Alert("保存修改成功!", Page); GetListAfterGet(GroupNameLitr.Text); DropListDataBind(); oldUserPager.CurrentPageIndex = 1; } } catch(Exception ex) { ControlLog controlLog = new ControlLog("manager"); controlLog.WriteDebugLog("save_Click-保存修改失败", ex.ToString(), user.realName); scripthelp.Alert("保存修改失败!", Page); } }