protected void btnSave_Click(object sender, EventArgs p1) { //int typeid = 0; if (Id > 0) { model = bll.GetModel(Id); if (this.FileUpload1.HasFile && model.ImagePath != "") { Utils.DelFile(model.ImagePath); } //typeid = model.TypeID; } model.TeacherIds = hidtearcherid.Value; model.EvalAble = txtAddress.Text; model.TRAIN_ID = hidUsersId.Value; model.State = int.Parse(rbltStatus.SelectedValue); model.TypeID = int.Parse(dropTypeId.Text); model.IsTop = chkIsTop.Checked ? 1 : 0; model.IsRecommend = chkIsRecommend.Checked ? 1 : 0; model.PlanName = txtPlanName.Text; model.Descrip = txtDescrip.Text; model.BEGIN_TIME = DateTime.Parse(txtBeginTime.Text); model.END_TIME = DateTime.Parse(txtEndTime.Text); model.ApplyNum = Utils.StrToInt(txtApplyNum.Text, 0); model.KeyWords = txtCode.Text; if (this.FileUpload1.HasFile) { JUpload up = new JUpload(); up.FileSize = 1000; up.FileType = "image"; string rev = up.SaveFile(FileUpload1, "/UpLoads/TrainingPlans/"); string strMsg = ""; switch (rev) { case "0": strMsg = "上传文件格式不正确"; break; case "1": strMsg = "上传文件过大"; break; case "3": strMsg = "非法的图片"; break; } if (strMsg != "") { MessageBox.Alert(this, strMsg); return; } model.ImagePath = rev; } if (Id > 0) { #region __________Edit__________ if (bll.Update(model)) { //B_operationLog.CreateOperationLog(B_operationLog.operationLogType.Edit, "", ""); MessageBox.JSLoad(this, "alert('保存成功!');reloadDlg(true);"); } #endregion } else { model.CREATE_TIME = DateTime.Now; bool rv = bll.Add(model); if (rv) { //B_operationLog.CreateOperationLog(B_operationLog.operationLogType.Add, "", ""); MessageBox.JSLoad(this, "alert('保存成功!');reloadDlg(true);"); } } }
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 btnSave_Click(object sender, EventArgs p1) { string filepath = ""; //文件上传 if (this.fileFilePath.HasFile) { JUpload up = new JUpload(); up.FileSize = 10000; up.FileType = "image"; up.IsChangeName = false; string rev = up.SaveFile(fileFilePath, "/UpLoads/wk/"); 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 = DateTime.Now; model.Title = txtTitle.Text; model.Cid = int.Parse(dropTypeId.SelectedValue); model.Content = Utils.HtmlEncode(txtContents.Text); model.OderBy = int.Parse(txtSort.Text); model.A3 = txtFj.Text; if (filepath != "") { model.A4 = filepath; } if (bll.Update(model)) { //B_Operationlog.CreateOperationLog(BasePage.UId, B_Operationlog.operationLogType.Edit, "信息", model.Title); MessageBox.JSLoad(this, "alert('保存成功!');location.href='wklist.aspx?cid =" + typeid + "'"); } } else { model.CreateTime = DateTime.Now; model.Title = txtTitle.Text; model.Cid = Utils.StrToInt(dropTypeId.SelectedValue, 0); model.Content = Utils.HtmlEncode(txtContents.Text); model.A4 = filepath; model.OderBy = int.Parse(txtSort.Text); model.A3 = txtFj.Text; model.CreateTime = DateTime.Now; bool falg = bll.Add(model); if (falg) { //B_Operationlog.CreateOperationLog(BasePage.UId, B_Operationlog.operationLogType.Add, "信息", model.Title); MessageBox.JSLoad(this, "alert('新增成功!');window.location.href='wklist.aspx?cid =" + typeid + "'"); } } }