private bool DoAdd() { bool result = false; Model.user_oauth_app model = new Model.user_oauth_app(); BLL.user_oauth_app bll = new BLL.user_oauth_app(); model.title = txtTitle.Text.Trim(); if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } model.is_mobile = Utils.StrToInt(rblIsMobile.SelectedValue, 0); model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.api_path = txtApiPath.Text.Trim(); model.app_id = txtAppId.Text.Trim(); model.app_key = txtAppKey.Text.Trim(); model.img_url = txtImgUrl.Text.Trim(); model.remark = txtRemark.Text; if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加OAuth信息:" + model.title); //记录日志 result = true; } return(result); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("user_oauth", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.user_oauth_app bll = new BLL.user_oauth_app(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除OAuth配置成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("oauth_app_list.aspx", "keywords={0}", this.keywords)); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("user_oauth", MXEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; int errorCount = 0; BLL.user_oauth_app bll = new BLL.user_oauth_app(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { sucCount += 1; } else { errorCount += 1; } } } AddAdminLog(MXEnums.ActionEnum.Delete.ToString(), "删除OAuth配置成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("oauth_app_list.aspx", "keywords={0}", this.keywords), "Success"); }
private bool DoEdit(int _id) { bool result = false; BLL.user_oauth_app bll = new BLL.user_oauth_app(); Model.user_oauth_app model = bll.GetModel(_id); model.title = txtTitle.Text.Trim(); if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } model.sort_id = int.Parse(txtSortId.Text.Trim()); model.api_path = txtApiPath.Text.Trim(); model.app_id = txtAppId.Text.Trim(); model.app_key = txtAppKey.Text.Trim(); model.img_url = txtImgUrl.Text.Trim(); model.remark = txtRemark.Text; if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改OAuth信息:" + model.title); //记录日志 result = true; } return(result); }
private bool DoAdd() { bool result = false; Model.user_oauth_app model = new Model.user_oauth_app(); BLL.user_oauth_app bll = new BLL.user_oauth_app(); model.title = txtTitle.Text.Trim(); if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } model.is_mobile = Utils.StrToInt(rblIsMobile.SelectedValue, 0); model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.api_path = txtApiPath.Text.Trim(); model.app_id = txtAppId.Text.Trim(); model.app_key = txtAppKey.Text.Trim(); model.img_url = txtImgUrl.Text.Trim(); model.remark = txtRemark.Text; if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加OAuth信息:" + model.title); //记录日志 result = true; } return result; }
private bool DoAdd() { bool result = false; Model.user_oauth_app model = new Model.user_oauth_app(); BLL.user_oauth_app bll = new BLL.user_oauth_app(); model.title = txtTitle.Text.Trim(); if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } model.sort_id = int.Parse(txtSortId.Text.Trim()); model.api_path = txtApiPath.Text.Trim(); model.app_id = txtAppId.Text.Trim(); model.app_key = txtAppKey.Text.Trim(); model.img_url = txtImgUrl.Text.Trim(); model.remark = txtRemark.Text; if (bll.Add(model) > 0) { AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Add.ToString(), "添加OAuth信息:" + model.title); //记录日志 result = true; } return(result); }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; BLL.user_oauth_app bll = new BLL.user_oauth_app(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("oauth_app_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void RptBind(string _strWhere, string _orderby) { this.page = MXRequest.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; BLL.user_oauth_app bll = new BLL.user_oauth_app(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("oauth_app_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("user_oauth", DTEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.user_oauth_app bll = new BLL.user_oauth_app(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "sort_id=" + sortId.ToString()); } AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存OAuth配置排序"); //记录日志 JscriptMsg("保存排序成功!", "oauth_app_list.aspx"); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("user_oauth", MXEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.user_oauth_app bll = new BLL.user_oauth_app(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "sort_id=" + sortId.ToString()); } AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "保存OAuth配置排序"); //记录日志 JscriptMsg("保存排序成功!", "oauth_app_list.aspx", "Success"); }
/// <summary> /// 获取OAuth配置信息 /// </summary> /// <param name="oauth_name"></param> public static oauth_config get_config(string oauth_name) { //读取接口配置信息 Model.user_oauth_app model = new BLL.user_oauth_app().GetModel(oauth_name); if (model != null) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //赋值 oauth_config config = new oauth_config(); config.oauth_name = model.api_path.Trim(); config.oauth_app_id = model.app_id.Trim(); config.oauth_app_key = model.app_key.Trim(); config.return_uri = HttpContext.Current.Request.Url.Authority.ToLower() + siteConfig.webpath + "api/oauth/" + model.api_path + "/return_url.aspx"; return config; } return null; }
/// <summary> /// 获取OAuth配置信息 /// </summary> /// <param name="oauth_name"></param> public static oauth_config get_config(string oauth_name) { //读取接口配置信息 Model.user_oauth_app model = new BLL.user_oauth_app().GetModel(oauth_name); if (model != null) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //赋值 oauth_config config = new oauth_config(); config.oauth_name = model.api_path.Trim(); config.oauth_app_id = model.app_id.Trim(); config.oauth_app_key = model.app_key.Trim(); config.return_uri = HttpContext.Current.Request.Url.Authority.ToLower() + siteConfig.webpath + "api/oauth/" + model.api_path + "/return_url.aspx"; return(config); } return(null); }
private void ShowInfo(int _id) { BLL.user_oauth_app bll = new BLL.user_oauth_app(); Model.user_oauth_app model = bll.GetModel(_id); txtTitle.Text = model.title; if (model.is_lock == 0) { cbIsLock.Checked = true; } else { cbIsLock.Checked = false; } txtSortId.Text = model.sort_id.ToString(); txtApiPath.Text = model.api_path; txtAppId.Text = model.app_id; txtAppKey.Text = model.app_key; txtImgUrl.Text = model.img_url; txtRemark.Text = model.remark; }
private bool DoEdit(int _id) { bool result = false; BLL.user_oauth_app bll = new BLL.user_oauth_app(); Model.user_oauth_app model = bll.GetModel(_id); model.title = txtTitle.Text.Trim(); if (cbIsLock.Checked == true) { model.is_lock = 0; } else { model.is_lock = 1; } model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.api_path = txtApiPath.Text.Trim(); model.app_id = txtAppId.Text.Trim(); model.app_key = txtAppKey.Text.Trim(); model.img_url = txtImgUrl.Text.Trim(); model.remark = txtRemark.Text; if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改OAuth信息:" + model.title); //记录日志 result = true; } return result; }