protected void btnFind_Click(object sender, EventArgs e) { condObj = new SYS_BILL_COL(); if (txtCOL_NAME.Value != "") condObj.Like(SYS_BILL_COL.Attribute.COL_NAME, Convert.ToString(txtCOL_NAME.Value)); if (txtDATA_TYPE.Value != "") condObj.Like(SYS_BILL_COL.Attribute.DATA_TYPE, Convert.ToString(txtDATA_TYPE.Value)); if (txtBILL_ISHEADER.Value != "") condObj.BILL_ISHEADER = txtBILL_ISHEADER.Value; if (txtFORM_SHOW.Value != "") condObj.FORM_SHOW = txtFORM_SHOW.Value; if (txtFORM_NEED.Value != "") condObj.FORM_NEED = txtFORM_NEED.Value; if (txtFORM_ONEROW.Value != "") condObj.FORM_ONEROW = txtFORM_ONEROW.Value; if (txtSEARCH_INBILL.Value != "") condObj.SEARCH_INBILL = txtSEARCH_INBILL.Value; hidCondition.Value = condObj.ToJson(20); BindList(condObj); }
protected void Page_Load(object sender, EventArgs e) { SYS_BILL_COL condObj = new SYS_BILL_COL(); SYS_BILL_COL valObj = new SYS_BILL_COL(); if (condObj.af_PageByAttributeItem == null)//如果不存在用户定义的分页排序属性,则用主键属性排序 condObj.af_PageBy(SYS_BILL_COL.Attribute.COL_ID, Order.Desc); if (Request["BillID"] != null) { if (Request["col"] != null) { condObj.BILL_ID = int.Parse(Request["BillID"]); } else { SYS_BILL billObj = BLLTable<SYS_BILL>.Factory(conn).GetRowData(SYS_BILL.Attribute.BILL_ID, Request["BillID"]); condObj.BILL_ID = billObj.P_BILL_ID; //List<SYS_BILL> listBill = BLLTable<SYS_BILL>.Factory(conn).Select(SYS_BILL.Attribute.P_BILL_ID, Request["BillID"]); //if (listBill != null) //{ // string ids = "0"; // for (int i = 0; i < listBill.Count; i++) // { // ids += "," + listBill[i].BILL_ID; // } // condObj.In(SYS_BILL_COL.Attribute.BILL_ID, ids); //} } } List<SYS_BILL_COL> listObj = BLLTable<SYS_BILL_COL>.Factory(conn).Select(valObj, condObj); Repeater1.DataSource = listObj; Repeater1.DataBind(); }
protected void aspPager_PageChanged(object sender, EventArgs e) { if (hidCondition.Value != "") { condObj = JsonServiceBase.FromJson <SYS_BILL_COL>(hidCondition.Value); } BindList(condObj); }
protected void aspPager_PageChanged(object sender, EventArgs e) { if (hidCondition.Value != "") { condObj = JsonServiceBase.FromJson<SYS_BILL_COL>(hidCondition.Value); } BindList(condObj); }
protected void Page_Load(object sender, EventArgs e) { //在列表里点击删除按钮,通过AJAX执行这里的后台代码,删除一条记录 if (Request["DelCOL_ID"] != null) { int re = BLLTable <SYS_BILL_COL> .Factory(conn).Delete(SYS_BILL_COL.Attribute.COL_ID, Request["DelCOL_ID"]); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } //在列表顶部点击删除按钮,通过AJAX执行这里的后台代码,删除多条记录 if (Request["DelKeyIDS"] != null) { SYS_BILL_COL cond = new SYS_BILL_COL(); cond.In(SYS_BILL_COL.Attribute.COL_ID, Request["DelKeyIDS"]); int re = BLLTable <SYS_BILL_COL> .Factory(conn).Delete(cond); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } //在用户详细信息查看编辑页面,点保存时,通过AJAX执行这里的后台代码,实现部门字段的更新 if (Request["saveInfo"] != null) { SYS_BILL_COL val = new SYS_BILL_COL(); val.COL_ID = int.Parse(Request["FieldKeyID"]); List <AttributeItem> lstCol = val.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { if (!string.IsNullOrEmpty(Request["txt" + lstCol[i].FieldName])) { val.SetValue(lstCol[i].FieldName, Request["txt" + lstCol[i].FieldName]); } } BLLTable <SYS_BILL_COL> .Factory(conn).Update(val, SYS_BILL_COL.Attribute.COL_ID); Response.Write("修改用户信息成功"); } Response.End(); }
protected string showCHName(SYS_BILL_COL col) { if (!string.IsNullOrEmpty(col.DISPLAY_NAME)) { return col.DISPLAY_NAME; } if (!string.IsNullOrEmpty(col.COL_NOTE)) { return col.COL_NOTE; } return col.COL_NAME; }
protected string showCHName(SYS_BILL_COL col) { if (!string.IsNullOrEmpty(col.DISPLAY_NAME)) { return(col.DISPLAY_NAME); } if (!string.IsNullOrEmpty(col.COL_NOTE)) { return(col.COL_NOTE); } return(col.COL_NAME); }
protected void Page_Load(object sender, EventArgs e) { //���б�����ɾ����ť��ͨ��AJAXִ������ĺ�̨���룬ɾ��һ����¼ if (Request["DelCOL_ID"] != null) { int re = BLLTable<SYS_BILL_COL>.Factory(conn).Delete(SYS_BILL_COL.Attribute.COL_ID, Request["DelCOL_ID"]); if (re > 0) { Response.Write("1");//����������� ����0 ��ʾ�����ɹ���Ҳ����ֱ����� �ַ������ͻ��˽��������ַ�����Ϣ��Ϊ��ʾ } else { Response.Write("ɾ��ʧ�ܣ�"); } } //���б�������ɾ����ť��ͨ��AJAXִ������ĺ�̨���룬ɾ��������¼ if (Request["DelKeyIDS"] != null) { SYS_BILL_COL cond = new SYS_BILL_COL(); cond.In(SYS_BILL_COL.Attribute.COL_ID, Request["DelKeyIDS"]); int re = BLLTable<SYS_BILL_COL>.Factory(conn).Delete(cond); if (re > 0) { Response.Write("1");//����������� ����0 ��ʾ�����ɹ���Ҳ����ֱ����� �ַ������ͻ��˽��������ַ�����Ϣ��Ϊ��ʾ } else { Response.Write("ɾ��ʧ�ܣ�"); } } //���û���ϸ��Ϣ�鿴�༭ҳ�棬�㱣��ʱ��ͨ��AJAXִ������ĺ�̨���룬ʵ�ֲ����ֶεĸ��� if (Request["saveInfo"] != null) { SYS_BILL_COL val = new SYS_BILL_COL(); val.COL_ID = int.Parse(Request["FieldKeyID"]); List<AttributeItem> lstCol = val.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { if (!string.IsNullOrEmpty(Request["txt" + lstCol[i].FieldName])) { val.SetValue(lstCol[i].FieldName,Request["txt" + lstCol[i].FieldName]); } } BLLTable<SYS_BILL_COL>.Factory(conn).Update(val, SYS_BILL_COL.Attribute.COL_ID); Response.Write("���û���Ϣ�ɹ�"); } Response.End(); }
private void BindList(SYS_BILL_COL condObj) { if (condObj.af_PageByAttributeItem == null)//如果不存在用户定义的分页排序属性,则用主键属性排序 { condObj.af_PageBy(SYS_BILL_COL.Attribute.COL_ID, Order.Desc); } condObj.BILL_ID = billid; condObj.Where("COL_NAME not in('BILL_ID')"); listObj = BLLTable <SYS_BILL_COL> .Factory(conn).Select(valObj, condObj); repList.DataSource = listObj; repList.DataBind(); }
protected void btnFind_Click(object sender, EventArgs e) { condObj = new SYS_BILL_COL(); if (txtCOL_NAME.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.COL_NAME, Convert.ToString(txtCOL_NAME.Value)); } if (txtDATA_TYPE.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.DATA_TYPE, Convert.ToString(txtDATA_TYPE.Value)); } if (txtBILL_ISHEADER.Value != "") { condObj.BILL_ISHEADER = txtBILL_ISHEADER.Value; } if (txtFORM_SHOW.Value != "") { condObj.FORM_SHOW = txtFORM_SHOW.Value; } if (txtFORM_NEED.Value != "") { condObj.FORM_NEED = txtFORM_NEED.Value; } if (txtFORM_ONEROW.Value != "") { condObj.FORM_ONEROW = txtFORM_ONEROW.Value; } if (txtSEARCH_INBILL.Value != "") { condObj.SEARCH_INBILL = txtSEARCH_INBILL.Value; } hidCondition.Value = condObj.ToJson(20); BindList(condObj); }
protected void aspPager_PageChanged(object sender, EventArgs e) { try { if (hidCondition.Value != "") { condObj = JsonServiceBase.FromJson <SYS_BILL_COL>(hidCondition.Value); } listObj = BLLTable <SYS_BILL_COL> .Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, aspPager.CurrentPageIndex, ref recount); repCus.DataSource = listObj; repCus.DataBind(); } catch (Exception ex) { litWarn.Text = ex.Message; } }
protected void aspPager_PageChanged(object sender, EventArgs e) { try { if (hidCondition.Value != "") { condObj = JsonServiceBase.FromJson<SYS_BILL_COL>(hidCondition.Value); } listObj = BLLTable<SYS_BILL_COL>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, aspPager.CurrentPageIndex, ref recount); repCus.DataSource = listObj; repCus.DataBind(); } catch (Exception ex) { litWarn.Text = ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { SYS_BILL_COL condObj = new SYS_BILL_COL(); SYS_BILL_COL valObj = new SYS_BILL_COL(); if (condObj.af_PageByAttributeItem == null)//如果不存在用户定义的分页排序属性,则用主键属性排序 { condObj.af_PageBy(SYS_BILL_COL.Attribute.COL_ID, Order.Desc); } if (Request["BillID"] != null) { if (Request["col"] != null)//合计,否则为总计公式 { condObj.BILL_ID = int.Parse(Request["BillID"]); } else { SYS_BILL billObj = BLLTable <SYS_BILL> .Factory(conn).GetRowData(SYS_BILL.Attribute.BILL_ID, Request["BillID"]); condObj.BILL_ID = billObj.P_BILL_ID; //List<SYS_BILL> listBill = BLLTable<SYS_BILL>.Factory(conn).Select(SYS_BILL.Attribute.P_BILL_ID, Request["BillID"]); //if (listBill != null) //{ // string ids = "0"; // for (int i = 0; i < listBill.Count; i++) // { // ids += "," + listBill[i].BILL_ID; // } // condObj.In(SYS_BILL_COL.Attribute.BILL_ID, ids); //} } if (Request["BILL_COL_FORMULAR"] != null) { this.txtFormular.Value = Request["BILL_COL_FORMULAR"]; } } List <SYS_BILL_COL> listObj = BLLTable <SYS_BILL_COL> .Factory(conn).Select(valObj, condObj); Repeater1.DataSource = listObj; Repeater1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { #region//导入字段 if (Request["showInHead"] != null) { string colid = Request["id"]; string billid = Request["pid"]; SYS_BILL_COL ccc = new SYS_BILL_COL(); ccc.COL_ID = int.Parse(colid); ccc.BILL_ID = int.Parse(billid); SYS_BILL_COL vvv = new SYS_BILL_COL(); vvv.BILL_ISHEADER = "1"; int re = BLLTable <SYS_BILL_COL> .Factory(conn).Update(vvv, ccc); if (re > 0) { Response.Write("{re:1,msg:'设置成功!'}"); } else { Response.Write("{re:0,msg:'设置失败!'}"); } } #endregion #region//导入字段 if (Request["getBillHtml"] != null) { SYS_BILL_BLL bill = new SYS_BILL_BLL(int.Parse(Request["billid"])); Response.Write(bill.HtmlList(null) + "`" + bill.HtmlEditForm()); } #endregion Response.End(); }
protected void Page_Load(object sender, EventArgs e) { #region//导入字段 if (Request["showInHead"] != null) { string colid = Request["id"]; string billid = Request["pid"]; SYS_BILL_COL ccc = new SYS_BILL_COL(); ccc.COL_ID = int.Parse(colid); ccc.BILL_ID = int.Parse(billid); SYS_BILL_COL vvv = new SYS_BILL_COL(); vvv.BILL_ISHEADER = "1"; int re = BLLTable<SYS_BILL_COL>.Factory(conn).Update(vvv, ccc); if (re > 0) { Response.Write("{re:1,msg:'设置成功!'}"); } else { Response.Write("{re:0,msg:'设置失败!'}"); } } #endregion #region//导入字段 if (Request["getBillHtml"] != null) { SYS_BILL_BLL bill = new SYS_BILL_BLL(int.Parse(Request["billid"])); Response.Write(bill.HtmlList(null) + "`"+bill.HtmlEditForm()); } #endregion Response.End(); }
protected void Page_Load(object sender, EventArgs e) { #region////��ʾ�ӽڵ� if (Request["getSubNodes"] != null) { string nodetype = Request["ntype"]; StringBuilder sb = new StringBuilder("["); string id = Request["id"]; if (nodetype == "bill-root") { #region SYS_BILL obj = new SYS_BILL(); SYS_BILL val = new SYS_BILL(); obj.P_BILL_ID = 0; //obj.STATUS = "1"; bool fromtb = Request["TB"] != null; if (Request["TB"] == null) { obj.Where("STATUS<>'0'"); } val.af_PageBy(SYS_BILL.Attribute.BILL_ID, Order.Asc); List<SYS_BILL> lst = BLLTable<SYS_BILL>.Factory(conn).Select(val, obj); if (lst.Count != null) { for (int i = 0; i < lst.Count; i++) { if (sb.Length > 2) { sb.Append(","); } sb.Append("{id:'").Append(lst[i].BILL_ID); sb.Append("',pid:'").Append("0").Append("',no:").Append(lst[i].BILL_ID); sb.Append(",sc:").Append("1"); sb.Append(",name:'").Append(lst[i].BILL_NAME + (lst[i].STATUS=="11"?"(��ɾ)":"")).Append("',note:''").Append(",ntype:'bill'}"); } } #endregion } if (nodetype == "bill" || nodetype == "bill-mx") { if (nodetype == "bill") { #region ������ϸ��� SYS_BILL objTB = new SYS_BILL(); SYS_BILL valTB = new SYS_BILL(); objTB.P_BILL_ID = int.Parse(id); valTB.OrderBy(SYS_BILL.Attribute.BILL_ID, Order.Asc); List<SYS_BILL> lstTB = BLLTable<SYS_BILL>.Factory(conn).Select(valTB, objTB); if (lstTB.Count != null) { for (int i = 0; i < lstTB.Count; i++) { if (sb.Length > 2) { sb.Append(","); } sb.Append("{id:'").Append(lstTB[i].BILL_ID); sb.Append("',pid:'").Append(id).Append("',no:").Append(lstTB[i].BILL_ID); sb.Append(",sc:").Append("1"); sb.Append(",name:'").Append(lstTB[i].BILL_NAME).Append("',note:''").Append(",ntype:'bill-mx'}"); } } #endregion } #region ������ SYS_BILL_COL obj = new SYS_BILL_COL(); SYS_BILL_COL val = new SYS_BILL_COL(); obj.BILL_ID = int.Parse(id); //obj.Where("COL_NAME not in('MX_ID','BILL_ID')"); val.af_PageBy(SYS_BILL_COL.Attribute.SORT_NO, Order.Asc); List<SYS_BILL_COL> lst = BLLTable<SYS_BILL_COL>.Factory(conn).Select(val, obj); if (lst.Count > 0) { for (int i = 0; i < lst.Count; i++) { if (sb.Length > 2) { sb.Append(","); } sb.Append("{id:'").Append(lst[i].COL_ID.ToString()); sb.Append("',pid:'").Append(lst[i].BILL_ID.ToString()).Append("',no:").Append(lst[i].SORT_NO); sb.Append(",sc:").Append("1"); sb.Append(",name:'").Append(lst[i].COL_NAME).Append("',note:'[" + lst[i].COL_NOTE + "]'").Append(",ntype:'col'}"); } } #endregion }//ѡ���˱���� if (nodetype == "col") { SYS_BILL_COL_SYN obj = new SYS_BILL_COL_SYN(); SYS_BILL_COL_SYN val = new SYS_BILL_COL_SYN(); obj.COL_ID = int.Parse(id); //obj.Where("COL_NAME not in('MX_ID','BILL_ID')"); //val.af_PageBy(SYS_BILL_COL_SYN.Attribute.SORT_NO, Order.Asc); List<SYS_BILL_COL_SYN> lst = BLLTable<SYS_BILL_COL_SYN>.Factory(conn).Select(val, obj); if (lst.Count > 0) { for (int i = 0; i < lst.Count; i++) { if (sb.Length > 2) { sb.Append(","); } sb.Append("{id:'").Append(lst[i].COL_SYNID.ToString()); sb.Append("',pid:'").Append(lst[i].COL_ID.ToString()).Append("',no:").Append("0"); sb.Append(",sc:").Append("0"); sb.Append(",name:'").Append("[" + lst[i].DB_SRC + "].[" + lst[i].TABLE_NAME + "].[" + lst[i].COL_NAME + "]").Append("',note:'[" + lst[i].COL_NOTE + "]'").Append(",ntype:'syncol'}"); } } } //sb.Append("{id:'").Append("1"); //sb.Append("',pid:'").Append("0").Append("',no:").Append("1"); //sb.Append(",sc:").Append("1"); //sb.Append(",name:'").Append("aaaaa(aaa)").Append("',ntype:'table'}"); sb.Append("]"); Response.Write(sb.ToString()); } #endregion #region//ɾ���ڵ� if (Request["deleteNode"] != null) { string str = ""; string delID = Request["id"]; string ntype = Request["ntype"]; if (ntype == "bill" || ntype == "bill-mx") { #region//ɾ���� SYS_BILL_EXD eee = new SYS_BILL_EXD(int.Parse(delID)); string msg = ""; int re = eee.Delete(out msg); #endregion str = "{re:" + re + ",msg:'" + msg + "'}"; } else if (ntype == "col") { #region//ɾ�����ֶ� string msg = "ɾ�����ݿ���ֶγɹ���"; SYS_BILL_EXD bllexd = new SYS_BILL_EXD(int.Parse(Request["pid"])); int re = bllexd.DeleteCol(int.Parse(delID));// TF_TABLEHelper.DelField(delID);// ; if (re > 0) { msg = "ɾ�����ݿ���ֶγɹ���"; } else { msg = "ɾ�����ݿ���ֶ�ʧ�ܣ�"; } #endregion str = "{re:" + re + ",msg:'" + msg + "'}"; } else if (ntype == "syncol") { #region//ɾ�����ֶ� string msg = "ɾ��ͬ���ֶγɹ���"; int re = BLLTable<SYS_BILL_COL_SYN>.Factory(conn).Delete(SYS_BILL_COL_SYN.Attribute.COL_SYNID, delID); if (re > 0) { msg = "ɾ��ͬ���ֶγɹ���"; } else { msg = "ɾ��ͬ���ֶ�ʧ�ܣ�"; } #endregion str = "{re:" + re + ",msg:'" + msg + "'}"; } Response.Write(str); } #endregion #region//�����ֶ� if (Request["intbCols"] != null) { string pid = Request["pid"]; string id = Request["id"]; string billid = Request["billid"]; DataBaseTable tbllext = DataBase.Factory(conn).DataTables[pid];// new DataBaseTable(_Base.TABLE_NAME, "", dbROG); DataBaseFieldCollection fields = tbllext.DataFields; string keys = ""; DataBaseField fs = fields[id]; if (fs.IsKeyID == true) { keys += keys == "" ? fs.FieldName : "," + fs.FieldName; } SYS_BILL_COL col = AgileFrame.AppInOne.SYS.SysDataBaseHelper.FieldToCol(fs, int.Parse(billid)); SYS_BILL_COL ccc = new SYS_BILL_COL(); ccc.BILL_ID = int.Parse(billid); ccc.COL_NAME = fs.FieldName.ToUpper(); int re = 1; SYS_BILL_COL oldCol = BLLTable<SYS_BILL_COL>.Factory(conn).GetRowData(new SYS_BILL_COL(), ccc); int colid = 0; if (oldCol == null) { re = BLLTable<SYS_BILL_COL>.Factory(conn).Insert(col, SYS_BILL_COL.Attribute.COL_ID); colid = col.COL_ID; } else { colid = oldCol.COL_ID; } if (re > 0) { SYS_BILL_COL_SYN valObj = new SYS_BILL_COL_SYN(); valObj.BILL_ID = Convert.ToInt32(Request["billid"]); valObj.COL_NAME = fs.FieldName.ToUpper(); valObj.TABLE_NAME = Request["tb"]; valObj.COL_ID = colid; valObj.ISPK = fs.IsKeyID == true ? "1" : "0"; valObj.COL_NOTE = fs.Desc.ZhName; valObj.DATA_TYPE = fs.DataType.TypeNameString; valObj.DATA_LEN = fs.DataType.DataLen; valObj.DATA_ACC = fs.DataType.Scale; valObj.IS_AUTO = fs.IsAutoIncrease == true ? "1" : "0"; valObj.DVAL = fs.DefaultValue; valObj.DB_SRC = Request["dev"]; valObj.PK_VALCODE = ""; BLLTable<SYS_BILL_COL_SYN>.InsertReturnID(valObj); } //��¼��������� if (keys != "") { BLLTable<SYS_BILL>.Factory(conn).Update(SYS_BILL.Attribute.BILL_ID, billid, SYS_BILL.Attribute.KEYS, keys); } Response.Write("ok"); } #endregion #region if (Request["addSynCols"] != null) { string[]aaa=StringHelper.GetStringArray(Request["ids"],','); for (int i = 0; i < aaa.Length; i++) { string[] bbb = aaa[i].Split('.'); if (bbb[2] != "col") { continue; } DataBaseTable tbllext = DataBase.Factory(conn).DataTables[bbb[0]]; DataBaseField fs = tbllext.DataFields[bbb[1]]; SYS_BILL_COL_SYN valObj = new SYS_BILL_COL_SYN(); valObj.BILL_ID = Convert.ToInt32(Request["billid"]); valObj.COL_ID = Convert.ToInt32(Request["colid"]); valObj.COL_NAME = fs.FieldName; if (!BLLTable<SYS_BILL_COL_SYN>.Exists(valObj)) { valObj.TABLE_NAME = tbllext.TableName; valObj.ISPK = fs.IsKeyID == true ? "1" : "0"; valObj.COL_NOTE = fs.Desc.ZhName; valObj.DATA_TYPE = fs.DataType.TypeNameString.Replace("_","") ; valObj.DATA_LEN = fs.DataType.DataLen; valObj.DATA_ACC = fs.DataType.Scale; valObj.IS_AUTO = fs.IsAutoIncrease == true ? "1" : "0"; valObj.DVAL = fs.DefaultValue; valObj.DB_SRC = bbb[0]; valObj.PK_VALCODE = ""; BLLTable<SYS_BILL_COL_SYN>.InsertReturnID(valObj); } } Response.Write("ok"); } #endregion #region//����ɾ����� if (Request["clearBill"] != null) { #region//ɾ���� string str = ""; string delID = Request["id"]; SYS_BILL_EXD eee = new SYS_BILL_EXD(int.Parse(delID)); string msg=""; int re = eee.Delete(out msg); #endregion str = "{re:" + re + ",msg:'" + msg+"'}"; Response.Write(str); } #endregion //���б�����ɾ����ť��ͨ��AJAXִ������ĺ�̨���룬ɾ��һ����¼ if (Request["DelBILL_ID"] != null) { int re = BLLTable<SYS_BILL>.Factory(conn).Delete(SYS_BILL.Attribute.BILL_ID, Request["DelBILL_ID"]); if (re > 0) { Response.Write("1");//����������� ����0 ��ʾ�����ɹ���Ҳ����ֱ����� �ַ������ͻ��˽��������ַ�����Ϣ��Ϊ��ʾ } else { Response.Write("ɾ��ʧ�ܣ�"); } } //���б�������ɾ����ť��ͨ��AJAXִ������ĺ�̨���룬ɾ��������¼ if (Request["DelKeyIDS"] != null) { SYS_BILL cond = new SYS_BILL(); cond.In(SYS_BILL.Attribute.BILL_ID, Request["DelKeyIDS"]); int re = BLLTable<SYS_BILL>.Factory(conn).Delete(cond); if (re > 0) { Response.Write("1");//����������� ����0 ��ʾ�����ɹ���Ҳ����ֱ����� �ַ������ͻ��˽��������ַ�����Ϣ��Ϊ��ʾ } else { Response.Write("ɾ��ʧ�ܣ�"); } } //���û���ϸ��Ϣ�鿴�༭ҳ�棬�㱣��ʱ��ͨ��AJAXִ������ĺ�̨���룬ʵ�ֲ����ֶεĸ��� if (Request["saveInfo"] != null) { SYS_BILL val = new SYS_BILL(); val.BILL_ID = int.Parse(Request["FieldKeyID"]); List<AttributeItem> lstCol = val.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { if (!string.IsNullOrEmpty(Request["txt" + lstCol[i].FieldName])) { val.SetValue(lstCol[i].FieldName, Request["txt" + lstCol[i].FieldName]); } } BLLTable<SYS_BILL>.Factory(conn).Update(val, SYS_BILL.Attribute.BILL_ID); Response.Write("���û���Ϣ�ɹ�"); } Response.End(); }
protected void btnOK_Click(object sender, EventArgs e) { //try //{ SYS_BILL_COL valObj = new SYS_BILL_COL(); if (txtBILL_ID.Value != "") valObj.BILL_ID = Convert.ToInt32(txtBILL_ID.Value); if (txtCOL_NAME.Value != "") valObj.COL_NAME = Convert.ToString(txtCOL_NAME.Value); if (keyid == "") { if (BLLTable<SYS_BILL_COL>.Exists(valObj)) { litWarn.Text = "�Ѿ����ڴ��ֶΣ�"; return; } } #region if (txtTABLE_NAME.Value != "") valObj.TABLE_NAME = Convert.ToString(txtTABLE_NAME.Value); if (txtCOL_ID.Value !="" ) valObj.COL_ID = Convert.ToInt32(txtCOL_ID.Value); valObj.ISPK = txtISPK.Value; if(txtCOL_NOTE.Value !="" ) valObj.COL_NOTE = Convert.ToString(txtCOL_NOTE.Value); if(txtDATA_TYPE.Value !="" ) valObj.DATA_TYPE = Convert.ToString(txtDATA_TYPE.Value); if(txtDATA_LEN.Value !="" ) valObj.DATA_LEN = Convert.ToInt32(txtDATA_LEN.Value); if(txtDATA_ACC.Value !="" ) valObj.DATA_ACC = Convert.ToInt32(txtDATA_ACC.Value); if(txtIS_AUTO.Value !="" ) valObj.IS_AUTO = Convert.ToString(txtIS_AUTO.Value); if(txtSORT_NO.Value !="" ) valObj.SORT_NO = Convert.ToInt32(txtSORT_NO.Value); if(txtCOL_SHOW.Value !="" ) valObj.FK_SHOW = Convert.ToString(txtCOL_SHOW.Value); if(txtDISPLAY_NAME.Value !="" ) valObj.DISPLAY_NAME = Convert.ToString(txtDISPLAY_NAME.Value); if(txtTITLE.Value !="" ) valObj.TITLE = Convert.ToString(txtTITLE.Value); if(txtDVAL.Value !="" ) valObj.DVAL = Convert.ToString(txtDVAL.Value); if(txtBILL_ROW_FORMULAR.Value !="" ) valObj.BILL_ROW_FORMULAR = Convert.ToString(txtBILL_ROW_FORMULAR.Value); if(txtBILL_COL_FORMULAR.Value !="" ) valObj.BILL_COL_FORMULAR = Convert.ToString(txtBILL_COL_FORMULAR.Value); if(txtBILL_ISHEADER.Value !="" ) valObj.BILL_ISHEADER = Convert.ToString(txtBILL_ISHEADER.Value); if(txtBILL_HERDERWIDTH.Value !="" ) valObj.BILL_HERDERWIDTH = Convert.ToInt32(txtBILL_HERDERWIDTH.Value); if(txtFORM_CHECKTYPE.Value !="" ) valObj.FORM_CHECKTYPE = Convert.ToString(txtFORM_CHECKTYPE.Value); // if(txtFORM_CTRL_ID.Value !="" ) valObj.FORM_CTRL_ID = int.Parse(Request["txtFORM_CTRL_ID"]); if(txtFORM_SHOW.Value !="" ) valObj.FORM_SHOW = Convert.ToString(txtFORM_SHOW.Value); if(txtFORM_NEED.Value !="" ) valObj.FORM_NEED = Convert.ToString(txtFORM_NEED.Value); if(txtFORM_MIN.Value !="" ) valObj.FORM_MIN = Convert.ToString(txtFORM_MIN.Value); if(txtFORM_MAX.Value !="" ) valObj.FORM_MAX = Convert.ToString(txtFORM_MAX.Value); if(txtFORM_ONEROW.Value !="" ) valObj.FORM_ONEROW = Convert.ToString(txtFORM_ONEROW.Value); if(txtFORM_CTRLWIDTH.Value !="" ) valObj.FORM_CTRLWIDTH = Convert.ToInt32(txtFORM_CTRLWIDTH.Value); if(txtSEARCH_INBILL.Value !="" ) valObj.SEARCH_INBILL = Convert.ToString(txtSEARCH_INBILL.Value); if(txtSEARCH_TYPE.Value !="" ) valObj.SEARCH_TYPE = Convert.ToString(txtSEARCH_TYPE.Value); if(txtSEARCH_FORMULAR.Value !="" ) valObj.SEARCH_FORMULAR = Convert.ToString(txtSEARCH_FORMULAR.Value); //valObj.ISFK = hidIsFK.Value; //if (hidTABLE_NAME.Value != txtTABLE_NAME.Value && txtCONN_SOURCE.Value != "AIO"&&valObj.ISPK=="1") //{ // valObj.ISFK = "1"; //} //else { // valObj.ISFK = "0"; //} valObj.FK_NAME = hidFK_NAME.Value; valObj.BILL_AFTREDTL = txtBILL_AFTREDTL.Value; //valObj.TABLE_EXISTS = txtTAVLE_EXISTS.Checked == true ? "1" : "0"; //valObj.COL_SYN_TO = txtCOL_SYN_TO.Value; //valObj.CONN_SOURCE = txtCONN_SOURCE.Value; valObj.PK_VALCODE = txtPK_VALCODE.Value; valObj.SEL_TB_COL = txtSEL_TBNAME.Value + "," + txtSEL_KEY.Value + "," + txtSEL_NAME.Value; #endregion if (keyid != "") { valObj.COL_ID = Convert.ToInt32(keyid); SYS_BILL_COL_EXD billExd = new SYS_BILL_COL_EXD(valObj); count = BLLTable<SYS_BILL_COL>.Factory(conn).Update(valObj, SYS_BILL_COL.Attribute.COL_ID); } else { SYS_BILL_COL_EXD billExd = new SYS_BILL_COL_EXD(valObj); count =BLLTable<SYS_BILL_COL>.Factory(conn).Insert(valObj, SYS_BILL_COL.Attribute.COL_ID); keyid = count.ToString(); ViewState["KEYID"] = keyid; } if (count > 0) { if ("31,32,33".IndexOf(valObj.FORM_CTRL_ID.ToString()) != -1) { liSetItems.Visible = true; } else { liSetItems.Visible = false; } if (Request["tree"] != null) { StringBuilder sb = new StringBuilder("{"); sb.Append("id:'"); sb.Append(keyid).Append("',pid:'").Append(valObj.BILL_ID).Append("',no:").Append(valObj.SORT_NO).Append(",sc:0,name:'"); sb.Append(valObj.COL_NAME + "[" + valObj.COL_NOTE + "]").Append("',ntype:'col'}"); if (Request["edit"] == null) { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "_FormView();parent.TV.showSubNodes(\"" + sb.ToString() + "\");", false); } else { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "_FormView();parent.TV.editNodeInfo(\"" + sb.ToString() + "\");", false); } litWarn.Text = "����ɹ�"; } else { #region StringBuilder sbData = new StringBuilder("{valObj:''"); List<AttributeItem> lstCol = valObj.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { object val = valObj.GetValue(lstCol[i]); if (val != null) { sbData.Append(",").Append(lstCol[i].FieldName).Append(":'").Append(val.ToString()).Append("'"); } } sbData.Append("}"); if (ViewState["sbData"] == null) { ViewState["sbData"] = sbData.ToString(); } else { ViewState["sbData"] += "," + sbData.ToString(); } Button btn = (Button)sender; if (btn.ID.IndexOf("btnOK") != -1) { if (ViewState["sbData"] == null) { string dataStr = "[" + ViewState["sbData"].ToString() + "]"; ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "_FormView();if (window.opener){window.opener.returnValue = '" + dataStr + "';}else{window.returnValue = '" + dataStr + "';}window.close();", true); } else { ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "_FormView();if (window.opener){window.opener.returnValue = 're';}else{window.returnValue = 're';}window.close();", true); } } else { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "_FormView();", false); txtTABLE_NAME.Value = ""; txtCOL_NAME.Value = ""; hidTABLE_NAME.Value = ""; } #endregion } } else { litWarn.Text = "��ʧ�ܣ�"; } //} //catch (Exception ex) //{ // litWarn.Text = ex.Message; //} }
protected void Page_Load(object sender, EventArgs e) { title = valObj._ZhName + "�༭"; Page.Title = title; if (!string.IsNullOrEmpty(Request["COL_ID"])) { keyid = Request["COL_ID"]; } if (!string.IsNullOrEmpty(Request["KeyID"])) { keyid = Request["KeyID"]; } if (!string.IsNullOrEmpty(Request["edit"])) { keyid = Request["id"]; billid = int.Parse(Request["pid"]); } else { if (!string.IsNullOrEmpty(Request["id"])) { billid = int.Parse(Request["id"]); } } if (!string.IsNullOrEmpty(Request["billid"])) { billid = int.Parse(Request["billid"]); } if (ViewState["KEYID"] != null) { keyid = ViewState["KEYID"].ToString(); } if (!IsPostBack) { foreach (string s in Enum.GetNames(typeof(DataBaseDataType))) { string nnn = s.Replace("_", ""); txtDATA_TYPE.Items.Add(new ListItem(nnn, nnn)); } if (billid > 0) { //txtSEL_KEY.Items.Add(new ListItem("Ĭ������ID", "BILL_ID")); SYS_BILL_BLL bllexd = new SYS_BILL_BLL(billid); if (bllexd.PKeyColSyn != null) { string name = bllexd.PKeyColSyn.Base._COL_NOTE; if (name == "") { name = bllexd.PKeyColSyn.COL_NAME; } txtSEL_KEY.Items.Add(new ListItem(name, bllexd.PKeyColSyn.COL_NAME)); } SYS_BILL_COL ccc = new SYS_BILL_COL(); ccc.BILL_ID = billid; ccc.FORM_SHOW = "1"; ccc.IS_AUTO = "0"; ccc.ISPK = "0"; List<SYS_BILL_COL> lstCol = BLLTable<SYS_BILL_COL>.Factory(conn).Select(new SYS_BILL_COL(), ccc); if (lstCol != null) { for (int i = 0; i < lstCol.Count; i++) { //txtCOL_SYN_TO.Items.Add(new ListItem(lstCol[i].COL_NOTE, lstCol[i].COL_NAME)); if (lstCol[i].ISPK == "1") { txtSEL_KEY.Items.Add(new ListItem(lstCol[i].COL_NOTE, lstCol[i].COL_NAME)); } if (!lstCol[i].IsNumber()) { txtSEL_NAME.Items.Add(new ListItem(lstCol[i].COL_NOTE, lstCol[i].COL_NAME)); } } } } //try //{ ViewState["FORM_CTRL_ID"] = "0"; SYS_BILL billObj = BLLTable<SYS_BILL>.Factory(conn).GetRowData(SYS_BILL.Attribute.BILL_ID, billid); hidTABLE_NAME.Value = billObj.TABLE_NAME; if (keyid != "") { valObj = BLLTable<SYS_BILL_COL>.Factory(conn).GetRowData(SYS_BILL_COL.Attribute.COL_ID, keyid); if (valObj == null) return; txtISPK.Value = valObj.ISPK; txtCOL_ID.Value = Convert.ToString(valObj.COL_ID);//Convert.ToInt32 txtBILL_ID.Value = Convert.ToString(valObj.BILL_ID);//Convert.ToInt32 txtTABLE_NAME.Value = Convert.ToString(valObj.TABLE_NAME);//Convert.ToString txtCOL_NAME.Value = Convert.ToString(valObj.COL_NAME);//Convert.ToString ViewState["txtCOL_NAME"] = txtCOL_NAME.Value; hidFK_NAME.Value = valObj.FK_NAME; txtCOL_NOTE.Value = Convert.ToString(valObj.COL_NOTE);//Convert.ToString txtDATA_TYPE.Value = Convert.ToString(valObj.DATA_TYPE);//Convert.ToString txtDATA_LEN.Value = Convert.ToString(valObj.DATA_LEN);//Convert.ToInt32 txtDATA_ACC.Value = Convert.ToString(valObj.DATA_ACC);//Convert.ToInt32 txtIS_AUTO.Value = Convert.ToString(valObj.IS_AUTO);//Convert.ToString txtSORT_NO.Value = Convert.ToString(valObj.SORT_NO);//Convert.ToInt32 txtCOL_SHOW.Value = Convert.ToString(valObj.FK_SHOW);//Convert.ToString txtDISPLAY_NAME.Value = Convert.ToString(valObj.DISPLAY_NAME);//Convert.ToString txtTITLE.Value = Convert.ToString(valObj.TITLE);//Convert.ToString txtDVAL.Value = Convert.ToString(valObj.DVAL);//Convert.ToString txtBILL_ROW_FORMULAR.Value = Convert.ToString(valObj.BILL_ROW_FORMULAR);//Convert.ToString txtBILL_COL_FORMULAR.Value = Convert.ToString(valObj.BILL_COL_FORMULAR);//Convert.ToString txtBILL_ISHEADER.Value = Convert.ToString(valObj.BILL_ISHEADER);//Convert.ToString txtBILL_HERDERWIDTH.Value = Convert.ToString(valObj.BILL_HERDERWIDTH);//Convert.ToInt32 txtFORM_CHECKTYPE.Value = Convert.ToString(valObj.FORM_CHECKTYPE);//Convert.ToString //txtFORM_CTRL_ID.Value = Convert.ToString(valObj.FORM_CTRL_ID);//Convert.ToInt32 ViewState["FORM_CTRL_ID"] = valObj.FORM_CTRL_ID; txtFORM_SHOW.Value = Convert.ToString(valObj.FORM_SHOW);//Convert.ToString txtFORM_NEED.Value = Convert.ToString(valObj.FORM_NEED);//Convert.ToString txtFORM_MIN.Value = Convert.ToString(valObj.FORM_MIN);//Convert.ToString txtFORM_MAX.Value = Convert.ToString(valObj.FORM_MAX);//Convert.ToString txtFORM_ONEROW.Value = Convert.ToString(valObj.FORM_ONEROW);//Convert.ToString txtFORM_CTRLWIDTH.Value = Convert.ToString(valObj.FORM_CTRLWIDTH);//Convert.ToInt32 txtSEARCH_INBILL.Value = Convert.ToString(valObj.SEARCH_INBILL);//Convert.ToString txtSEARCH_TYPE.Value = Convert.ToString(valObj.SEARCH_TYPE);//Convert.ToString txtSEARCH_FORMULAR.Value = Convert.ToString(valObj.SEARCH_FORMULAR);//Convert.ToString //hidIsFK.Value = valObj.ISFK; txtBILL_AFTREDTL.Value = valObj.BILL_AFTREDTL; //txtTAVLE_EXISTS.Checked = valObj.TABLE_EXISTS == "1"; //txtCOL_SYN_TO.Value = valObj.COL_SYN_TO; // txtCONN_SOURCE.Value = valObj.CONN_SOURCE; if (!string.IsNullOrEmpty(valObj.SEL_TB_COL)) { string[] arr = valObj.SEL_TB_COL.Split(','); txtSEL_TBNAME.Value = arr[0];// + "," + txtSEL_KEY.Value = arr[1];// + "," + txtSEL_NAME.Value = arr[2]; } txtPK_VALCODE.Value = valObj.PK_VALCODE; if ("31,32,33".IndexOf(valObj.FORM_CTRL_ID.ToString()) != -1) { liSetItems.Visible = true; } if (billObj.P_BILL_ID > 0) { dl_BILL_COL_FORMULAR.Visible = true; dl_BILL_ROW_FORMULAR.Visible = true; } else { dl_BILL_COL_FORMULAR.Visible = true; } txtSEL_TBNAME.Value = valObj.TABLE_NAME; if (valObj.IS_COL_EXISTS == "1") { txtCOL_NAME.Disabled = true; txtDATA_TYPE.Disabled = true; txtDATA_LEN.Disabled = true; txtDATA_ACC.Disabled = true; txtTABLE_NAME.Disabled = true; txtIS_AUTO.Disabled = true; txtISPK.Disabled = true; btnSelCol.Visible = false; } } else { txtBILL_ID.Value = billid.ToString(); txtTABLE_NAME.Value = billObj.TABLE_NAME; txtSEL_TBNAME.Value = billObj.TABLE_NAME; SYS_BILL_COL cccmax = new SYS_BILL_COL(); cccmax.BILL_ID = billid; string sort = BLLTable<SYS_BILL_COL>.Max(SYS_BILL_COL.Attribute.SORT_NO, cccmax); if (!string.IsNullOrEmpty(sort)) { txtSORT_NO.Value = (int.Parse(sort)+1).ToString(); } } #region//��ʼ���ؼ����� SYS_BILL_CTRL ctrlCond = new SYS_BILL_CTRL(); ctrlCond.OrderBy(TF_CTRL_TYPE.Attribute.SORT_NO, Order.Asc); DataTable dtCtrl = BLLTable<SYS_BILL_CTRL>.SelectForDataTable(new SYS_BILL_CTRL(), ctrlCond); //ViewState["CTRL_TYPE"] = txtFORM_CTRL_ID.Value; DataView dv1 = new DataView(); dv1.Table = dtCtrl; dv1.RowFilter = "P_CTRL_ID='0'"; dv1.Sort = "SORT_NO asc"; for (int i = 0; i < dv1.Count; i++) { litCTRL_TYPE.Text += "<optgroup label='" + dv1[i]["CTRL_NAME"].ToString() + "'>"; DataView dv2 = new DataView(); dv2.Table = dtCtrl; dv2.RowFilter = "P_CTRL_ID='" + dv1[i]["CTRL_ID"].ToString() + "'"; dv2.Sort = "SORT_NO asc"; for (int a = 0; a < dv2.Count; a++) { if (valObj != null && ViewState["FORM_CTRL_ID"].ToString() == dv2[a]["CTRL_ID"].ToString()) { litCTRL_TYPE.Text += "<option value='" + dv2[a]["CTRL_ID"].ToString() + "' selected='selected'>" + dv2[a]["CTRL_NAME"].ToString() + "</option>"; } else { litCTRL_TYPE.Text += "<option value='" + dv2[a]["CTRL_ID"].ToString() + "'>" + dv2[a]["CTRL_NAME"].ToString() + "</option>"; } } litCTRL_TYPE.Text += "</optgroup>"; } #endregion //} //catch (Exception ex) //{ // litWarn.Text = ex.Message; //} } }
private void BindList(SYS_BILL_COL condObj) { if (condObj.af_PageByAttributeItem == null)//����������û�����ķ�ҳ�������ԣ����������������� condObj.af_PageBy(SYS_BILL_COL.Attribute.COL_ID, Order.Desc); condObj.BILL_ID = billid; condObj.Where("COL_NAME not in('BILL_ID')"); listObj = BLLTable<SYS_BILL_COL>.Factory(conn).Select(valObj, condObj); repList.DataSource = listObj; repList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["COL_ID"])) { keyid = Request["COL_ID"]; } if (!string.IsNullOrEmpty(Request["KeyID"])) { keyid = Request["KeyID"]; } if (!string.IsNullOrEmpty(Request["edit"])) { keyid = Request["id"]; tbname = Request["pid"]; } else { tbname = Request["id"]; } if (ViewState["KEYID"] != null) { keyid = ViewState["KEYID"].ToString(); } if (!IsPostBack) { //try //{ ViewState["FORM_CTRL_ID"] = "0"; //SYS_BILL billObj = BLLTable<SYS_BILL>.Factory(conn).GetRowData(SYS_BILL.Attribute.BILL_ID, billid); hidTABLE_NAME.Value = tbname; foreach (string s in Enum.GetNames(typeof(DataBaseDataType))) { string nnn = s.Replace("_", ""); txtDATA_TYPE.Items.Add(new ListItem(nnn, nnn)); } if (keyid != "") { SYS_BILL_COL col = new SYS_BILL_COL(); col.TABLE_NAME = tbname; col.COL_NAME = keyid; SYS_BILL_COL_EXD coleee = new SYS_BILL_COL_EXD(col);//获取本地数据库物理表,原先是表单模块 valObj = coleee.DB_GetColByField(tbname, keyid); if (valObj == null) { return; } txtISPK.Value = valObj.ISPK; txtCOL_ID.Value = Convert.ToString(valObj.COL_ID); //Convert.ToInt32 txtBILL_ID.Value = Convert.ToString(valObj.BILL_ID); //Convert.ToInt32 txtTABLE_NAME.Value = Convert.ToString(valObj.TABLE_NAME); //Convert.ToString txtCOL_NAME.Value = Convert.ToString(valObj.COL_NAME); //Convert.ToString ViewState["txtCOL_NAME"] = txtCOL_NAME.Value; hidFK_NAME.Value = valObj.FK_NAME; txtCOL_NOTE.Value = Convert.ToString(valObj.COL_NOTE); //Convert.ToString txtDATA_TYPE.Value = valObj.DATA_TYPE; // Response.Write(valObj.DATA_TYPE); txtDATA_LEN.Value = Convert.ToString(valObj.DATA_LEN); //Convert.ToInt32 txtDATA_ACC.Value = Convert.ToString(valObj.DATA_ACC); //Convert.ToInt32 txtIS_AUTO.Value = Convert.ToString(valObj.IS_AUTO); //Convert.ToString txtSORT_NO.Value = Convert.ToString(valObj.SORT_NO); //Convert.ToInt32 txtCOL_SHOW.Value = Convert.ToString(valObj.FK_SHOW); //Convert.ToString //txtDISPLAY_NAME.Value = Convert.ToString(valObj.DISPLAY_NAME);//Convert.ToString txtTITLE.Value = Convert.ToString(valObj.TITLE); //Convert.ToString txtDVAL.Value = Convert.ToString(valObj.DVAL); //Convert.ToString ViewState["FORM_CTRL_ID"] = valObj.FORM_CTRL_ID; txtPK_VALCODE.Value = valObj.PK_VALCODE; if ("31,32,33".IndexOf(valObj.FORM_CTRL_ID.ToString()) != -1) { liSetItems.Visible = true; } if (valObj.IS_COL_EXISTS == "1") { txtCOL_NAME.Disabled = true; txtDATA_TYPE.Disabled = true; txtDATA_LEN.Disabled = true; txtDATA_ACC.Disabled = true; txtTABLE_NAME.Disabled = true; txtIS_AUTO.Disabled = true; txtISPK.Disabled = true; btnSelCol.Visible = false; } } else { txtBILL_ID.Value = tbname; txtTABLE_NAME.Value = tbname; } //} //catch (Exception ex) //{ // litWarn.Text = ex.Message; //} } }
protected void btnOK_Click(object sender, EventArgs e) { //try //{ SYS_BILL_COL valObj = new SYS_BILL_COL(); if (txtBILL_ID.Value != "") { valObj.BILL_ID = Convert.ToInt32(txtBILL_ID.Value); } if (txtCOL_NAME.Value != "") { valObj.COL_NAME = Convert.ToString(txtCOL_NAME.Value); } if (keyid == "") { if (BLLTable <SYS_BILL_COL> .Exists(valObj)) { litWarn.Text = "已经存在此字段!"; return; } } #region if (txtTABLE_NAME.Value != "") { valObj.TABLE_NAME = Convert.ToString(txtTABLE_NAME.Value); } if (txtCOL_ID.Value != "") { valObj.COL_ID = Convert.ToInt32(txtCOL_ID.Value); } valObj.ISPK = txtISPK.Value; if (txtCOL_NOTE.Value != "") { valObj.COL_NOTE = Convert.ToString(txtCOL_NOTE.Value); } if (txtDATA_TYPE.Value != "") { valObj.DATA_TYPE = Convert.ToString(txtDATA_TYPE.Value); } if (txtDATA_LEN.Value != "") { valObj.DATA_LEN = Convert.ToInt32(txtDATA_LEN.Value); } if (txtDATA_ACC.Value != "") { valObj.DATA_ACC = Convert.ToInt32(txtDATA_ACC.Value); } if (txtIS_AUTO.Value != "") { valObj.IS_AUTO = Convert.ToString(txtIS_AUTO.Value); } if (txtSORT_NO.Value != "") { valObj.SORT_NO = Convert.ToInt32(txtSORT_NO.Value); } if (txtCOL_SHOW.Value != "") { valObj.FK_SHOW = Convert.ToString(txtCOL_SHOW.Value); } if (txtDISPLAY_NAME.Value != "") { valObj.DISPLAY_NAME = Convert.ToString(txtDISPLAY_NAME.Value); } if (txtTITLE.Value != "") { valObj.TITLE = Convert.ToString(txtTITLE.Value); } if (txtDVAL.Value != "") { valObj.DVAL = Convert.ToString(txtDVAL.Value); } if (txtBILL_ROW_FORMULAR.Value != "") { valObj.BILL_ROW_FORMULAR = Convert.ToString(txtBILL_ROW_FORMULAR.Value); } if (txtBILL_COL_FORMULAR.Value != "") { valObj.BILL_COL_FORMULAR = Convert.ToString(txtBILL_COL_FORMULAR.Value); } if (txtBILL_ISHEADER.Value != "") { valObj.BILL_ISHEADER = Convert.ToString(txtBILL_ISHEADER.Value); } if (txtBILL_HERDERWIDTH.Value != "") { valObj.BILL_HERDERWIDTH = Convert.ToInt32(txtBILL_HERDERWIDTH.Value); } if (txtFORM_CHECKTYPE.Value != "") { valObj.FORM_CHECKTYPE = Convert.ToString(txtFORM_CHECKTYPE.Value); } // if(txtFORM_CTRL_ID.Value !="" ) valObj.FORM_CTRL_ID = int.Parse(Request["txtFORM_CTRL_ID"]); if (txtFORM_SHOW.Value != "") { valObj.FORM_SHOW = Convert.ToString(txtFORM_SHOW.Value); } if (txtFORM_NEED.Value != "") { valObj.FORM_NEED = Convert.ToString(txtFORM_NEED.Value); } if (txtFORM_MIN.Value != "") { valObj.FORM_MIN = Convert.ToString(txtFORM_MIN.Value); } if (txtFORM_MAX.Value != "") { valObj.FORM_MAX = Convert.ToString(txtFORM_MAX.Value); } if (txtFORM_ONEROW.Value != "") { valObj.FORM_ONEROW = Convert.ToString(txtFORM_ONEROW.Value); } if (txtFORM_CTRLWIDTH.Value != "") { valObj.FORM_CTRLWIDTH = Convert.ToInt32(txtFORM_CTRLWIDTH.Value); } if (txtSEARCH_INBILL.Value != "") { valObj.SEARCH_INBILL = Convert.ToString(txtSEARCH_INBILL.Value); } if (txtSEARCH_TYPE.Value != "") { valObj.SEARCH_TYPE = Convert.ToString(txtSEARCH_TYPE.Value); } if (txtSEARCH_FORMULAR.Value != "") { valObj.SEARCH_FORMULAR = Convert.ToString(txtSEARCH_FORMULAR.Value); } //valObj.ISFK = hidIsFK.Value; //if (hidTABLE_NAME.Value != txtTABLE_NAME.Value && txtCONN_SOURCE.Value != "AIO"&&valObj.ISPK=="1") //{ // valObj.ISFK = "1"; //} //else { // valObj.ISFK = "0"; //} valObj.FK_NAME = hidFK_NAME.Value; valObj.BILL_AFTREDTL = txtBILL_AFTREDTL.Value; //valObj.TABLE_EXISTS = txtTAVLE_EXISTS.Checked == true ? "1" : "0"; //valObj.COL_SYN_TO = txtCOL_SYN_TO.Value; //valObj.CONN_SOURCE = txtCONN_SOURCE.Value; valObj.PK_VALCODE = txtPK_VALCODE.Value; valObj.SEL_TB_COL = txtSEL_TBNAME.Value + "," + txtSEL_KEY.Value + "," + txtSEL_NAME.Value; #endregion if (keyid != "") { valObj.COL_ID = Convert.ToInt32(keyid); SYS_BILL_COL_EXD billExd = new SYS_BILL_COL_EXD(valObj); count = BLLTable <SYS_BILL_COL> .Factory(conn).Update(valObj, SYS_BILL_COL.Attribute.COL_ID); } else { SYS_BILL_COL_EXD billExd = new SYS_BILL_COL_EXD(valObj); count = BLLTable <SYS_BILL_COL> .Factory(conn).Insert(valObj, SYS_BILL_COL.Attribute.COL_ID); keyid = count.ToString(); ViewState["KEYID"] = keyid; } if (count > 0) { if ("31,32,33".IndexOf(valObj.FORM_CTRL_ID.ToString()) != -1) { liSetItems.Visible = true; } else { liSetItems.Visible = false; } if (Request["tree"] != null) { StringBuilder sb = new StringBuilder("{"); sb.Append("id:'"); sb.Append(keyid).Append("',pid:'").Append(valObj.BILL_ID).Append("',no:").Append(valObj.SORT_NO).Append(",sc:0,name:'"); sb.Append(valObj.COL_NAME + "[" + valObj.COL_NOTE + "]").Append("',ntype:'col'}"); if (Request["edit"] == null) { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "_FormView();parent.TV.showSubNodes(\"" + sb.ToString() + "\");", false); } else { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "_FormView();parent.TV.editNodeInfo(\"" + sb.ToString() + "\");", false); } litWarn.Text = "保存成功"; } else { #region StringBuilder sbData = new StringBuilder("{valObj:''"); List <AttributeItem> lstCol = valObj.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { object val = valObj.GetValue(lstCol[i]); if (val != null) { sbData.Append(",").Append(lstCol[i].FieldName).Append(":'").Append(val.ToString()).Append("'"); } } sbData.Append("}"); if (ViewState["sbData"] == null) { ViewState["sbData"] = sbData.ToString(); } else { ViewState["sbData"] += "," + sbData.ToString(); } Button btn = (Button)sender; if (btn.ID.IndexOf("btnOK") != -1) { if (ViewState["sbData"] == null) { string dataStr = "[" + ViewState["sbData"].ToString() + "]"; ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "_FormView();if (window.opener){window.opener.returnValue = '" + dataStr + "';}else{window.returnValue = '" + dataStr + "';}window.close();", true); } else { ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "_FormView();if (window.opener){window.opener.returnValue = 're';}else{window.returnValue = 're';}window.close();", true); } } else { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "_FormView();", false); txtTABLE_NAME.Value = ""; txtCOL_NAME.Value = ""; hidTABLE_NAME.Value = ""; } #endregion } } else { litWarn.Text = "修改失败!"; } //} //catch (Exception ex) //{ // litWarn.Text = ex.Message; //} }
protected void btnOK_Click(object sender, EventArgs e) { //try //{ SYS_BILL_COL valObj = new SYS_BILL_COL(); if (txtTABLE_NAME.Value != "") valObj.TABLE_NAME = Convert.ToString(txtTABLE_NAME.Value); if (txtCOL_NAME.Value != "") valObj.COL_NAME = Convert.ToString("U_" + txtCOL_NAME.Value); if (keyid == "") { if (BLLTable<SYS_BILL_COL>.Exists(valObj)) { litWarn.Text = "�Ѿ����ڴ��ֶΣ�"; return; } } #region valObj.ISPK = txtISPK.Value; if (txtCOL_NOTE.Value != "") valObj.COL_NOTE = Convert.ToString(txtCOL_NOTE.Value); if (txtDATA_TYPE.Value != "") valObj.DATA_TYPE = Convert.ToString(txtDATA_TYPE.Value); if (txtDATA_LEN.Value != "") valObj.DATA_LEN = Convert.ToInt32(txtDATA_LEN.Value); if (txtDATA_ACC.Value != "") valObj.DATA_ACC = Convert.ToInt32(txtDATA_ACC.Value); if (txtIS_AUTO.Value != "") valObj.IS_AUTO = Convert.ToString(txtIS_AUTO.Value); if (txtSORT_NO.Value != "") valObj.SORT_NO = Convert.ToInt32(txtSORT_NO.Value); if (txtCOL_SHOW.Value != "") valObj.FK_SHOW = Convert.ToString(txtCOL_SHOW.Value); if (txtTITLE.Value != "") valObj.TITLE = Convert.ToString(txtTITLE.Value); if (txtDVAL.Value != "") valObj.DVAL = Convert.ToString(txtDVAL.Value); if (hidTABLE_NAME.Value != txtTABLE_NAME.Value && txtCONN_SOURCE.Value != "AIO" && valObj.ISPK == "1") { valObj.ISFK = "1"; } else { valObj.ISFK = "0"; } valObj.FK_NAME = hidFK_NAME.Value; valObj.PK_VALCODE = txtPK_VALCODE.Value; #endregion string msg = ""; try { if (ViewState["txtCOL_NAME"] != null) { if (ViewState["txtCOL_NAME"].ToString().IndexOf("U_") != 0 && ViewState["txtCOL_NAME"].ToString().IndexOf("u_") != 0) { Response.Write("�Բ��������߱��༭���ֶε�Ȩ�ޡ�"); Response.End(); return; } //valObj.COL_ID = Convert.ToInt32(keyid); SYS_BILL_COL_EXD billExd = new SYS_BILL_COL_EXD(valObj); count = billExd.DB_Update(ViewState["txtCOL_NAME"].ToString(), valObj, ref msg);//.Update(ViewState["txtCOL_NAME"].ToString());// BLLTable<SYS_BILL_COL>.Factory(conn).Update(valObj, SYS_BILL_COL.Attribute.COL_ID); } else { if (ViewState["txtCOL_NAME"].ToString().IndexOf("U_") != 0 && ViewState["txtCOL_NAME"].ToString().IndexOf("u_") != 0) { Response.Write("�Բ��������߱���Ӵ��ֶε�Ȩ�ޡ�"); Response.End(); return; } SYS_BILL_COL_EXD billExd = new SYS_BILL_COL_EXD(valObj); count = billExd.DB_AddField(ref msg) == true ? 1 : 0;// BLLTable<SYS_BILL_COL>.Factory(conn).Insert(valObj, SYS_BILL_COL.Attribute.COL_ID); keyid = count.ToString(); ViewState["KEYID"] = keyid; } } catch (Exception ee) { Response.Write("����ʧ�ܣ�������ѡ��ڵ㣡"); Response.End(); } if (count > 0) { if ("31,32,33".IndexOf(valObj.FORM_CTRL_ID.ToString()) != -1) { liSetItems.Visible = true; } else { liSetItems.Visible = false; } ViewState["txtCOL_NAME"] = valObj.COL_NAME; if (Request["tree"] != null) { StringBuilder sb = new StringBuilder("{"); sb.Append("id:'").Append(valObj.COL_NAME.ToString()); sb.Append("',pid:'").Append(valObj.TABLE_NAME).Append("',no:").Append("1"); sb.Append(",sc:").Append("0,dev:'" + Request["dev"] + "',tb:'" + Request["tb"] + "'"); sb.Append(",name:'").Append(valObj.COL_NAME).Append("',note:'[" + valObj.COL_NOTE + "]'").Append(",ntype:'col'}"); if (Request["edit"] == null) { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "parent.TV.showSubNodes(\"" + sb.ToString() + "\");", false); } else { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "parent.TV.editNodeInfo(\"" + sb.ToString() + "\");", false); } litWarn.Text = "����ɹ�"; } else { #region StringBuilder sbData = new StringBuilder("{valObj:''"); List<AttributeItem> lstCol = valObj.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { object val = valObj.GetValue(lstCol[i]); if (val != null) { sbData.Append(",").Append(lstCol[i].FieldName).Append(":'").Append(val.ToString()).Append("'"); } } sbData.Append("}"); if (ViewState["sbData"] == null) { ViewState["sbData"] = sbData.ToString(); } else { ViewState["sbData"] += "," + sbData.ToString(); } Button btn = (Button)sender; if (btn.ID.IndexOf("btnOK") != -1) { if (ViewState["sbData"] == null) { string dataStr = "[" + ViewState["sbData"].ToString() + "]"; ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "_FormView();if (window.opener){window.opener.returnValue = '" + dataStr + "';}else{window.returnValue = '" + dataStr + "';}window.close();", true); } else { ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "_FormView();if (window.opener){window.opener.returnValue = 're';}else{window.returnValue = 're';}window.close();", true); } } else { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "_FormView();", false); txtTABLE_NAME.Value = ""; txtCOL_NAME.Value = ""; hidTABLE_NAME.Value = ""; } #endregion } } else { litWarn.Text = "��ʧ�ܣ�"; } //} //catch (Exception ex) //{ // litWarn.Text = ex.Message; //} }
protected void Page_Load(object sender, EventArgs e) { title = valObj._ZhName + "±à¼"; Page.Title = title; if (!string.IsNullOrEmpty(Request["SYN_ID"])) { keyid = Request["SYN_ID"]; } if (!string.IsNullOrEmpty(Request["KeyID"])) { keyid = Request["KeyID"]; } if (!string.IsNullOrEmpty(Request["edit"])) { keyid = Request["id"]; colid = int.Parse(Request["pid"]); } else { colid = int.Parse(Request["id"]); } if (ViewState["KEYID"] != null) { keyid = ViewState["KEYID"].ToString(); } if (!IsPostBack) { txtDB_SRC.Items.AddRange(FormHelper.GetListItem(SYS_DATASOURCE.Attribute.SourceName)); txtDATA_TYPE.Items.Clear(); //FieldDataType fty = new FieldDataType(DataBaseConnectStringHelper.GetDataBaseType(MyConfigurationSettings.GetValue(txtDB_SRC.Value)), DataBaseDataType.varchar, 20, 0, false); //foreach (string tp in fty.AllDataType) //{ // txtDATA_TYPE.Items.Add(new ListItem(tp, tp)); //} //if (colid > 0) //{ // SYS_BILL_COL_SYN ccc = new SYS_BILL_COL_SYN(); // ccc.IS_AUTO = "0"; // ccc.ISPK = "0"; //} //try //{ ViewState["FORM_CTRL_ID"] = "0"; //Response.Write(colid.ToString()); return; SYS_BILL_COL billCol = BLLTable <SYS_BILL_COL> .Factory(conn).GetRowData(SYS_BILL_COL.Attribute.COL_ID, colid); SYS_BILL billObj = BLLTable <SYS_BILL> .Factory(conn).GetRowData(SYS_BILL.Attribute.BILL_ID, billCol.BILL_ID); hidTABLE_NAME.Value = billObj.TABLE_NAME; hidConnSrc.Value = billObj._CONN_SOURCE; if (keyid != "") { valObj = BLLTable <SYS_BILL_COL_SYN> .Factory(conn).GetRowData(SYS_BILL_COL_SYN.Attribute.COL_SYNID, keyid); if (valObj == null) { return; } txtISPK.Value = valObj.ISPK; txtCOL_ID.Value = Convert.ToString(valObj.COL_ID); //Convert.ToInt32 txtBILL_ID.Value = Convert.ToString(valObj.BILL_ID); //Convert.ToInt32 txtTABLE_NAME.Value = Convert.ToString(valObj.TABLE_NAME); //Convert.ToString txtTABLE_NAME1.Value = valObj.TABLE_NAME; txtCOL_NAME.Value = Convert.ToString(valObj.COL_NAME); //Convert.ToString ViewState["txtCOL_NAME"] = txtCOL_NAME.Value; txtCOL_NOTE.Value = Convert.ToString(valObj.COL_NOTE); //Convert.ToString if (valObj.DATA_TYPE.IndexOf('(') >= 0) { txtDATA_TYPE.Value = valObj.DATA_TYPE.Substring(0, valObj.DATA_TYPE.IndexOf('(')).ToLower(); } else { txtDATA_TYPE.Value = Convert.ToString(valObj.DATA_TYPE).ToLower(); //Convert.ToString } txtDATA_LEN.Value = Convert.ToString(valObj.DATA_LEN); //Convert.ToInt32 txtDATA_ACC.Value = Convert.ToString(valObj.DATA_ACC); //Convert.ToInt32 txtIS_AUTO.Value = Convert.ToString(valObj.IS_AUTO); //Convert.ToString txtDB_SRC.Value = valObj.DB_SRC; //Response.Write(valObj.IS_AUTO); txtDVAL.Value = Convert.ToString(valObj.DVAL); //Convert.ToString } else { txtBILL_ID.Value = billCol.BILL_ID.ToString(); txtCOL_ID.Value = colid.ToString(); //txtTABLE_NAME.Value = billObj.TABLE_NAME; } //} //catch (Exception ex) //{ // litWarn.Text = ex.Message; //} } }
protected void Page_Load(object sender, EventArgs e) { title = valObj._ZhName + "编辑"; Page.Title = title; if (!string.IsNullOrEmpty(Request["COL_ID"])) { keyid = Request["COL_ID"]; } if (!string.IsNullOrEmpty(Request["KeyID"])) { keyid = Request["KeyID"]; } if (!string.IsNullOrEmpty(Request["edit"])) { keyid = Request["id"]; billid = int.Parse(Request["pid"]); } else { if (!string.IsNullOrEmpty(Request["id"])) { billid = int.Parse(Request["id"]); } } if (!string.IsNullOrEmpty(Request["billid"])) { billid = int.Parse(Request["billid"]); } if (ViewState["KEYID"] != null) { keyid = ViewState["KEYID"].ToString(); } if (!IsPostBack) { foreach (string s in Enum.GetNames(typeof(DataBaseDataType))) { string nnn = s.Replace("_", ""); txtDATA_TYPE.Items.Add(new ListItem(nnn, nnn)); } if (billid > 0) { //txtSEL_KEY.Items.Add(new ListItem("默认主键ID", "BILL_ID")); SYS_BILL_BLL bllexd = new SYS_BILL_BLL(billid); if (bllexd.PKeyColSyn != null) { string name = bllexd.PKeyColSyn.Base._COL_NOTE; if (name == "") { name = bllexd.PKeyColSyn.COL_NAME; } txtSEL_KEY.Items.Add(new ListItem(name, bllexd.PKeyColSyn.COL_NAME)); } SYS_BILL_COL ccc = new SYS_BILL_COL(); ccc.BILL_ID = billid; ccc.FORM_SHOW = "1"; ccc.IS_AUTO = "0"; ccc.ISPK = "0"; List <SYS_BILL_COL> lstCol = BLLTable <SYS_BILL_COL> .Factory(conn).Select(new SYS_BILL_COL(), ccc); if (lstCol != null) { for (int i = 0; i < lstCol.Count; i++) { //txtCOL_SYN_TO.Items.Add(new ListItem(lstCol[i].COL_NOTE, lstCol[i].COL_NAME)); if (lstCol[i].ISPK == "1") { txtSEL_KEY.Items.Add(new ListItem(lstCol[i].COL_NOTE, lstCol[i].COL_NAME)); } if (!lstCol[i].IsNumber()) { txtSEL_NAME.Items.Add(new ListItem(lstCol[i].COL_NOTE, lstCol[i].COL_NAME)); } } } } //try //{ ViewState["FORM_CTRL_ID"] = "0"; SYS_BILL billObj = BLLTable <SYS_BILL> .Factory(conn).GetRowData(SYS_BILL.Attribute.BILL_ID, billid); hidTABLE_NAME.Value = billObj.TABLE_NAME; if (keyid != "") { valObj = BLLTable <SYS_BILL_COL> .Factory(conn).GetRowData(SYS_BILL_COL.Attribute.COL_ID, keyid); if (valObj == null) { return; } txtISPK.Value = valObj.ISPK; txtCOL_ID.Value = Convert.ToString(valObj.COL_ID); //Convert.ToInt32 txtBILL_ID.Value = Convert.ToString(valObj.BILL_ID); //Convert.ToInt32 txtTABLE_NAME.Value = Convert.ToString(valObj.TABLE_NAME); //Convert.ToString txtCOL_NAME.Value = Convert.ToString(valObj.COL_NAME); //Convert.ToString ViewState["txtCOL_NAME"] = txtCOL_NAME.Value; hidFK_NAME.Value = valObj.FK_NAME; txtCOL_NOTE.Value = Convert.ToString(valObj.COL_NOTE); //Convert.ToString txtDATA_TYPE.Value = Convert.ToString(valObj.DATA_TYPE); //Convert.ToString txtDATA_LEN.Value = Convert.ToString(valObj.DATA_LEN); //Convert.ToInt32 txtDATA_ACC.Value = Convert.ToString(valObj.DATA_ACC); //Convert.ToInt32 txtIS_AUTO.Value = Convert.ToString(valObj.IS_AUTO); //Convert.ToString txtSORT_NO.Value = Convert.ToString(valObj.SORT_NO); //Convert.ToInt32 txtCOL_SHOW.Value = Convert.ToString(valObj.FK_SHOW); //Convert.ToString txtDISPLAY_NAME.Value = Convert.ToString(valObj.DISPLAY_NAME); //Convert.ToString txtTITLE.Value = Convert.ToString(valObj.TITLE); //Convert.ToString txtDVAL.Value = Convert.ToString(valObj.DVAL); //Convert.ToString txtBILL_ROW_FORMULAR.Value = Convert.ToString(valObj.BILL_ROW_FORMULAR); //Convert.ToString txtBILL_COL_FORMULAR.Value = Convert.ToString(valObj.BILL_COL_FORMULAR); //Convert.ToString txtBILL_ISHEADER.Value = Convert.ToString(valObj.BILL_ISHEADER); //Convert.ToString txtBILL_HERDERWIDTH.Value = Convert.ToString(valObj.BILL_HERDERWIDTH); //Convert.ToInt32 txtFORM_CHECKTYPE.Value = Convert.ToString(valObj.FORM_CHECKTYPE); //Convert.ToString //txtFORM_CTRL_ID.Value = Convert.ToString(valObj.FORM_CTRL_ID);//Convert.ToInt32 ViewState["FORM_CTRL_ID"] = valObj.FORM_CTRL_ID; txtFORM_SHOW.Value = Convert.ToString(valObj.FORM_SHOW); //Convert.ToString txtFORM_NEED.Value = Convert.ToString(valObj.FORM_NEED); //Convert.ToString txtFORM_MIN.Value = Convert.ToString(valObj.FORM_MIN); //Convert.ToString txtFORM_MAX.Value = Convert.ToString(valObj.FORM_MAX); //Convert.ToString txtFORM_ONEROW.Value = Convert.ToString(valObj.FORM_ONEROW); //Convert.ToString txtFORM_CTRLWIDTH.Value = Convert.ToString(valObj.FORM_CTRLWIDTH); //Convert.ToInt32 txtSEARCH_INBILL.Value = Convert.ToString(valObj.SEARCH_INBILL); //Convert.ToString txtSEARCH_TYPE.Value = Convert.ToString(valObj.SEARCH_TYPE); //Convert.ToString txtSEARCH_FORMULAR.Value = Convert.ToString(valObj.SEARCH_FORMULAR); //Convert.ToString //hidIsFK.Value = valObj.ISFK; txtBILL_AFTREDTL.Value = valObj.BILL_AFTREDTL; //txtTAVLE_EXISTS.Checked = valObj.TABLE_EXISTS == "1"; //txtCOL_SYN_TO.Value = valObj.COL_SYN_TO; // txtCONN_SOURCE.Value = valObj.CONN_SOURCE; if (!string.IsNullOrEmpty(valObj.SEL_TB_COL)) { string[] arr = valObj.SEL_TB_COL.Split(','); txtSEL_TBNAME.Value = arr[0]; // + "," + txtSEL_KEY.Value = arr[1]; // + "," + txtSEL_NAME.Value = arr[2]; } txtPK_VALCODE.Value = valObj.PK_VALCODE; if ("31,32,33".IndexOf(valObj.FORM_CTRL_ID.ToString()) != -1) { liSetItems.Visible = true; } if (billObj.P_BILL_ID > 0) { dl_BILL_COL_FORMULAR.Visible = true; dl_BILL_ROW_FORMULAR.Visible = true; } else { dl_BILL_COL_FORMULAR.Visible = true; } txtSEL_TBNAME.Value = valObj.TABLE_NAME; if (valObj.IS_COL_EXISTS == "1") { txtCOL_NAME.Disabled = true; txtDATA_TYPE.Disabled = true; txtDATA_LEN.Disabled = true; txtDATA_ACC.Disabled = true; txtTABLE_NAME.Disabled = true; txtIS_AUTO.Disabled = true; txtISPK.Disabled = true; btnSelCol.Visible = false; } } else { txtBILL_ID.Value = billid.ToString(); txtTABLE_NAME.Value = billObj.TABLE_NAME; txtSEL_TBNAME.Value = billObj.TABLE_NAME; SYS_BILL_COL cccmax = new SYS_BILL_COL(); cccmax.BILL_ID = billid; string sort = BLLTable <SYS_BILL_COL> .Max(SYS_BILL_COL.Attribute.SORT_NO, cccmax); if (!string.IsNullOrEmpty(sort)) { txtSORT_NO.Value = (int.Parse(sort) + 1).ToString(); } } #region //初始化控件类型 SYS_BILL_CTRL ctrlCond = new SYS_BILL_CTRL(); ctrlCond.OrderBy(TF_CTRL_TYPE.Attribute.SORT_NO, Order.Asc); DataTable dtCtrl = BLLTable <SYS_BILL_CTRL> .SelectForDataTable(new SYS_BILL_CTRL(), ctrlCond); //ViewState["CTRL_TYPE"] = txtFORM_CTRL_ID.Value; DataView dv1 = new DataView(); dv1.Table = dtCtrl; dv1.RowFilter = "P_CTRL_ID='0'"; dv1.Sort = "SORT_NO asc"; for (int i = 0; i < dv1.Count; i++) { litCTRL_TYPE.Text += "<optgroup label='" + dv1[i]["CTRL_NAME"].ToString() + "'>"; DataView dv2 = new DataView(); dv2.Table = dtCtrl; dv2.RowFilter = "P_CTRL_ID='" + dv1[i]["CTRL_ID"].ToString() + "'"; dv2.Sort = "SORT_NO asc"; for (int a = 0; a < dv2.Count; a++) { if (valObj != null && ViewState["FORM_CTRL_ID"].ToString() == dv2[a]["CTRL_ID"].ToString()) { litCTRL_TYPE.Text += "<option value='" + dv2[a]["CTRL_ID"].ToString() + "' selected='selected'>" + dv2[a]["CTRL_NAME"].ToString() + "</option>"; } else { litCTRL_TYPE.Text += "<option value='" + dv2[a]["CTRL_ID"].ToString() + "'>" + dv2[a]["CTRL_NAME"].ToString() + "</option>"; } } litCTRL_TYPE.Text += "</optgroup>"; } #endregion //} //catch (Exception ex) //{ // litWarn.Text = ex.Message; //} } }
protected void Page_Load(object sender, EventArgs e) { title = valObj._ZhName + "��ϸ"; Page.Title = title; if (!IsPostBack) { try { if (!string.IsNullOrEmpty(Request["COL_ID"])) { valObj = BLLTable<SYS_BILL_COL>.Factory(conn).GetRowData(SYS_BILL_COL.Attribute.COL_ID, Request["COL_ID"]); if(valObj==null) return ; txtCOL_ID.Text = Convert.ToString(valObj.COL_ID);//Convert.ToInt32 txtBILL_ID.Text = Convert.ToString(valObj.BILL_ID);//Convert.ToInt32 txtTABLE_NAME.Text = Convert.ToString(valObj.TABLE_NAME);//Convert.ToString txtCOL_NAME.Text = Convert.ToString(valObj.COL_NAME);//Convert.ToString txtCOL_NOTE.Text = Convert.ToString(valObj.COL_NOTE);//Convert.ToString txtDATA_TYPE.Text = Convert.ToString(valObj.DATA_TYPE);//Convert.ToString txtDATA_LEN.Text = Convert.ToString(valObj.DATA_LEN);//Convert.ToInt32 txtDATA_ACC.Text = Convert.ToString(valObj.DATA_ACC);//Convert.ToInt32 txtIS_AUTO.Text = Convert.ToString(valObj.IS_AUTO);//Convert.ToString txtSORT_NO.Text = Convert.ToString(valObj.SORT_NO);//Convert.ToInt32 txtCOL_SHOW.Text = Convert.ToString(valObj.FK_SHOW);//Convert.ToString txtDISPLAY_NAME.Text = Convert.ToString(valObj.DISPLAY_NAME);//Convert.ToString txtTITLE.Text = Convert.ToString(valObj.TITLE);//Convert.ToString txtDVAL.Text = Convert.ToString(valObj.DVAL);//Convert.ToString txtBILL_ROW_FORMULAR.Text = Convert.ToString(valObj.BILL_ROW_FORMULAR);//Convert.ToString txtBILL_COL_FORMULAR.Text = Convert.ToString(valObj.BILL_COL_FORMULAR);//Convert.ToString txtBILL_ISHEADER.Text = Convert.ToString(valObj.BILL_ISHEADER);//Convert.ToString txtBILL_HERDERWIDTH.Text = Convert.ToString(valObj.BILL_HERDERWIDTH);//Convert.ToInt32 txtFORM_CHECKTYPE.Text = Convert.ToString(valObj.FORM_CHECKTYPE);//Convert.ToString txtFORM_CTRL_ID.Text = Convert.ToString(valObj.FORM_CTRL_ID);//Convert.ToInt32 txtFORM_SHOW.Text = Convert.ToString(valObj.FORM_SHOW);//Convert.ToString txtFORM_NEED.Text = Convert.ToString(valObj.FORM_NEED);//Convert.ToString txtFORM_MIN.Text = Convert.ToString(valObj.FORM_MIN);//Convert.ToString txtFORM_MAX.Text = Convert.ToString(valObj.FORM_MAX);//Convert.ToString txtFORM_ONEROW.Text = Convert.ToString(valObj.FORM_ONEROW);//Convert.ToString txtFORM_CTRLWIDTH.Text = Convert.ToString(valObj.FORM_CTRLWIDTH);//Convert.ToInt32 txtSEARCH_INBILL.Text = Convert.ToString(valObj.SEARCH_INBILL);//Convert.ToString txtSEARCH_TYPE.Text = Convert.ToString(valObj.SEARCH_TYPE);//Convert.ToString txtSEARCH_FORMULAR.Text = Convert.ToString(valObj.SEARCH_FORMULAR);//Convert.ToString } } catch (Exception ex) { litWarn.Text = ex.Message; } if (Request["ajax"] != null) { Response.Clear(); Response.Buffer = true; Response.Charset = "utf-8"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");//���������Ϊ�������� //Response.ContentType = "html/text"; this.EnableViewState = false; System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true); System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad); System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter); divC.RenderControl(oHtmlTextWriter); Response.Write(oStringWriter.ToString()); Response.End(); } } }
protected void btnOK_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(hidCheckFields.Value)) { litWarn.Text = "û��ѡ���ֶ�"; LoadDataBase(false); return; } string[] fieldNames = hidCheckFields.Value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (fieldNames.Length < 1) { litWarn.Text = "û��ѡ���ֶ�"; LoadDataBase(false); return; } string key = ddlDataSource.SelectedValue.Substring(0, ddlDataSource.SelectedValue.LastIndexOf('_')); DataBaseType dataBaseType = (DataBaseType)Enum.Parse(typeof(DataBaseType), ddlDataSource.SelectedValue.Substring(ddlDataSource.SelectedValue.LastIndexOf('_') + 1)); DataBase db = DataBase.Factory(BillBase.GetConnByDevKey(key)); if (db == null) { litWarn.Text = "����ʧ�ܣ���Ч���豸"; LoadDataBase(false); return; } int succCount = 0; SYS_BILL_COL cccmax = new SYS_BILL_COL(); cccmax.BILL_ID = billid; string sortStr = BLLTable<SYS_BILL_COL>.Max(SYS_BILL_COL.Attribute.SORT_NO, cccmax); int sort = 0; if (!string.IsNullOrEmpty(sortStr)) { sort = int.Parse(sortStr) + 1; } SYS_BILL billObj = BLLTable<SYS_BILL>.Factory(conn).GetRowData(SYS_BILL.Attribute.BILL_ID, billid); SYS_BILL_CTRL ctrlCond = new SYS_BILL_CTRL(); ctrlCond.OrderBy(TF_CTRL_TYPE.Attribute.SORT_NO, Order.Asc); DataTable dtCtrl = BLLTable<SYS_BILL_CTRL>.SelectForDataTable(new SYS_BILL_CTRL(), ctrlCond); DataView dv1 = new DataView(); dv1.Table = dtCtrl; dv1.RowFilter = "P_CTRL_ID='0'"; dv1.Sort = "SORT_NO asc"; int ctrlid = 0; if (dtCtrl != null && dtCtrl.Rows.Count > 1) { ctrlid = int.Parse(dv1[0]["CTRL_ID"].ToString()); } StringBuilder treeSb = new StringBuilder(); foreach (string fieldName in fieldNames) { if (string.IsNullOrEmpty(fieldName)) continue; string[] tableField = fieldName.Split('.'); if (tableField.Length != 2) continue; if (!db.DataTables.Contains(tableField[0])) continue; DataBaseTable table = db.DataTables[tableField[0]]; if (!table.DataFields.Contains(tableField[1])) continue; DataBaseField field = table.DataFields[tableField[1]]; SYS_BILL_COL valObj = new SYS_BILL_COL(); if (txtBILL_ID.Value != "") valObj.BILL_ID = Convert.ToInt32(txtBILL_ID.Value); valObj.COL_NAME = (key == "conn" ? "AIO_SYN" : key) + "_" + table.TableName + "_" + field.FieldName; if (BLLTable<SYS_BILL_COL>.Exists(valObj)) continue; #region valObj.TABLE_NAME = table.TableName; valObj.ISPK = field.IsKeyID ? "1" : "0"; valObj.COL_NOTE = ddlDataSource.SelectedItem.Text + (string.IsNullOrEmpty(field.Desc.ZhName) ? field.FieldName : field.Desc.ZhName); valObj.DATA_TYPE = field.DataType.TypeName.ToString().Replace("_", ""); valObj.DATA_LEN = field.DataType.DataLen; valObj.DATA_ACC = field.DataType.Scale; valObj.IS_AUTO = field.IsAutoIncrease ? "1" : "0"; valObj.SORT_NO = sort++; valObj.FK_SHOW = field.FieldName; valObj.DISPLAY_NAME = valObj.COL_NOTE; valObj.TITLE = valObj.COL_NOTE; valObj.DVAL = field.DefaultValue; valObj.BILL_ROW_FORMULAR = ""; valObj.BILL_COL_FORMULAR = ""; valObj.BILL_ISHEADER = "1"; valObj.BILL_HERDERWIDTH = 0; valObj.FORM_CHECKTYPE = "string"; valObj.FORM_CTRL_ID = ctrlid; valObj.FORM_SHOW = "1"; valObj.FORM_NEED = "1"; valObj.FORM_ONEROW = "1"; valObj.SEARCH_INBILL = "1"; valObj.SEARCH_TYPE = "string"; valObj.SEARCH_FORMULAR = "LikeRight"; if (billObj.TABLE_NAME != valObj.TABLE_NAME && key != "conn" && valObj.ISPK == "1") { valObj.ISFK = "1"; } else { valObj.ISFK = "0"; } valObj.FK_NAME = field.FieldName; valObj.BILL_AFTREDTL = "0"; //valObj.TABLE_EXISTS = "1"; //valObj.COL_SYN_TO = ""; //valObj.CONN_SOURCE = key == "conn" ? "AIO_SYN" : key; valObj.PK_VALCODE = ""; #endregion SYS_BILL_COL_EXD billExd = new SYS_BILL_COL_EXD(valObj); count = billExd.Add(); if (count > 0) { if (Request["tree"] != null) { StringBuilder sb = new StringBuilder("{"); sb.Append("id:'"); sb.Append(keyid).Append("',pid:'").Append(valObj.BILL_ID).Append("',no:").Append(valObj.SORT_NO).Append(",sc:0,name:'"); sb.Append(valObj.COL_NAME + "[" + valObj.COL_NOTE + "]").Append("',ntype:'col'}"); treeSb.Append(sb.ToString()); } else { #region StringBuilder sbData = new StringBuilder("{valObj:''"); List<AttributeItem> lstCol = valObj.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { object val = valObj.GetValue(lstCol[i]); if (val != null) { sbData.Append(",").Append(lstCol[i].FieldName).Append(":'").Append(val.ToString()).Append("'"); } } sbData.Append("}"); treeSb.Append(sbData.ToString()); #endregion } succCount++; } } if (succCount > 0) { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "_FormView();", false); litWarn.Text = "�ɹ����" + succCount + "����Ŀ"; } else { litWarn.Text = "��Ŀ���ʧ��"; } LoadDataBase(false); }
protected void btnFind_Click(object sender, EventArgs e) { try { condObj = new SYS_BILL_COL(); if(txtCOL_ID.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.COL_ID, Convert.ToInt32(txtCOL_ID.Value)); if(txtBILL_ID.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.BILL_ID, Convert.ToInt32(txtBILL_ID.Value)); if(txtTABLE_NAME.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.TABLE_NAME, Convert.ToString(txtTABLE_NAME.Value)); if(txtCOL_NAME.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.COL_NAME, Convert.ToString(txtCOL_NAME.Value)); if(txtCOL_NOTE.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.COL_NOTE, Convert.ToString(txtCOL_NOTE.Value)); if(txtDATA_TYPE.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.DATA_TYPE, Convert.ToString(txtDATA_TYPE.Value)); if(txtDATA_LEN.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.DATA_LEN, Convert.ToInt32(txtDATA_LEN.Value)); if(txtDATA_ACC.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.DATA_ACC, Convert.ToInt32(txtDATA_ACC.Value)); if(txtIS_AUTO.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.IS_AUTO, Convert.ToString(txtIS_AUTO.Value)); if(txtSORT_NO.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.SORT_NO, Convert.ToInt32(txtSORT_NO.Value)); if(txtCOL_SHOW.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.FK_SHOW, Convert.ToString(txtCOL_SHOW.Value)); if(txtDISPLAY_NAME.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.DISPLAY_NAME, Convert.ToString(txtDISPLAY_NAME.Value)); if(txtTITLE.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.TITLE, Convert.ToString(txtTITLE.Value)); if(txtDVAL.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.DVAL, Convert.ToString(txtDVAL.Value)); if(txtBILL_ROW_FORMULAR.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.BILL_ROW_FORMULAR, Convert.ToString(txtBILL_ROW_FORMULAR.Value)); if(txtBILL_COL_FORMULAR.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.BILL_COL_FORMULAR, Convert.ToString(txtBILL_COL_FORMULAR.Value)); if(txtBILL_ISHEADER.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.BILL_ISHEADER, Convert.ToString(txtBILL_ISHEADER.Value)); if(txtBILL_HERDERWIDTH.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.BILL_HERDERWIDTH, Convert.ToInt32(txtBILL_HERDERWIDTH.Value)); if(txtFORM_CHECKTYPE.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.FORM_CHECKTYPE, Convert.ToString(txtFORM_CHECKTYPE.Value)); if(txtFORM_CTRL_ID.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.FORM_CTRL_ID, Convert.ToInt32(txtFORM_CTRL_ID.Value)); if(txtFORM_SHOW.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.FORM_SHOW, Convert.ToString(txtFORM_SHOW.Value)); if(txtFORM_NEED.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.FORM_NEED, Convert.ToString(txtFORM_NEED.Value)); if(txtFORM_MIN.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.FORM_MIN, Convert.ToString(txtFORM_MIN.Value)); if(txtFORM_MAX.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.FORM_MAX, Convert.ToString(txtFORM_MAX.Value)); if(txtFORM_ONEROW.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.FORM_ONEROW, Convert.ToString(txtFORM_ONEROW.Value)); if(txtFORM_CTRLWIDTH.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.FORM_CTRLWIDTH, Convert.ToInt32(txtFORM_CTRLWIDTH.Value)); if(txtSEARCH_INBILL.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.SEARCH_INBILL, Convert.ToString(txtSEARCH_INBILL.Value)); if(txtSEARCH_TYPE.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.SEARCH_TYPE, Convert.ToString(txtSEARCH_TYPE.Value)); if(txtSEARCH_FORMULAR.Value !="" ) condObj.Like(SYS_BILL_COL.Attribute.SEARCH_FORMULAR, Convert.ToString(txtSEARCH_FORMULAR.Value)); listObj = BLLTable<SYS_BILL_COL>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount); repCus.DataSource = listObj; repCus.DataBind(); } catch (Exception ex) { litWarn.Text = ex.Message; } aspPager.RecordCount = recount; }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["COL_ID"])) { keyid = Request["COL_ID"]; } if (!string.IsNullOrEmpty(Request["KeyID"])) { keyid = Request["KeyID"]; } if (!string.IsNullOrEmpty(Request["edit"])) { keyid = Request["id"]; tbname = Request["pid"]; } else { tbname = Request["id"]; } if (ViewState["KEYID"] != null) { keyid = ViewState["KEYID"].ToString(); } if (!IsPostBack) { //try //{ ViewState["FORM_CTRL_ID"] = "0"; //SYS_BILL billObj = BLLTable<SYS_BILL>.Factory(conn).GetRowData(SYS_BILL.Attribute.BILL_ID, billid); hidTABLE_NAME.Value = tbname; foreach (string s in Enum.GetNames(typeof(DataBaseDataType))) { string nnn = s.Replace("_",""); txtDATA_TYPE.Items.Add(new ListItem(nnn, nnn)); } if (keyid != "") { SYS_BILL_COL col = new SYS_BILL_COL(); col.TABLE_NAME = tbname; col.COL_NAME = keyid; SYS_BILL_COL_EXD coleee = new SYS_BILL_COL_EXD(col);//��ȡ�������ݿ�������ԭ���DZ��ģ�� valObj = coleee.DB_GetColByField(tbname, keyid); if (valObj == null) return; if (valObj.COL_NAME.IndexOf("U_") != 0 && valObj.COL_NAME.IndexOf("u_") != 0) { Response.Write("�Բ��������߱��༭���ֶε�Ȩ�ޡ�"); Response.End(); return; } txtISPK.Value = valObj.ISPK; txtCOL_ID.Value = Convert.ToString(valObj.COL_ID);//Convert.ToInt32 txtBILL_ID.Value = Convert.ToString(valObj.BILL_ID);//Convert.ToInt32 txtTABLE_NAME.Value = Convert.ToString(valObj.TABLE_NAME);//Convert.ToString txtCOL_NAME.Value = Convert.ToString(valObj.COL_NAME.Remove(0, 2));//Convert.ToString ViewState["txtCOL_NAME"] = "U_" + txtCOL_NAME.Value; hidFK_NAME.Value = valObj.FK_NAME; txtCOL_NOTE.Value = Convert.ToString(valObj.COL_NOTE);//Convert.ToString txtDATA_TYPE.Value = valObj.DATA_TYPE;// Response.Write(valObj.DATA_TYPE); txtDATA_LEN.Value = Convert.ToString(valObj.DATA_LEN);//Convert.ToInt32 txtDATA_ACC.Value = Convert.ToString(valObj.DATA_ACC);//Convert.ToInt32 txtIS_AUTO.Value = Convert.ToString(valObj.IS_AUTO);//Convert.ToString txtSORT_NO.Value = Convert.ToString(valObj.SORT_NO);//Convert.ToInt32 txtCOL_SHOW.Value = Convert.ToString(valObj.FK_SHOW);//Convert.ToString //txtDISPLAY_NAME.Value = Convert.ToString(valObj.DISPLAY_NAME);//Convert.ToString txtTITLE.Value = Convert.ToString(valObj.TITLE);//Convert.ToString txtDVAL.Value = Convert.ToString(valObj.DVAL);//Convert.ToString ViewState["FORM_CTRL_ID"] = valObj.FORM_CTRL_ID; txtPK_VALCODE.Value = valObj.PK_VALCODE; if ("31,32,33".IndexOf(valObj.FORM_CTRL_ID.ToString()) != -1) { liSetItems.Visible = true; } if (valObj.IS_COL_EXISTS == "1") { txtCOL_NAME.Disabled = true; txtDATA_TYPE.Disabled = true; txtDATA_LEN.Disabled = true; txtDATA_ACC.Disabled = true; txtTABLE_NAME.Disabled = true; txtIS_AUTO.Disabled = true; txtISPK.Disabled = true; btnSelCol.Visible = false; } } else { txtBILL_ID.Value = tbname; txtTABLE_NAME.Value = tbname; } //} //catch (Exception ex) //{ // litWarn.Text = ex.Message; //} } }
protected void Page_Load(object sender, EventArgs e) { #region////显示子节点 if (Request["getSubNodes"] != null) { string nodetype = Request["ntype"]; StringBuilder sb = new StringBuilder("["); string id = Request["id"]; if (nodetype == "bill-root") { #region SYS_BILL obj = new SYS_BILL(); SYS_BILL val = new SYS_BILL(); obj.P_BILL_ID = 0; //obj.STATUS = "1"; bool fromtb = Request["TB"] != null; if (Request["TB"] == null) { obj.Where("STATUS<>'0'"); } val.af_PageBy(SYS_BILL.Attribute.BILL_ID, Order.Asc); List <SYS_BILL> lst = BLLTable <SYS_BILL> .Factory(conn).Select(val, obj); if (lst.Count != null) { for (int i = 0; i < lst.Count; i++) { if (sb.Length > 2) { sb.Append(","); } sb.Append("{id:'").Append(lst[i].BILL_ID); sb.Append("',pid:'").Append("0").Append("',no:").Append(lst[i].BILL_ID); sb.Append(",sc:").Append("1"); sb.Append(",name:'").Append(lst[i].BILL_NAME + (lst[i].STATUS == "11"?"(已删)":"")).Append("',note:''").Append(",ntype:'bill'}"); } } #endregion } if (nodetype == "bill" || nodetype == "bill-mx") { if (nodetype == "bill") { #region 载入明细表单 SYS_BILL objTB = new SYS_BILL(); SYS_BILL valTB = new SYS_BILL(); objTB.P_BILL_ID = int.Parse(id); valTB.OrderBy(SYS_BILL.Attribute.BILL_ID, Order.Asc); List <SYS_BILL> lstTB = BLLTable <SYS_BILL> .Factory(conn).Select(valTB, objTB); if (lstTB.Count != null) { for (int i = 0; i < lstTB.Count; i++) { if (sb.Length > 2) { sb.Append(","); } sb.Append("{id:'").Append(lstTB[i].BILL_ID); sb.Append("',pid:'").Append(id).Append("',no:").Append(lstTB[i].BILL_ID); sb.Append(",sc:").Append("1"); sb.Append(",name:'").Append(lstTB[i].BILL_NAME).Append("',note:''").Append(",ntype:'bill-mx'}"); } } #endregion } #region 载入列 SYS_BILL_COL obj = new SYS_BILL_COL(); SYS_BILL_COL val = new SYS_BILL_COL(); obj.BILL_ID = int.Parse(id); //obj.Where("COL_NAME not in('MX_ID','BILL_ID')"); val.af_PageBy(SYS_BILL_COL.Attribute.SORT_NO, Order.Asc); List <SYS_BILL_COL> lst = BLLTable <SYS_BILL_COL> .Factory(conn).Select(val, obj); if (lst.Count > 0) { for (int i = 0; i < lst.Count; i++) { if (sb.Length > 2) { sb.Append(","); } sb.Append("{id:'").Append(lst[i].COL_ID.ToString()); sb.Append("',pid:'").Append(lst[i].BILL_ID.ToString()).Append("',no:").Append(lst[i].SORT_NO); sb.Append(",sc:").Append("1"); sb.Append(",name:'").Append(lst[i].COL_NAME).Append("',note:'[" + lst[i].COL_NOTE + "]'").Append(",ntype:'col'}"); } } #endregion }//选中了表单列 if (nodetype == "col") { SYS_BILL_COL_SYN obj = new SYS_BILL_COL_SYN(); SYS_BILL_COL_SYN val = new SYS_BILL_COL_SYN(); obj.COL_ID = int.Parse(id); //obj.Where("COL_NAME not in('MX_ID','BILL_ID')"); //val.af_PageBy(SYS_BILL_COL_SYN.Attribute.SORT_NO, Order.Asc); List <SYS_BILL_COL_SYN> lst = BLLTable <SYS_BILL_COL_SYN> .Factory(conn).Select(val, obj); if (lst.Count > 0) { for (int i = 0; i < lst.Count; i++) { if (sb.Length > 2) { sb.Append(","); } sb.Append("{id:'").Append(lst[i].COL_SYNID.ToString()); sb.Append("',pid:'").Append(lst[i].COL_ID.ToString()).Append("',no:").Append("0"); sb.Append(",sc:").Append("0"); sb.Append(",name:'").Append("[" + lst[i].DB_SRC + "].[" + lst[i].TABLE_NAME + "].[" + lst[i].COL_NAME + "]").Append("',note:'[" + lst[i].COL_NOTE + "]'").Append(",ntype:'syncol'}"); } } } //sb.Append("{id:'").Append("1"); //sb.Append("',pid:'").Append("0").Append("',no:").Append("1"); //sb.Append(",sc:").Append("1"); //sb.Append(",name:'").Append("aaaaa(aaa)").Append("',ntype:'table'}"); sb.Append("]"); Response.Write(sb.ToString()); } #endregion #region//删除节点 if (Request["deleteNode"] != null) { string str = ""; string delID = Request["id"]; string ntype = Request["ntype"]; if (ntype == "bill" || ntype == "bill-mx") { #region//删除表 SYS_BILL_EXD eee = new SYS_BILL_EXD(int.Parse(delID)); string msg = ""; int re = eee.Delete(out msg); #endregion str = "{re:" + re + ",msg:'" + msg + "'}"; } else if (ntype == "col") { #region//删除表字段 string msg = "删除数据库表字段成功!"; SYS_BILL_EXD bllexd = new SYS_BILL_EXD(int.Parse(Request["pid"])); int re = bllexd.DeleteCol(int.Parse(delID));// TF_TABLEHelper.DelField(delID);// ; if (re > 0) { msg = "删除数据库表字段成功!"; } else { msg = "删除数据库表字段失败!"; } #endregion str = "{re:" + re + ",msg:'" + msg + "'}"; } else if (ntype == "syncol") { #region//删除表字段 string msg = "删除同步字段成功!"; int re = BLLTable <SYS_BILL_COL_SYN> .Factory(conn).Delete(SYS_BILL_COL_SYN.Attribute.COL_SYNID, delID); if (re > 0) { msg = "删除同步字段成功!"; } else { msg = "删除同步字段失败!"; } #endregion str = "{re:" + re + ",msg:'" + msg + "'}"; } Response.Write(str); } #endregion #region//导入字段 if (Request["intbCols"] != null) { string pid = Request["pid"]; string id = Request["id"]; string billid = Request["billid"]; DataBaseTable tbllext = DataBase.Factory(conn).DataTables[pid];// new DataBaseTable(_Base.TABLE_NAME, "", dbROG); DataBaseFieldCollection fields = tbllext.DataFields; string keys = ""; DataBaseField fs = fields[id]; if (fs.IsKeyID == true) { keys += keys == "" ? fs.FieldName : "," + fs.FieldName; } SYS_BILL_COL col = AgileFrame.AppInOne.SYS.SysDataBaseHelper.FieldToCol(fs, int.Parse(billid)); SYS_BILL_COL ccc = new SYS_BILL_COL(); ccc.BILL_ID = int.Parse(billid); ccc.COL_NAME = fs.FieldName.ToUpper(); int re = 1; SYS_BILL_COL oldCol = BLLTable <SYS_BILL_COL> .Factory(conn).GetRowData(new SYS_BILL_COL(), ccc); int colid = 0; if (oldCol == null) { re = BLLTable <SYS_BILL_COL> .Factory(conn).Insert(col, SYS_BILL_COL.Attribute.COL_ID); colid = col.COL_ID; } else { colid = oldCol.COL_ID; } if (re > 0) { SYS_BILL_COL_SYN valObj = new SYS_BILL_COL_SYN(); valObj.BILL_ID = Convert.ToInt32(Request["billid"]); valObj.COL_NAME = fs.FieldName.ToUpper(); valObj.TABLE_NAME = Request["tb"]; valObj.COL_ID = colid; valObj.ISPK = fs.IsKeyID == true ? "1" : "0"; valObj.COL_NOTE = fs.Desc.ZhName; valObj.DATA_TYPE = fs.DataType.TypeNameString; valObj.DATA_LEN = fs.DataType.DataLen; valObj.DATA_ACC = fs.DataType.Scale; valObj.IS_AUTO = fs.IsAutoIncrease == true ? "1" : "0"; valObj.DVAL = fs.DefaultValue; valObj.DB_SRC = Request["dev"]; valObj.PK_VALCODE = ""; BLLTable <SYS_BILL_COL_SYN> .InsertReturnID(valObj); } //记录主键到表单 if (keys != "") { BLLTable <SYS_BILL> .Factory(conn).Update(SYS_BILL.Attribute.BILL_ID, billid, SYS_BILL.Attribute.KEYS, keys); } Response.Write("ok"); } #endregion #region if (Request["addSynCols"] != null) { string[] aaa = StringHelper.GetStringArray(Request["ids"], ','); for (int i = 0; i < aaa.Length; i++) { string[] bbb = aaa[i].Split('.'); if (bbb[2] != "col") { continue; } DataBaseTable tbllext = DataBase.Factory(conn).DataTables[bbb[0]]; DataBaseField fs = tbllext.DataFields[bbb[1]]; SYS_BILL_COL_SYN valObj = new SYS_BILL_COL_SYN(); valObj.BILL_ID = Convert.ToInt32(Request["billid"]); valObj.COL_ID = Convert.ToInt32(Request["colid"]); valObj.COL_NAME = fs.FieldName; if (!BLLTable <SYS_BILL_COL_SYN> .Exists(valObj)) { valObj.TABLE_NAME = tbllext.TableName; valObj.ISPK = fs.IsKeyID == true ? "1" : "0"; valObj.COL_NOTE = fs.Desc.ZhName; valObj.DATA_TYPE = fs.DataType.TypeNameString.Replace("_", ""); valObj.DATA_LEN = fs.DataType.DataLen; valObj.DATA_ACC = fs.DataType.Scale; valObj.IS_AUTO = fs.IsAutoIncrease == true ? "1" : "0"; valObj.DVAL = fs.DefaultValue; valObj.DB_SRC = bbb[0]; valObj.PK_VALCODE = ""; BLLTable <SYS_BILL_COL_SYN> .InsertReturnID(valObj); } } Response.Write("ok"); } #endregion #region//彻底删除表单 if (Request["clearBill"] != null) { #region//删除表 string str = ""; string delID = Request["id"]; SYS_BILL_EXD eee = new SYS_BILL_EXD(int.Parse(delID)); string msg = ""; int re = eee.Delete(out msg); #endregion str = "{re:" + re + ",msg:'" + msg + "'}"; Response.Write(str); } #endregion //在列表里点击删除按钮,通过AJAX执行这里的后台代码,删除一条记录 if (Request["DelBILL_ID"] != null) { int re = BLLTable <SYS_BILL> .Factory(conn).Delete(SYS_BILL.Attribute.BILL_ID, Request["DelBILL_ID"]); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } //在列表顶部点击删除按钮,通过AJAX执行这里的后台代码,删除多条记录 if (Request["DelKeyIDS"] != null) { SYS_BILL cond = new SYS_BILL(); cond.In(SYS_BILL.Attribute.BILL_ID, Request["DelKeyIDS"]); int re = BLLTable <SYS_BILL> .Factory(conn).Delete(cond); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } //在用户详细信息查看编辑页面,点保存时,通过AJAX执行这里的后台代码,实现部门字段的更新 if (Request["saveInfo"] != null) { SYS_BILL val = new SYS_BILL(); val.BILL_ID = int.Parse(Request["FieldKeyID"]); List <AttributeItem> lstCol = val.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { if (!string.IsNullOrEmpty(Request["txt" + lstCol[i].FieldName])) { val.SetValue(lstCol[i].FieldName, Request["txt" + lstCol[i].FieldName]); } } BLLTable <SYS_BILL> .Factory(conn).Update(val, SYS_BILL.Attribute.BILL_ID); Response.Write("修改用户信息成功"); } Response.End(); }
protected void btnOK_Click(object sender, EventArgs e) { //try //{ SYS_BILL_COL valObj = new SYS_BILL_COL(); if (txtTABLE_NAME.Value != "") { valObj.TABLE_NAME = Convert.ToString(txtTABLE_NAME.Value); } if (txtCOL_NAME.Value != "") { valObj.COL_NAME = Convert.ToString(txtCOL_NAME.Value); } if (keyid == "") { if (BLLTable <SYS_BILL_COL> .Exists(valObj)) { litWarn.Text = "已经存在此字段!"; return; } } #region valObj.ISPK = txtISPK.Value; if (txtCOL_NOTE.Value != "") { valObj.COL_NOTE = Convert.ToString(txtCOL_NOTE.Value); } if (txtDATA_TYPE.Value != "") { valObj.DATA_TYPE = Convert.ToString(txtDATA_TYPE.Value); } if (txtDATA_LEN.Value != "") { valObj.DATA_LEN = Convert.ToInt32(txtDATA_LEN.Value); } if (txtDATA_ACC.Value != "") { valObj.DATA_ACC = Convert.ToInt32(txtDATA_ACC.Value); } if (txtIS_AUTO.Value != "") { valObj.IS_AUTO = Convert.ToString(txtIS_AUTO.Value); } if (txtSORT_NO.Value != "") { valObj.SORT_NO = Convert.ToInt32(txtSORT_NO.Value); } if (txtCOL_SHOW.Value != "") { valObj.FK_SHOW = Convert.ToString(txtCOL_SHOW.Value); } if (txtTITLE.Value != "") { valObj.TITLE = Convert.ToString(txtTITLE.Value); } if (txtDVAL.Value != "") { valObj.DVAL = Convert.ToString(txtDVAL.Value); } if (hidTABLE_NAME.Value != txtTABLE_NAME.Value && txtCONN_SOURCE.Value != "AIO" && valObj.ISPK == "1") { valObj.ISFK = "1"; } else { valObj.ISFK = "0"; } valObj.FK_NAME = hidFK_NAME.Value; valObj.PK_VALCODE = txtPK_VALCODE.Value; #endregion string msg = ""; try { if (ViewState["txtCOL_NAME"] != null) { //valObj.COL_ID = Convert.ToInt32(keyid); SYS_BILL_COL_EXD billExd = new SYS_BILL_COL_EXD(valObj); count = billExd.DB_Update(ViewState["txtCOL_NAME"].ToString(), valObj, ref msg);//.Update(ViewState["txtCOL_NAME"].ToString());// BLLTable<SYS_BILL_COL>.Factory(conn).Update(valObj, SYS_BILL_COL.Attribute.COL_ID); } else { SYS_BILL_COL_EXD billExd = new SYS_BILL_COL_EXD(valObj); count = billExd.DB_AddField(ref msg) == true ? 1 : 0;// BLLTable<SYS_BILL_COL>.Factory(conn).Insert(valObj, SYS_BILL_COL.Attribute.COL_ID); keyid = count.ToString(); ViewState["KEYID"] = keyid; } } catch (Exception ee) { Response.Write("操作失败,请重新选择节点!"); Response.End(); } string syscolname = valObj.COL_NAME.ToLower().IndexOf("u_") == 0 ? "[客户字段]" : "[系统字段]"; if (count > 0) { if ("31,32,33".IndexOf(valObj.FORM_CTRL_ID.ToString()) != -1) { liSetItems.Visible = true; } else { liSetItems.Visible = false; } ViewState["txtCOL_NAME"] = valObj.COL_NAME; if (Request["tree"] != null) { StringBuilder sb = new StringBuilder("{"); sb.Append("id:'").Append(valObj.COL_NAME.ToString()); sb.Append("',pid:'").Append(valObj.TABLE_NAME).Append("',no:").Append("1"); sb.Append(",sc:").Append("0,dev:'" + Request["dev"] + "',tb:'" + Request["tb"] + "'"); sb.Append(",name:'").Append(valObj.COL_NAME).Append("',note:'[" + valObj.COL_NOTE + "]'").Append(",ntype:'col'}"); if (Request["edit"] == null) { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "parent.TV.showSubNodes(\"" + sb.ToString() + "\");", false); } else { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "parent.TV.editNodeInfo(\"" + sb.ToString() + "\");", false); } litWarn.Text = "保存" + syscolname + "成功"; } else { #region StringBuilder sbData = new StringBuilder("{valObj:''"); List <AttributeItem> lstCol = valObj.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { object val = valObj.GetValue(lstCol[i]); if (val != null) { sbData.Append(",").Append(lstCol[i].FieldName).Append(":'").Append(val.ToString()).Append("'"); } } sbData.Append("}"); if (ViewState["sbData"] == null) { ViewState["sbData"] = sbData.ToString(); } else { ViewState["sbData"] += "," + sbData.ToString(); } Button btn = (Button)sender; if (btn.ID.IndexOf("btnOK") != -1) { if (ViewState["sbData"] == null) { string dataStr = "[" + ViewState["sbData"].ToString() + "]"; ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "_FormView();if (window.opener){window.opener.returnValue = '" + dataStr + "';}else{window.returnValue = '" + dataStr + "';}window.close();", true); } else { ScriptManager.RegisterStartupScript(Page, this.GetType(), "goto", "_FormView();if (window.opener){window.opener.returnValue = 're';}else{window.returnValue = 're';}window.close();", true); } } else { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "_FormView();", false); txtTABLE_NAME.Value = ""; txtCOL_NAME.Value = ""; hidTABLE_NAME.Value = ""; } #endregion } } else { litWarn.Text = "修改" + syscolname + "失败!"; } //} //catch (Exception ex) //{ // litWarn.Text = ex.Message; //} }
protected void btnFind_Click(object sender, EventArgs e) { try { condObj = new SYS_BILL_COL(); if (txtCOL_ID.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.COL_ID, Convert.ToInt32(txtCOL_ID.Value)); } if (txtBILL_ID.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.BILL_ID, Convert.ToInt32(txtBILL_ID.Value)); } if (txtTABLE_NAME.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.TABLE_NAME, Convert.ToString(txtTABLE_NAME.Value)); } if (txtCOL_NAME.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.COL_NAME, Convert.ToString(txtCOL_NAME.Value)); } if (txtCOL_NOTE.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.COL_NOTE, Convert.ToString(txtCOL_NOTE.Value)); } if (txtDATA_TYPE.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.DATA_TYPE, Convert.ToString(txtDATA_TYPE.Value)); } if (txtDATA_LEN.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.DATA_LEN, Convert.ToInt32(txtDATA_LEN.Value)); } if (txtDATA_ACC.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.DATA_ACC, Convert.ToInt32(txtDATA_ACC.Value)); } if (txtIS_AUTO.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.IS_AUTO, Convert.ToString(txtIS_AUTO.Value)); } if (txtSORT_NO.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.SORT_NO, Convert.ToInt32(txtSORT_NO.Value)); } if (txtCOL_SHOW.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.FK_SHOW, Convert.ToString(txtCOL_SHOW.Value)); } if (txtDISPLAY_NAME.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.DISPLAY_NAME, Convert.ToString(txtDISPLAY_NAME.Value)); } if (txtTITLE.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.TITLE, Convert.ToString(txtTITLE.Value)); } if (txtDVAL.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.DVAL, Convert.ToString(txtDVAL.Value)); } if (txtBILL_ROW_FORMULAR.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.BILL_ROW_FORMULAR, Convert.ToString(txtBILL_ROW_FORMULAR.Value)); } if (txtBILL_COL_FORMULAR.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.BILL_COL_FORMULAR, Convert.ToString(txtBILL_COL_FORMULAR.Value)); } if (txtBILL_ISHEADER.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.BILL_ISHEADER, Convert.ToString(txtBILL_ISHEADER.Value)); } if (txtBILL_HERDERWIDTH.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.BILL_HERDERWIDTH, Convert.ToInt32(txtBILL_HERDERWIDTH.Value)); } if (txtFORM_CHECKTYPE.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.FORM_CHECKTYPE, Convert.ToString(txtFORM_CHECKTYPE.Value)); } if (txtFORM_CTRL_ID.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.FORM_CTRL_ID, Convert.ToInt32(txtFORM_CTRL_ID.Value)); } if (txtFORM_SHOW.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.FORM_SHOW, Convert.ToString(txtFORM_SHOW.Value)); } if (txtFORM_NEED.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.FORM_NEED, Convert.ToString(txtFORM_NEED.Value)); } if (txtFORM_MIN.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.FORM_MIN, Convert.ToString(txtFORM_MIN.Value)); } if (txtFORM_MAX.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.FORM_MAX, Convert.ToString(txtFORM_MAX.Value)); } if (txtFORM_ONEROW.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.FORM_ONEROW, Convert.ToString(txtFORM_ONEROW.Value)); } if (txtFORM_CTRLWIDTH.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.FORM_CTRLWIDTH, Convert.ToInt32(txtFORM_CTRLWIDTH.Value)); } if (txtSEARCH_INBILL.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.SEARCH_INBILL, Convert.ToString(txtSEARCH_INBILL.Value)); } if (txtSEARCH_TYPE.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.SEARCH_TYPE, Convert.ToString(txtSEARCH_TYPE.Value)); } if (txtSEARCH_FORMULAR.Value != "") { condObj.Like(SYS_BILL_COL.Attribute.SEARCH_FORMULAR, Convert.ToString(txtSEARCH_FORMULAR.Value)); } listObj = BLLTable <SYS_BILL_COL> .Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount); repCus.DataSource = listObj; repCus.DataBind(); } catch (Exception ex) { litWarn.Text = ex.Message; } aspPager.RecordCount = recount; }
protected void Page_Load(object sender, EventArgs e) { title = valObj._ZhName + "详细"; Page.Title = title; if (!IsPostBack) { try { if (!string.IsNullOrEmpty(Request["COL_ID"])) { valObj = BLLTable <SYS_BILL_COL> .Factory(conn).GetRowData(SYS_BILL_COL.Attribute.COL_ID, Request["COL_ID"]); if (valObj == null) { return; } txtCOL_ID.Text = Convert.ToString(valObj.COL_ID);//Convert.ToInt32 txtBILL_ID.Text = Convert.ToString(valObj.BILL_ID);//Convert.ToInt32 txtTABLE_NAME.Text = Convert.ToString(valObj.TABLE_NAME);//Convert.ToString txtCOL_NAME.Text = Convert.ToString(valObj.COL_NAME);//Convert.ToString txtCOL_NOTE.Text = Convert.ToString(valObj.COL_NOTE);//Convert.ToString txtDATA_TYPE.Text = Convert.ToString(valObj.DATA_TYPE);//Convert.ToString txtDATA_LEN.Text = Convert.ToString(valObj.DATA_LEN);//Convert.ToInt32 txtDATA_ACC.Text = Convert.ToString(valObj.DATA_ACC);//Convert.ToInt32 txtIS_AUTO.Text = Convert.ToString(valObj.IS_AUTO);//Convert.ToString txtSORT_NO.Text = Convert.ToString(valObj.SORT_NO);//Convert.ToInt32 txtCOL_SHOW.Text = Convert.ToString(valObj.FK_SHOW);//Convert.ToString txtDISPLAY_NAME.Text = Convert.ToString(valObj.DISPLAY_NAME);//Convert.ToString txtTITLE.Text = Convert.ToString(valObj.TITLE);//Convert.ToString txtDVAL.Text = Convert.ToString(valObj.DVAL);//Convert.ToString txtBILL_ROW_FORMULAR.Text = Convert.ToString(valObj.BILL_ROW_FORMULAR);//Convert.ToString txtBILL_COL_FORMULAR.Text = Convert.ToString(valObj.BILL_COL_FORMULAR);//Convert.ToString txtBILL_ISHEADER.Text = Convert.ToString(valObj.BILL_ISHEADER);//Convert.ToString txtBILL_HERDERWIDTH.Text = Convert.ToString(valObj.BILL_HERDERWIDTH);//Convert.ToInt32 txtFORM_CHECKTYPE.Text = Convert.ToString(valObj.FORM_CHECKTYPE);//Convert.ToString txtFORM_CTRL_ID.Text = Convert.ToString(valObj.FORM_CTRL_ID);//Convert.ToInt32 txtFORM_SHOW.Text = Convert.ToString(valObj.FORM_SHOW);//Convert.ToString txtFORM_NEED.Text = Convert.ToString(valObj.FORM_NEED);//Convert.ToString txtFORM_MIN.Text = Convert.ToString(valObj.FORM_MIN);//Convert.ToString txtFORM_MAX.Text = Convert.ToString(valObj.FORM_MAX);//Convert.ToString txtFORM_ONEROW.Text = Convert.ToString(valObj.FORM_ONEROW);//Convert.ToString txtFORM_CTRLWIDTH.Text = Convert.ToString(valObj.FORM_CTRLWIDTH);//Convert.ToInt32 txtSEARCH_INBILL.Text = Convert.ToString(valObj.SEARCH_INBILL);//Convert.ToString txtSEARCH_TYPE.Text = Convert.ToString(valObj.SEARCH_TYPE);//Convert.ToString txtSEARCH_FORMULAR.Text = Convert.ToString(valObj.SEARCH_FORMULAR);//Convert.ToString } } catch (Exception ex) { litWarn.Text = ex.Message; } if (Request["ajax"] != null) { Response.Clear(); Response.Buffer = true; Response.Charset = "utf-8"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");//设置输出流为简体中文 //Response.ContentType = "html/text"; this.EnableViewState = false; System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true); System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad); System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter); divC.RenderControl(oHtmlTextWriter); Response.Write(oStringWriter.ToString()); Response.End(); } } }
protected void btnOK_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(hidCheckFields.Value)) { litWarn.Text = "没有选中字段"; LoadDataBase(false); return; } string[] fieldNames = hidCheckFields.Value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (fieldNames.Length < 1) { litWarn.Text = "没有选中字段"; LoadDataBase(false); return; } string key = ddlDataSource.SelectedValue.Substring(0, ddlDataSource.SelectedValue.LastIndexOf('_')); DataBaseType dataBaseType = (DataBaseType)Enum.Parse(typeof(DataBaseType), ddlDataSource.SelectedValue.Substring(ddlDataSource.SelectedValue.LastIndexOf('_') + 1)); DataBase db = DataBase.Factory(BillBase.GetConnByDevKey(key)); if (db == null) { litWarn.Text = "操作失败,无效的设备"; LoadDataBase(false); return; } int succCount = 0; SYS_BILL_COL cccmax = new SYS_BILL_COL(); cccmax.BILL_ID = billid; string sortStr = BLLTable <SYS_BILL_COL> .Max(SYS_BILL_COL.Attribute.SORT_NO, cccmax); int sort = 0; if (!string.IsNullOrEmpty(sortStr)) { sort = int.Parse(sortStr) + 1; } SYS_BILL billObj = BLLTable <SYS_BILL> .Factory(conn).GetRowData(SYS_BILL.Attribute.BILL_ID, billid); SYS_BILL_CTRL ctrlCond = new SYS_BILL_CTRL(); ctrlCond.OrderBy(TF_CTRL_TYPE.Attribute.SORT_NO, Order.Asc); DataTable dtCtrl = BLLTable <SYS_BILL_CTRL> .SelectForDataTable(new SYS_BILL_CTRL(), ctrlCond); DataView dv1 = new DataView(); dv1.Table = dtCtrl; dv1.RowFilter = "P_CTRL_ID='0'"; dv1.Sort = "SORT_NO asc"; int ctrlid = 0; if (dtCtrl != null && dtCtrl.Rows.Count > 1) { ctrlid = int.Parse(dv1[0]["CTRL_ID"].ToString()); } StringBuilder treeSb = new StringBuilder(); foreach (string fieldName in fieldNames) { if (string.IsNullOrEmpty(fieldName)) { continue; } string[] tableField = fieldName.Split('.'); if (tableField.Length != 2) { continue; } if (!db.DataTables.Contains(tableField[0])) { continue; } DataBaseTable table = db.DataTables[tableField[0]]; if (!table.DataFields.Contains(tableField[1])) { continue; } DataBaseField field = table.DataFields[tableField[1]]; SYS_BILL_COL valObj = new SYS_BILL_COL(); if (txtBILL_ID.Value != "") { valObj.BILL_ID = Convert.ToInt32(txtBILL_ID.Value); } valObj.COL_NAME = (key == "conn" ? "AIO_SYN" : key) + "_" + table.TableName + "_" + field.FieldName; if (BLLTable <SYS_BILL_COL> .Exists(valObj)) { continue; } #region valObj.TABLE_NAME = table.TableName; valObj.ISPK = field.IsKeyID ? "1" : "0"; valObj.COL_NOTE = ddlDataSource.SelectedItem.Text + (string.IsNullOrEmpty(field.Desc.ZhName) ? field.FieldName : field.Desc.ZhName); valObj.DATA_TYPE = field.DataType.TypeName.ToString().Replace("_", ""); valObj.DATA_LEN = field.DataType.DataLen; valObj.DATA_ACC = field.DataType.Scale; valObj.IS_AUTO = field.IsAutoIncrease ? "1" : "0"; valObj.SORT_NO = sort++; valObj.FK_SHOW = field.FieldName; valObj.DISPLAY_NAME = valObj.COL_NOTE; valObj.TITLE = valObj.COL_NOTE; valObj.DVAL = field.DefaultValue; valObj.BILL_ROW_FORMULAR = ""; valObj.BILL_COL_FORMULAR = ""; valObj.BILL_ISHEADER = "1"; valObj.BILL_HERDERWIDTH = 0; valObj.FORM_CHECKTYPE = "string"; valObj.FORM_CTRL_ID = ctrlid; valObj.FORM_SHOW = "1"; valObj.FORM_NEED = "1"; valObj.FORM_ONEROW = "1"; valObj.SEARCH_INBILL = "1"; valObj.SEARCH_TYPE = "string"; valObj.SEARCH_FORMULAR = "LikeRight"; if (billObj.TABLE_NAME != valObj.TABLE_NAME && key != "conn" && valObj.ISPK == "1") { valObj.ISFK = "1"; } else { valObj.ISFK = "0"; } valObj.FK_NAME = field.FieldName; valObj.BILL_AFTREDTL = "0"; //valObj.TABLE_EXISTS = "1"; //valObj.COL_SYN_TO = ""; //valObj.CONN_SOURCE = key == "conn" ? "AIO_SYN" : key; valObj.PK_VALCODE = ""; #endregion SYS_BILL_COL_EXD billExd = new SYS_BILL_COL_EXD(valObj); count = billExd.Add(); if (count > 0) { if (Request["tree"] != null) { StringBuilder sb = new StringBuilder("{"); sb.Append("id:'"); sb.Append(keyid).Append("',pid:'").Append(valObj.BILL_ID).Append("',no:").Append(valObj.SORT_NO).Append(",sc:0,name:'"); sb.Append(valObj.COL_NAME + "[" + valObj.COL_NOTE + "]").Append("',ntype:'col'}"); treeSb.Append(sb.ToString()); } else { #region StringBuilder sbData = new StringBuilder("{valObj:''"); List <AttributeItem> lstCol = valObj.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { object val = valObj.GetValue(lstCol[i]); if (val != null) { sbData.Append(",").Append(lstCol[i].FieldName).Append(":'").Append(val.ToString()).Append("'"); } } sbData.Append("}"); treeSb.Append(sbData.ToString()); #endregion } succCount++; } } if (succCount > 0) { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "_FormView();", false); litWarn.Text = "成功添加" + succCount + "个栏目"; } else { litWarn.Text = "栏目添加失败"; } LoadDataBase(false); }