提交代码

This commit is contained in:
2024-01-17 16:12:42 +08:00
parent 66a56a44af
commit 74e2a00958
49 changed files with 4594 additions and 715 deletions
@@ -1,5 +1,10 @@
using BLL;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.TestRun.DriverPrepare
{
@@ -15,41 +20,56 @@ namespace FineUIPro.Web.TestRun.DriverPrepare
{
if (!IsPostBack)
{
BLL.UserService.InitUserDropDownList(this.drpCompileMan, this.CurrUser.LoginProjectId, true);
string id = Request.Params["id"];
if (!string.IsNullOrEmpty(id))
{
Model.DriverPrepare_Duty data = BLL.DriverPrepareDutyService.GetDriverPlanById(id);
if (data != null)
BindGrid();
}
else
{
var list = DriverPrepareDutyItemService.GetLists("Empty");
if (list.Count == 0)
{
this.hdId.Text = id;
this.txtCode.Text = data.DutyCode;
this.txtName.Text = data.DutyName;
if (!string.IsNullOrEmpty(data.CompileMan))
{
this.drpCompileMan.SelectedValue = data.CompileMan;
}
this.txtCompileDate.Text = data.CompileDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.CompileDate) : "";
this.txtRemark.Text = data.Remark;
DriverPrepareDutyItemService.CreateDutyItems();
}
BindGrid();
}
}
}
#endregion
#region
#region
//加载列表
public void BindGrid()
{
string strSql = @"select * from DriverPrepare_DutyItem chec"
+ @" where chec.DutyId=@DutyId";
List<SqlParameter> listStr = new List<SqlParameter>();
string id = "Empty";
if (!string.IsNullOrEmpty(Request.Params["id"]))
{
id = Request.Params["id"];
}
listStr.Add(new SqlParameter("@DutyId", id));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
//tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
#endregion
#region
/// <summary>
/// 附件上传
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAttach_Click(object sender, EventArgs e)
protected void Grid1_Sort(object sender, GridSortEventArgs e)
{
if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录
{
this.hdId.Text = SQLHelper.GetNewID(typeof(Model.DriverPrepare_Duty));
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverPrepare/Duty&menuId={1}", this.hdId.Text, BLL.Const.DutyMenuId)));
this.BindGrid();
}
#endregion
@@ -63,14 +83,8 @@ namespace FineUIPro.Web.TestRun.DriverPrepare
{
string id = Request.Params["id"];
Model.DriverPrepare_Duty newData = new Model.DriverPrepare_Duty();
newData.DutyCode = this.txtCode.Text.Trim();
newData.DutyName = this.txtName.Text.Trim();
if (this.drpCompileMan.SelectedValue != BLL.Const._Null)
{
newData.CompileMan = this.drpCompileMan.SelectedValue;
}
newData.CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text.Trim());
newData.Remark = this.txtRemark.Text.Trim();
newData.CompileMan = this.CurrUser.UserId;
newData.CompileDate = DateTime.Now;
newData.ProjectId = this.CurrUser.LoginProjectId;
if (!string.IsNullOrEmpty(id))
{
@@ -79,20 +93,85 @@ namespace FineUIPro.Web.TestRun.DriverPrepare
}
else
{
if (!string.IsNullOrEmpty(this.hdId.Text))
{
newData.DutyId = this.hdId.Text.Trim();
}
else
{
newData.DutyId = SQLHelper.GetNewID(typeof(Model.DriverPrepare_Duty));
this.hdId.Text = newData.DutyId;
}
newData.DutyId = SQLHelper.GetNewID(typeof(Model.DriverPrepare_Duty));
BLL.DriverPrepareDutyService.AddDriverPrepareDriverPlan(newData);
}
CheckBoxField Item1 = (CheckBoxField)Grid1.FindColumn("Item1");
CheckBoxField Item2 = (CheckBoxField)Grid1.FindColumn("Item2");
CheckBoxField Item3 = (CheckBoxField)Grid1.FindColumn("Item3");
CheckBoxField Item4 = (CheckBoxField)Grid1.FindColumn("Item4");
CheckBoxField Item5 = (CheckBoxField)Grid1.FindColumn("Item5");
CheckBoxField Item6 = (CheckBoxField)Grid1.FindColumn("Item6");
CheckBoxField Item7 = (CheckBoxField)Grid1.FindColumn("Item7");
CheckBoxField Item8 = (CheckBoxField)Grid1.FindColumn("Item8");
CheckBoxField Item9 = (CheckBoxField)Grid1.FindColumn("Item9");
CheckBoxField Item10 = (CheckBoxField)Grid1.FindColumn("Item10");
CheckBoxField Item11 = (CheckBoxField)Grid1.FindColumn("Item11");
CheckBoxField Item12 = (CheckBoxField)Grid1.FindColumn("Item12");
CheckBoxField Item13 = (CheckBoxField)Grid1.FindColumn("Item13");
CheckBoxField Item14 = (CheckBoxField)Grid1.FindColumn("Item14");
if (string.IsNullOrEmpty(id))
{
id = "Empty";
}
var list = DriverPrepareDutyItemService.GetLists(id);
foreach (JObject mergedRow in Grid1.GetMergedData())
{
int i = mergedRow.Value<int>("index");
var item = list.FirstOrDefault(x => x.DutyItemId == Grid1.Rows[i].RowID);
JObject values = mergedRow.Value<JObject>("values");
if (item != null)
{
item.DutyId = newData.DutyId;
item.Item1 = Item1.GetCheckedState(i);
item.Item2 = Item2.GetCheckedState(i);
item.Item3 = Item3.GetCheckedState(i);
item.Item4 = Item4.GetCheckedState(i);
item.Item5 = Item5.GetCheckedState(i);
item.Item6 = Item6.GetCheckedState(i);
item.Item7 = Item7.GetCheckedState(i);
item.Item8 = Item8.GetCheckedState(i);
item.Item9 = Item9.GetCheckedState(i);
item.Item10 = Item10.GetCheckedState(i);
item.Item11 = Item11.GetCheckedState(i);
item.Item12 = Item12.GetCheckedState(i);
item.Item13 = Item13.GetCheckedState(i);
item.Item14 = Item14.GetCheckedState(i);
item.Remark = values.Value<string>("Remark");
BLL.DriverPrepareDutyItemService.UpdateDutyItem(item);
}
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#endregion
protected void Button1_Click(object sender, EventArgs e)
{
CheckBoxField field1 = (CheckBoxField)Grid1.FindColumn("CheckBoxField1");
int selectedCount = Grid1.SelectedRowIndexArray.Length;
//if (selectedCount > 0)
//{
// for (int i = 0; i < selectedCount; i++)
// {
// int rowIndex = Grid1.SelectedRowIndexArray[i];
// sb.Append("<tr>");
// sb.AppendFormat("<td>{0}</td>", rowIndex + 1);
// sb.AppendFormat("<td>{0}</td>", field1.GetCheckedState(rowIndex));
// sb.Append("</tr>");
// }
// sb.Append("</table>");
//}
//else
//{
// sb.Append("<strong>没有选中任何一行!</strong>");
//}
}
}
}