/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { //Rights if (Permissions.GetPermissions(EnumCompanyPermission.SystemQishuVSdate) != 6221) { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001734", "对不起,您没有修改权限!"))); return; } else { //更改数据字典的值 int updCount = SetDataOrExpectNumBLL.UpdFileValueByCode(Convert.ToInt32(this.RadioQishuDate.SelectedValue)); if (updCount > 0) { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("000222", "修改成功!"))); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001740", "修改失败,请联系管理员!"))); return; } } }
/// <summary> /// 导出Excel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnExcel_Click(object sender, EventArgs e) { DataTable dt = SetDataOrExpectNumBLL.GetAllExpectNumDateFromConfig(); if (dt.Rows.Count < 1) { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001712", "对不起,没有可以导出的数据!"))); return; } else { Excel.OutToExcel(dt, GetTran("001745", "期数对应日期信息"), new string[] { "ExpectNum=" + GetTran("000045", "期数"), "Date=" + GetTran("000613", "日期") }); } }
private void getInfo() { ///从结算表中获取所有的日期和期数 DataTable dt = SetDataOrExpectNumBLL.GetAllExpectNumDateFromConfig(); ViewState["sorttable"] = dt; DataView dv = new DataView(dt); if (ViewState["sortstring"] == null) { ViewState["sortstring"] = "ExpectNum asc"; } dv.Sort = ViewState["sortstring"].ToString(); this.gvExpectNumDate.DataSource = dv; this.gvExpectNumDate.DataBind(); Translations_More(); }
/// <summary> /// 更新 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvExpectNumDate_RowUpdating(object sender, GridViewUpdateEventArgs e) { int EdCount = 0; ///修改期数时间权限 EdCount = Permissions.GetPermissions(EnumCompanyPermission.SystemQishuVSdateEdit); if (EdCount.ToString() == "6222") { int index = e.RowIndex; string Date = ((TextBox)gvExpectNumDate.Rows[index].FindControl("TextBox1")).Text.Trim(); int expectNum = Convert.ToInt32(gvExpectNumDate.Rows[index].Cells[0].Text.Trim()); ChangeLogs cl = new ChangeLogs("config", "ltrim(rtrim(str(ExpectNum)))"); CommonDataBLL commonDataBLL = new CommonDataBLL(); cl.AddRecord(expectNum); try { string stardate = ((TextBox)gvExpectNumDate.Rows[index].FindControl("txtStar")).Text.Trim(); string enddate = ((TextBox)gvExpectNumDate.Rows[index].FindControl("txtEnd")).Text.Trim(); if (Date == "" || stardate == "" || enddate == "") { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001720", "对不起,时间不能为空!"))); return; } else { ///根据期数更改结算表中的日期 int updCount = SetDataOrExpectNumBLL.UpdDateByExpectNum(Date, expectNum, stardate, enddate); if (updCount > 0) { cl.AddRecord(expectNum); cl.ModifiedIntoLogs(ChangeCategory.company37, Session["Company"].ToString(), ENUM_USERTYPE.objecttype9); Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001723", "修改时间成功!"))); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001727", "修改时间失败,请联系管理员!"))); return; } gvExpectNumDate.EditIndex = -1; this.getInfo(); } } catch { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001922", "日期格式有问题"))); return; } } else { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001734", "对不起,您没有修改权限!"))); return; } }