private bool DoEdit(int _id) { try { BLL.article_category bll = new BLL.article_category(); Model.article_category model = bll.GetModel(_id); int parentId = int.Parse(ddlParentId.SelectedValue); model.channel_id = this.channel_id; model.call_index = txtCallIndex.Text.Trim(); model.title = txtTitle.Text.Trim(); //如果选择的父ID不是自己,则更改 if (parentId != model.id) { model.parent_id = parentId; } model.sort_id = int.Parse(txtSortId.Text.Trim()); model.seo_title = txtSeoTitle.Text; model.seo_keywords = txtSeoKeywords.Text; model.seo_description = txtSeoDescription.Text; model.content = txtContent.Value; model.is_page = int.Parse(rblPage.SelectedValue); model.is_lock = int.Parse(rblStatus.SelectedValue); //判断上传图片 if (this.imgUpload.HasFile) { //上传前先删除原图片 if (!string.IsNullOrEmpty(model.img_url)) { Utils.DeleteFile(model.img_url); } Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.img_url = upfile.path; } } else { //判断是否需要删除原图 if (!string.IsNullOrEmpty(model.img_url)) { Utils.DeleteFile(model.img_url); } model.img_url = txtImgUrl.Text.Trim(); } if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道栏目分类:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
private bool DoEdit(int _id) { bool result = false; BLL.link bll = new BLL.link(); Model.link model = bll.GetModel(_id); model.site_path = ddlSitePath.SelectedValue; model.title = txtTitle.Text.Trim(); model.is_lock = Utils.StrToInt(rblIsLock.SelectedValue, 0); if (cbIsRed.Checked == true) { model.is_red = 1; } else { model.is_red = 0; } model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.user_name = txtUserName.Text.Trim(); model.user_tel = txtUserTel.Text.Trim(); model.email = txtEmail.Text.Trim(); model.site_url = txtSiteUrl.Text.Trim(); model.is_image = 1; if (string.IsNullOrEmpty(model.img_url)) { model.is_image = 0; } //判断上传图片 if (this.imgUpload.HasFile) { //上传前先删除原图片 if (!string.IsNullOrEmpty(model.img_url)) { Utils.DeleteFile(model.img_url); } DTcms.Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.img_url = upfile.path; } } else { //判断是否需要删除原图 if (txtImgUrl.Text.Trim() == "" && !string.IsNullOrEmpty(model.img_url)) { Utils.DeleteFile(model.img_url); } model.img_url = txtImgUrl.Text.Trim(); } if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改友情链接:" + model.title); //记录日志 result = true; } return(result); }
private bool DoAdd() { try { Model.navigation model = new Model.navigation(); BLL.navigation bll = new BLL.navigation(); model.nav_type = DTEnums.NavigationEnum.System.ToString(); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); model.sub_title = txtSubTitle.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.is_lock = 0; if (cbIsLock.Checked == true) { model.is_lock = 1; } model.remark = txtRemark.Text.Trim(); model.parent_id = int.Parse(ddlParentId.SelectedValue); //添加操作权限类型 string action_type_str = string.Empty; for (int i = 0; i < cblActionType.Items.Count; i++) { if (cblActionType.Items[i].Selected && Utils.ActionType().ContainsKey(cblActionType.Items[i].Value)) { action_type_str += cblActionType.Items[i].Value + ","; } } model.action_type = Utils.DelLastComma(action_type_str); //判断上传图片 if (this.imgUpload.HasFile) { Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.icon_url = upfile.path; } } else { model.icon_url = txtIconUrl.Text.Trim(); } if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加导航菜单:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
private bool DoEdit(int _id) { try { BLL.menu bll = new BLL.menu(); Model.menu model = bll.GetModel(_id); model.title = txtName.Text; model.link_url = txtUrl.Text; //如果选择的父ID不是自己,则更改 int parentId = int.Parse(ddlParentId.SelectedValue); if (parentId != model.id) { model.parent_id = parentId; } model.open_mode = rblMode.SelectedValue; model.is_lock = int.Parse(rblHide.SelectedValue); model.sort_id = Utils.StrToInt(txtSort.Text, 99); model.css_txt = txtCssTxt.Text; //判断上传图片 if (this.imgUpload.HasFile) { //上传前先删除原图片 if (!string.IsNullOrEmpty(model.img_url)) { Utils.DeleteFile(model.img_url); } Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.img_url = upfile.path; } } else { //判断是否需要删除原图 if (txtIconUrl.Text.Trim() == "" && !string.IsNullOrEmpty(model.img_url)) { Utils.DeleteFile(model.img_url); } model.img_url = txtIconUrl.Text.Trim(); } if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改菜单内容:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
private bool DoAdd() { try { Model.article_category model = new Model.article_category(); BLL.article_category bll = new BLL.article_category(); model.site_id = new BLL.channel().GetSiteId(this.channel_id); model.channel_id = this.channel_id; model.call_index = txtCallIndex.Text.Trim(); model.title = txtTitle.Text.Trim(); model.parent_id = int.Parse(ddlParentId.SelectedValue); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.seo_title = txtSeoTitle.Text; model.seo_keywords = txtSeoKeywords.Text; model.seo_description = txtSeoDescription.Text; model.link_url = txtLinkUrl.Text.Trim(); model.content = txtContent.Value; model.is_page = int.Parse(rblPage.SelectedValue); model.is_lock = int.Parse(rblStatus.SelectedValue); //判断上传图片 if (this.imgUpload.HasFile) { Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.img_url = upfile.path; } } else { model.img_url = txtImgUrl.Text.Trim(); } //获取管理员 int rolo_id = 0; Model.manager adminModel = GetAdminInfo(); if (adminModel.role_type != 1) { rolo_id = adminModel.role_id; } if (bll.Add(model, rolo_id) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加" + this.channel_name + "频道栏目分类:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
private bool DoEdit(int _id) { try { BLL.images bll = new BLL.images(); Model.images model = bll.GetModel(_id); model.title = txtName.Text; model.link_url = txtUrl.Text; model.img_url = txtImgUrl.Text; model.is_lock = int.Parse(rblHide.SelectedValue); model.sort_id = Utils.StrToInt(txtSort.Text, 99); model.back_color = txtColor.Text; model.content = txtContent.Value; model.sign = txtSign.Text; //判断上传图片 if (this.imgUpload.HasFile) { //上传前先删除原图片 if (!string.IsNullOrEmpty(model.img_url)) { Utils.DeleteFile(model.img_url); } DTcms.Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.img_url = upfile.path; } } else { //判断是否需要删除原图 if (txtImgUrl.Text.Trim() == "" && !string.IsNullOrEmpty(model.img_url)) { Utils.DeleteFile(model.img_url); } model.img_url = txtImgUrl.Text.Trim(); } if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改图片信息" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
private bool DoEdit(int _id) { bool result = false; BLL.advert_banner bll = new BLL.advert_banner(); Model.advert_banner model = bll.GetModel(_id); model.aid = int.Parse(ddlAdvertId.SelectedValue); model.title = txtTitle.Text.Trim(); model.start_time = DateTime.Parse(this.txtStartTime.Text.Trim()); model.end_time = DateTime.Parse(this.txtEndTime.Text.Trim()); model.link_url = txtLinkUrl.Text.Trim(); model.target = rblTarget.SelectedValue; model.content = txtContent.Text; model.sort_id = int.Parse(txtSortId.Text.Trim()); model.is_lock = int.Parse(rblIsLock.SelectedValue); this.aid = model.aid; //判断上传图片 if (this.imgUpload.HasFile) { //上传前先删除原图片 if (!string.IsNullOrEmpty(model.file_path)) { Utils.DeleteFile(model.file_path); } DTcms.Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.file_path = upfile.path; } } else { //判断是否需要删除原图 if (txtFilePath.Text.Trim() == "" && !string.IsNullOrEmpty(model.file_path)) { Utils.DeleteFile(model.file_path); } model.file_path = txtFilePath.Text.Trim(); } if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改广告内容:" + model.title); //记录日志 result = true; } return(result); }
private bool DoAdd() { try { BLL.images bll = new BLL.images(); Model.images model = new Model.images(); model.title = txtName.Text; model.link_url = txtUrl.Text; model.img_url = txtImgUrl.Text; model.is_lock = int.Parse(rblHide.SelectedValue); model.sort_id = Utils.StrToInt(txtSort.Text, 99); model.add_time = DateTime.Now; model.back_color = txtColor.Text; model.content = txtContent.Value; model.sign = txtSign.Text; //判断上传图片 if (this.imgUpload.HasFile) { DTcms.Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.img_url = upfile.path; } } else { model.img_url = txtImgUrl.Text.Trim(); } if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "添加图片信息" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
private bool DoAdd() { try { BLL.menu bll = new BLL.menu(); Model.menu model = new Model.menu(); model.title = txtName.Text; model.link_url = txtUrl.Text; model.parent_id = int.Parse(ddlParentId.SelectedValue); model.open_mode = rblMode.SelectedValue; model.is_lock = int.Parse(rblHide.SelectedValue); model.sort_id = Utils.StrToInt(txtSort.Text, 99); model.css_txt = txtCssTxt.Text; //判断上传图片 if (this.imgUpload.HasFile) { Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.img_url = upfile.path; } } else { model.img_url = txtIconUrl.Text.Trim(); } model.add_time = DateTime.Now; if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "添加菜单内容:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
private bool DoAdd() { bool result = false; Model.advert_banner model = new Model.advert_banner(); BLL.advert_banner bll = new BLL.advert_banner(); model.aid = int.Parse(ddlAdvertId.SelectedValue); model.title = txtTitle.Text.Trim(); model.start_time = DateTime.Parse(this.txtStartTime.Text.Trim()); model.end_time = DateTime.Parse(this.txtEndTime.Text.Trim()); model.target = rblTarget.SelectedValue; model.link_url = txtLinkUrl.Text.Trim(); model.content = txtContent.Text; model.sort_id = int.Parse(txtSortId.Text.Trim()); model.is_lock = int.Parse(rblIsLock.SelectedValue); model.add_time = DateTime.Now; this.aid = model.aid; //判断上传图片 if (this.imgUpload.HasFile) { DTcms.Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.file_path = upfile.path; } } else { model.file_path = txtFilePath.Text.Trim(); } if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加广告内容:" + model.title); //记录日志 result = true; } return(result); }
private bool DoEdit(int _id) { try { BLL.navigation bll = new BLL.navigation(); Model.navigation model = bll.GetModel(_id); model.name = txtName.Text.Trim(); model.title = txtTitle.Text.Trim(); model.sub_title = txtSubTitle.Text.Trim(); model.link_url = txtLinkUrl.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.is_lock = 0; if (cbIsLock.Checked == true) { model.is_lock = 1; } model.remark = txtRemark.Text.Trim(); if (model.is_sys == 0) { int parentId = int.Parse(ddlParentId.SelectedValue); //如果选择的父ID不是自己,则更改 if (parentId != model.id) { model.parent_id = parentId; } } //添加操作权限类型 string action_type_str = string.Empty; for (int i = 0; i < cblActionType.Items.Count; i++) { if (cblActionType.Items[i].Selected && Utils.ActionType().ContainsKey(cblActionType.Items[i].Value)) { action_type_str += cblActionType.Items[i].Value + ","; } } model.action_type = Utils.DelLastComma(action_type_str); //判断上传图片 if (this.imgUpload.HasFile) { //上传前先删除原图片 if (!string.IsNullOrEmpty(model.icon_url)) { Utils.DeleteFile(model.icon_url); } Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.icon_url = upfile.path; } } else { //判断是否需要删除原图 if (txtIconUrl.Text.Trim() == "" && !string.IsNullOrEmpty(model.icon_url)) { Utils.DeleteFile(model.icon_url); } model.icon_url = txtIconUrl.Text.Trim(); } if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "修改导航菜单:" + model.title); //记录日志 return(true); } } catch { return(false); } return(false); }
private bool DoEdit(int _id) { bool result = false; BLL.channel_site bll = new BLL.channel_site(); Model.channel_site model = bll.GetModel(_id); model.title = txtTitle.Text.Trim(); model.build_path = txtBuildPath.Text.Trim(); model.domain = txtDomain.Text.Trim(); model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); if (cbIsDefault.Checked == true) { model.is_default = 1; } else { model.is_default = 0; } if (cbIsMobile.Checked == true) { model.is_mobile = 1; } else { model.is_mobile = 0; } model.inherit_id = int.Parse(ddlSiteId.SelectedValue); model.name = txtName.Text.Trim(); model.company = txtCompany.Text.Trim(); model.address = txtAddress.Text.Trim(); model.tel = txtTel.Text.Trim(); model.fax = txtFax.Text.Trim(); model.email = txtEmail.Text.Trim(); model.crod = txtCrod.Text.Trim(); model.seo_title = txtSeoTitle.Text.Trim(); model.seo_keyword = txtSeoKeyword.Text.Trim(); model.seo_description = Utils.DropHTML(txtSeoDescription.Text); model.copyright = txtCopyright.Text.Trim(); //判断上传图片 if (this.imgUpload.HasFile) { //上传前先删除原图片 if (!string.IsNullOrEmpty(model.logo)) { Utils.DeleteFile(model.logo); } Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.logo = upfile.path; } } else { //判断是否需要删除原图 if (txtLogo.Text.Trim() == "" && !string.IsNullOrEmpty(model.logo)) { Utils.DeleteFile(model.logo); } model.logo = txtLogo.Text.Trim(); } //百度推送 if (bdSend.Checked == true) { model.bdsend = 1; } else { model.bdsend = 0; } model.bdtoken = bdToken.Text.Trim(); if (bll.Update(model)) { //更新一下域名缓存 CacheHelper.Remove(DTKeys.CACHE_SITE_HTTP_DOMAIN); AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改站点:" + model.title); //记录日志 result = true; } return(result); }
/// <summary> /// 保存配置信息 /// </summary> protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("sys_config", DTEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.siteconfig bll = new BLL.siteconfig(); Model.siteconfig model = bll.loadConfig(); try { model.webname = webname.Text; model.weburl = weburl.Text; model.webcompany = webcompany.Text; model.webaddress = webaddress.Text; model.webtel = webtel.Text; model.webfax = webfax.Text; model.webmail = webmail.Text; model.webcrod = webcrod.Text; model.webpath = webpath.Text; string managepath = webmanagepath.Text; if (model.webmanagepath != managepath) { new BLL.navigation().updateicon(model.webmanagepath, managepath); model.webmanagepath = managepath; } model.staticstatus = Utils.StrToInt(staticstatus.SelectedValue, 0); model.staticextension = staticextension.Text; if (memberstatus.Checked == true) { model.memberstatus = 1; } else { model.memberstatus = 0; } if (commentstatus.Checked == true) { model.commentstatus = 1; } else { model.commentstatus = 0; } if (logstatus.Checked == true) { model.logstatus = 1; } else { model.logstatus = 0; } if (webstatus.Checked == true) { model.webstatus = 1; } else { model.webstatus = 0; } model.webclosereason = webclosereason.Text; model.webcountcode = webcountcode.Text; model.smsapiurl = smsapiurl.Text; model.smsusername = smsusername.Text; //判断密码是否更改 if (smspassword.Text.Trim() != "" && smspassword.Text.Trim() != defaultpassword) { model.smspassword = smspassword.Text.Trim(); } model.smssubmit = smssubmit.Text; model.smssendpara = smssendpara.Text.Trim(); model.smssign = Utils.StrToInt(smssign.SelectedValue, 0); model.smssigntxt = smssigntxt.Text.Trim(); model.smssendanswer = Utils.StrToInt(smssendanswer.SelectedValue, 0); model.smssendcode = smssendcode.Text.Trim(); model.smssendlable = smssendlable.Text.Trim(); model.smsmark = smsmark.Text.Trim(); model.smssendcount = Utils.StrToInt(smssendcount.Text.Trim(), 10); model.smsqueryapiurl = smsqueryapiurl.Text.Trim(); model.smsquerypara = smsquerypara.Text.Trim(); model.smsqueryanswer = Utils.StrToInt(smsqueryanswer.SelectedValue, 0); model.smsquerycode = smsquerycode.Text.Trim(); model.smsqueryformat = smsqueryformat.Text.Trim(); model.smserrorcode = smserrorcode.Text.Trim(); model.emailsmtp = emailsmtp.Text; if (emailssl.Checked == true) { model.emailssl = 1; } else { model.emailssl = 0; } model.emailport = Utils.StrToInt(emailport.Text.Trim(), 25); model.emailfrom = emailfrom.Text; model.emailusername = emailusername.Text; //判断密码是否更改 if (emailpassword.Text.Trim() != defaultpassword) { model.emailpassword = DESEncrypt.Encrypt(emailpassword.Text, model.sysencryptstring); } model.emailnickname = emailnickname.Text; model.filepath = filepath.Text; model.filesave = Utils.StrToInt(filesave.SelectedValue, 2); model.fileremote = Utils.StrToInt(fileremote.SelectedValue, 0); model.imgextension = imgextension.Text.Trim(); model.fileextension = fileextension.Text; model.videoextension = videoextension.Text; model.attachsize = Utils.StrToInt(attachsize.Text.Trim(), 0); model.videosize = Utils.StrToInt(videosize.Text.Trim(), 0); model.imgsize = Utils.StrToInt(imgsize.Text.Trim(), 0); model.imgmaxheight = Utils.StrToInt(imgmaxheight.Text.Trim(), 0); model.imgmaxwidth = Utils.StrToInt(imgmaxwidth.Text.Trim(), 0); model.thumbnailheight = Utils.StrToInt(thumbnailheight.Text.Trim(), 0); model.thumbnailwidth = Utils.StrToInt(thumbnailwidth.Text.Trim(), 0); model.thumbnailmode = thumbnailmode.SelectedValue; model.watermarktype = Utils.StrToInt(watermarktype.SelectedValue, 0); model.watermarkposition = Utils.StrToInt(watermarkposition.Text.Trim(), 9); int quality = Utils.StrToInt(watermarkimgquality.Text.Trim(), 80); if (quality < 10) { quality = 10; } else if (quality > 100) { quality = 100; } model.watermarkimgquality = quality; //判断上传图片 if (this.imgUpload.HasFile) { //上传前先删除原图片 if (!string.IsNullOrEmpty(model.watermarkpic)) { Utils.DeleteFile(model.watermarkpic); } Model.upLoad upfile = new Web.UI.UpLoad().fileSaveAs(this.imgUpload.PostedFile, 0, false, false); if (upfile.status > 0) { model.watermarkpic = upfile.path; } } else { //判断是否需要删除原图 if (watermarkpic.Text.Trim() == "" && !string.IsNullOrEmpty(model.watermarkpic)) { Utils.DeleteFile(model.watermarkpic); } model.watermarkpic = watermarkpic.Text.Trim(); } model.watermarktransparency = Utils.StrToInt(watermarktransparency.Text.Trim(), 5); model.watermarktext = watermarktext.Text; model.watermarkfont = watermarkfont.Text; model.watermarkfontsize = Utils.StrToInt(watermarkfontsize.Text.Trim(), 12); if (chbFomatPage.Checked == true) { model.fomatpage = 1; } else { model.fomatpage = 0; } if (chbPageCache.Checked == true) { model.pagecache = 1; } else { model.pagecache = 0; } model.cachetime = Utils.StrToInt(txtCacheTime.Text.Trim(), 30); model.cachefix = txtCacheFix.Text.Trim(); model.deltable = Utils.StrToInt(rblDelTable.SelectedValue, 0); model.author = txtAuthor.Text.Trim(); model.source = txtSource.Text.Trim(); bll.saveConifg(model); AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改系统配置信息"); //记录日志 JscriptMsg("修改系统配置成功!", "sys_config.aspx"); } catch { JscriptMsg("文件写入失败,请检查文件夹权限!", ""); } }