protected void btnSave_Click(object sender, EventArgs e) { if (hidid.Value != "0") { string path = MW.BasePage.GetWebPath + "/mw/onlinesurvey/" + hidid.Value + ".html"; MW.Common.FileHelper.WriteFile(Utils.GetMapPath(path), this.TextBox1.Text); MessageBox.AlertToUrl(this, "编辑成功!", "votelist.aspx"); } }
protected void btnSave_Click(object sender, EventArgs p1) { if (Id > 0) { #region __________Edit__________ model = bll.GetModel(Id); model.pxnum = txtpxnum.Text; model.N_CodeSurvey = txtN_CodeSurvey.Checked ? 1 : 0; model.C_Title = txtC_Title.Text; model.DT_StartDate = DateTime.Parse(StartTime.Text); model.C_Tearcher = txtC_Tearcher.Text.Trim(','); model.C_Adrees = txtC_Adrees.Text; model.C_Code = txtC_Code.Text; model.DT_OverDate = DateTime.Parse(EndTime.Text); model.C_ReturnUrl = txtC_ReturnUrl.Text; model.C_course = txtC_course.Text; model.N_Type = Utils.StrToInt(dropTypeId.SelectedValue, 0); model.N_SysId = Utils.StrToInt(drpVoteTmp.SelectedValue, 0); model.CourseStart = DateTime.Parse(txtCourseStart.Text); model.CourseEnd = DateTime.Parse(txtCourseEnd.Text); if (bll.Update(model)) { MessageBox.AlertToUrl(this, "修改保存成功!", "votelist.aspx"); } #endregion } else { #region __________Add__________ model.pxnum = txtpxnum.Text; model.N_SysId = Utils.StrToInt(drpVoteTmp.SelectedValue, 0); model.N_CodeSurvey = txtN_CodeSurvey.Checked ? 1 : 0; model.C_Title = txtC_Title.Text; model.DT_StartDate = DateTime.Parse(StartTime.Text); model.C_Tearcher = txtC_Tearcher.Text.Trim(','); model.C_Adrees = txtC_Adrees.Text; model.C_Code = txtC_Code.Text; model.DT_OverDate = DateTime.Parse(EndTime.Text); model.C_ReturnUrl = txtC_ReturnUrl.Text; model.C_course = txtC_course.Text; model.N_Type = Utils.StrToInt(dropTypeId.SelectedValue, 0); model.CourseStart = DateTime.Parse(txtCourseStart.Text); model.CourseEnd = DateTime.Parse(txtCourseEnd.Text); if (bll.Add(model)) { MessageBox.AlertToUrl(this, "保存成功!", "votelist.aspx"); } #endregion } }
protected void btnSave_Click(object sender, EventArgs p1) { if (Id > 0) { #region __________Edit__________ model = bll.GetModel(Id); model.remark = txtremark.Text; model.iconURL = txticonURL.Text; model.name = txtname.Text; model.version = txtversion.Text; model.apkurl = txtapkurl.Text; model.iosurl = txtiosurl.Text; model.brand = txtbrand.SelectedValue; model.proType = txtproType.SelectedValue; model.status = txtstatus.SelectedValue; model.pkgid = txtpkgid.Text; model.versionCode = model.versionCode + 1; if (bll.Update(model)) { //B_operationLog.CreateOperationLog(B_operationLog.operationLogType.Edit, "", ""); MessageBox.AlertToUrl(this, "保存成功!", "appplatform.aspx"); } #endregion } else { #region __________Add__________ model.remark = txtremark.Text; model.iconURL = txticonURL.Text; model.name = txtname.Text; model.version = txtversion.Text; model.apkurl = txtapkurl.Text; model.iosurl = txtiosurl.Text; model.brand = txtbrand.SelectedValue; model.proType = txtproType.SelectedValue; model.status = txtstatus.SelectedValue; model.pkgid = txtpkgid.Text; model.versionCode = 0; if (bll.Add(model)) { //B_operationLog.CreateOperationLog(B_operationLog.operationLogType.Add, "", ""); MessageBox.AlertToUrl(this, "新增保存成功!", "appplatform.aspx"); } #endregion } }
protected void rpt_List_ItemCommand(object source, RepeaterCommandEventArgs p1) { int num = int.Parse(p1.CommandArgument.ToString()); if (p1.CommandName == "lbtnDelete") { #warning delte IsPermissions(0x6c) if (!BasePage.IsPermissions(1)) { MessageBox.Alert(this, "没有删除权限!"); } else { bll.Delete(num); base.Response.Redirect(HttpContext.Current.Request.Url.PathAndQuery); } } else if (p1.CommandName == "lbtnCopy") { bll.CopyVote(num); MessageBox.AlertToUrl(this, "问卷复制成功", "MakeVote.aspx"); } }
protected void btnSave_Click(object sender, EventArgs p1) { string filepath = ""; //文件上传 if (this.fileFilePath.HasFile) { JUpload up = new JUpload(); up.FileSize = 10000; up.FileType = "image"; up.IsChangeName = true; string rev = up.SaveFile(fileFilePath, "/upLoads/info/"); string strMsg = ""; switch (rev) { case "0": strMsg = "上传文件格式不正确"; break; case "1": strMsg = "上传文件过大"; break; case "3": strMsg = "非法的图片"; break; } if (strMsg != "") { MessageBox.Alert(this, strMsg); return; } filepath = rev; } int addID = 0; if (Id > 0) { model = bll.GetModel(Id); //if (hidAidUsers.Value == "0") //{ // model.AId = MW.BLL.B_TBAdmin.AId; //} //else //{ // model.AId = int.Parse(hidAidUsers.Value); //} model.CreateTime = Utils.StrToDateTime(txtBeginTime.Text, DateTime.Now); model.UpdateTime = DateTime.Now; model.Title = txtTitle.Text; model.TypeId = dropTypeId.SelectedValue; model.ShareUsers = txtShareUsers.Text; model.Contents = Utils.HtmlEncode(txtContents.Text); model.Sort = int.Parse(txtSort.Text); model.fj = txtFj.Text; if (filepath != "") { model.FilePath = filepath; } // addID = Id; if (bll.Update(model)) { MessageBox.AlertToUrl(this, "保存成功!", hidurl.Value); //B_Operationlog.CreateOperationLog(BasePage.UId, B_Operationlog.operationLogType.Edit, "信息", model.Title); // MessageBox.JSLoad(this, "alert('保存成功!');location.href='infolist.aspx?typeId =" + Id + "'"); } } else { model.Audit = 1; model.RecoveryState = 0; //if (hidAidUsers.Value == "0") //{ model.AId = BasePage.UId.ToString(); //} //else //{ // model.AId = int.Parse(hidAidUsers.Value); //} model.ShareUsers = txtShareUsers.Text; model.UpdateTime = DateTime.Now; model.Title = txtTitle.Text; model.TypeId = dropTypeId.SelectedValue; model.Contents = Utils.HtmlEncode(txtContents.Text); model.FilePath = filepath; model.Sort = int.Parse(txtSort.Text); model.fj = txtFj.Text; model.CreateTime = Utils.StrToDateTime(txtBeginTime.Text, DateTime.Now); bool falg = bll.Add(model); if (falg) { MessageBox.AlertToUrl(this, "保存成功!", hidurl.Value); //B_Operationlog.CreateOperationLog(BasePage.UId, B_Operationlog.operationLogType.Add, "信息", model.Title); //MessageBox.JSLoad(this, "alert('保存成功!');location.href='infolist.aspx?typeId =" + Id + "'"); } } }
protected void rpt_List_ItemCommand(object source, RepeaterCommandEventArgs p1) { object num = p1.CommandArgument.ToString(); if (p1.CommandName == "lbtnDelete") { #warning delte IsPermissions(0x6c) if (!BasePage.IsPermissions(1)) { MessageBox.Alert(this, "没有删除权限!"); } else { bll.Delete(Utils.StrToInt(num, 0)); base.Response.Redirect(HttpContext.Current.Request.Url.PathAndQuery); } } else if (p1.CommandName == "lbtnBuild") { var arr = num.ToString().Split('|'); string votetemp = ""; if (FileHelper.FileExists(Utils.GetMapPath(BasePage.GetWebPath + "/mw/onlinesurvey/votetemplate_" + arr[0] + ".htm"))) { votetemp = FileHelper.ReadFile(Utils.GetMapPath(BasePage.GetWebPath + "/mw/onlinesurvey/votetemplate_" + arr[0] + ".htm")) + "\n";; } else { votetemp = FileHelper.ReadFile(Utils.GetMapPath(BasePage.GetWebPath + "/mw/onlinesurvey/votetemplate.htm")) + "\n"; } Build build = new Build(); var model = bll.GetModel(Utils.StrToInt(arr[0], 0)); votetemp = votetemp.Replace("{id}", model.Id.ToString()) .Replace("{path}", BasePage.GetWebPath) .Replace("{title}", model.C_Title) .Replace("{course}", model.C_course) .Replace("{teacher}", model.C_Tearcher) .Replace("{address}", model.C_Adrees) .Replace("{starttime}", model.DT_StartDate.ToShortDateString()) .Replace("{endtime}", model.DT_OverDate.ToShortDateString()) .Replace("{coursestarttime}", model.CourseStart.ToShortDateString()) .Replace("{courseendtime}", model.CourseEnd.ToShortDateString()); votetemp = votetemp.Replace("{Content}", build.PubBuildHtml(model.Id, Utils.StrToInt(arr[1], 0))).Replace("{Images}", BasePage.GetWebPath + "/mw/onlinesurvey/SysImages"); if (votetemp.IndexOf("{QR}", StringComparison.OrdinalIgnoreCase) > 0) { this.CreateQR(model.N_SysId); votetemp = votetemp.Replace("{QR}", string.Concat(new object[] { "<img src=\"", BasePage.GetWebPath, "/mw/onlinesurvey/qr/", model.Id, ".gif\" width=\"100\" height=\"100\" />" })); } if (FileHelper.FileExists(Utils.GetMapPath(BasePage.GetWebPath + "/mw/onlinesurvey/" + arr[0] + ".html"))) { System.IO.File.Delete(Utils.GetMapPath(BasePage.GetWebPath + "/mw/onlinesurvey/" + arr[0] + ".html")); } FileHelper.WriteFile(Utils.GetMapPath(BasePage.GetWebPath + "/mw/onlinesurvey/" + arr[0] + ".html"), votetemp); MessageBox.Alert(this, "生成投票问卷成功!"); } else if (p1.CommandName == "lbtnCopy") { bll.CopyVote(Utils.StrToInt(num, 0)); MessageBox.AlertToUrl(this, "调查复制成功", "votelist.aspx"); } }