Exemple #1
0
        public int DelField(string fieldid, ref string errMsg)
        {
            try
            {
                TF_TB_FIELD field = BLLTable <TF_TB_FIELD> .Factory(conn).GetRowData(TF_TB_FIELD.Attribute.FIELD_ID, fieldid);

                string tbname = BLLTable <TF_TABLE> .Factory(conn).GetOneValue(TF_TABLE.Attribute.TB_ID, field.TB_ID, TF_TABLE.Attribute.TB_NAME);

                string        msg = null;
                DataBaseField f1  = null;
                DataBaseTable t1  = null;
                if (DataBase.Factory(conn).TryGetValue(tbname, field.FIELD_NAME, out t1, out f1))
                {
                    if (!t1.DeleteField(field.FIELD_NAME, false, ref msg))
                    {
                        errMsg += msg; return(0);
                    }
                }
                return(1);
            }
            catch (Exception ex)
            {
                errMsg = ex.ToString();
                return(-1);
            }
        }
Exemple #2
0
        public TF_TB_FIELD Parse(DataBaseField f2)
        {
            int         sortInt = 0;
            TF_TB_FIELD f1      = new TF_TB_FIELD();

            f1.FIELD_NAME  = f2.FieldName;
            f1.NOTE        = f2.Desc.ZhName;
            f1.DEFAULT_VAL = f2.DefaultValue;
            //f1.TB_ID;
            sortInt++;
            f1.SORT_NO    = sortInt;
            f1.IS_KEY     = (f2.IsKeyID) ? 1 : 0;
            f1.IS_AUTONUM = (f2.IsAutoIncrease) ? 1 : 0;
            f1.IS_NULL    = (f2.IsAllowNull) ? 1 : 0;
            f1._CREATED   = 1;
            switch (f2.Desc.Switch_CtrlType)
            {
            //case BaseCtrlType.SelectDrop:
            default:
                f1._CTRL_TYPE = f2.Desc.Switch_CtrlType == BaseCtrlType.UnKnown ? BaseCtrlType.InputString.ToString() : f2.Desc.Switch_CtrlType.ToString();
                //f1._DB_TYPE = f2.DataType.TypeNameString;
                f1._DB_TYPE  = f2.DataType.GetParamSql();   //char(8), decaml(8,0)
                f1.TYPE_CODE = StringHelper.HeadUpper(f2.DataType.NetType);
                f1.TYPE_ID   = 0;
                break;
            }
            return(f1);
        }
Exemple #3
0
    /// <summary>
    /// 获取list页的数据源
    /// 支持主模块的链接
    /// 支持枚举量
    /// 支持时间格式
    /// </summary>
    /// <param name="f1"></param>
    /// <returns></returns>
    public string GetHtmlList(DataBaseField f1, ITableImplement this1)
    {
        if (!f1.Desc.af_Enable)
        {
            return("");                       //是否可用
        }
        if (!f1.Desc.af_Visable)
        {
            return("");                        //是否可见
        }
        string        html      = "";
        string        tableName = f1.TableName;
        AttributeItem attr1     = AttributeItem.Factory(f1);
        object        value1    = (this1.GetValue(attr1));
        DataBaseTable dt1       = f1.DataBaseTable; //DataBaseField f1;

        try
        {
            DataBaseField id1   = dt1.IDField;
            DataBaseField name1 = dt1.NameField;

            if (f1 == dt1.IDField)
            {
                //html = "<a href='index.aspx?id=" + this1.GetValue(dt1.FieldID.FieldName) + "'>" + html + "</a>";
            }
            else if (f1 == dt1.NameField)    // != null && dt1.NameField.FieldName == f1.FieldName)//本模块name详细链接
            {
                string showUrl = "../" + dt1.TableName + "/show.aspx";
                if (!Exist(showUrl))
                {
                    showUrl = "show.aspx";
                }
                html = "<a href='" + showUrl + "?id=" + this1.GetValue(id1) + "&moduleName=" + tableName
                       + "' target='_blank'>" + value1 + "</a>";
            }
            else if (isSelect(f1))    //枚举量
            {
                html = BaseFormHelper.Factory(this1.ConnectKey).GetOptionText(attr1, value1);
            }
            else if (isChaZhao(f1))    //父表
            {
                DataBaseField f2    = f1.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.NameField;
                AttributeItem attr2 = AttributeItem.Factory(f2);
                html = Convert.ToString(this1.GetValue(attr2));
            }
            else if (f1.Desc.Switch_CtrlType == BaseCtrlType.FileUpImage)
            {
                html = "<img src ='" + value1 + "' style='height:40px' />";
            }
        }
        catch (Exception ex)
        {
            Cs.Error(ex.ToString());
        }
        if (html == "")
        {
            html = Convert.ToString(value1);
        }
        return(html);
    }
Exemple #4
0
 protected string GetShowFieldName(DataBaseField field)
 {
     if (field == null)
     {
         return("");
     }
     return(field.FieldName + (string.IsNullOrEmpty(field.Desc.ZhName) ? "" : ("(" + field.Desc.ZhName + ")")));
 }
Exemple #5
0
 private bool isChaZhao(DataBaseField f1)
 {
     if (f1.Desc.Switch_CtrlType == BaseCtrlType.Select_RelationUser ||
         f1.Desc.Switch_CtrlType == BaseCtrlType.Select_RelationFK)           //父表
     {
         return(true);
     }
     return(false);
 }
Exemple #6
0
    int recount = -1; //��ѯ�ܼ�¼��

    #endregion Fields

    #region Methods

    /// <summary>
    /// ��ȡlistҳ������Դ  
    /// ֧����ģ�������
    /// ֧��ö����
    /// ֧��ʱ���ʽ
    /// </summary>
    /// <param name="f1"></param>
    /// <returns></returns>
    public string GetHtmlList(DataBaseField f1, ITableImplement this1)
    {
        if (!f1.Desc.af_Enable) return "";//�Ƿ����
            if (!f1.Desc.af_Visable) return "";//�Ƿ�ɼ�
            string html = "";
            string tableName = f1.TableName;
            AttributeItem attr1 = AttributeItem.Factory(f1);
            object value1 = (this1.GetValue(attr1));
            DataBaseTable dt1 = f1.DataBaseTable; //DataBaseField f1;

            try
            {
                DataBaseField id1 = dt1.IDField;
                DataBaseField name1 = dt1.NameField;

                if (f1 == dt1.IDField)
                {
                    //html = "<a href='index.aspx?id=" + this1.GetValue(dt1.FieldID.FieldName) + "'>" + html + "</a>";
                }
                else if (f1 == dt1.NameField)// != null && dt1.NameField.FieldName == f1.FieldName)//��ģ��name��ϸ����
                {
                    string showUrl = "../" + dt1.TableName + "/show.aspx";
                    if (!Exist(showUrl))
                    {
                        showUrl = "show.aspx";
                    }
                    html = "<a href='" + showUrl + "?id=" + this1.GetValue(id1) + "&moduleName=" + tableName
                        + "' target='_blank'>" + value1 + "</a>";
                }
                else if (isSelect(f1))//ö����
                {
                    html = BaseFormHelper.Factory(this1.ConnectKey).GetOptionText(attr1, value1);
                }
                else if (isChaZhao(f1))//����
                {
                    DataBaseField f2 = f1.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.NameField;
                    AttributeItem attr2 = AttributeItem.Factory(f2);
                    html = Convert.ToString(this1.GetValue(attr2));
                }
                else if (f1.Desc.Switch_CtrlType == BaseCtrlType.FileUpImage)
                {
                    html = "<img src ='" + value1 + "' style='height:40px' />";
                }
            }
            catch (Exception ex)
            {
                Cs.Error(ex.ToString());
            }
            if (html == "")
            {
                html = Convert.ToString(value1);
            }
            return html;
    }
Exemple #7
0
        private void SQLHelp_Load(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            ssc       = new SQLStringCheck();
            dbf       = new DataBaseField();
            insql     = new InsertSQL();
            updatesql = new UpdateSQL();
            ocon      = new ObjectConstructor();

            IntiData();
        }
Exemple #8
0
 private bool isSelect(DataBaseField f1)
 {
     if (f1.Desc.Switch_CtrlType == BaseCtrlType.RadioBoxList ||
         f1.Desc.Switch_CtrlType == BaseCtrlType.CheckBoxList ||
         f1.Desc.Switch_CtrlType == BaseCtrlType.SelectDrop ||
         f1.Desc.Switch_CtrlType == BaseCtrlType.SelectSingle ||
         f1.Desc.Switch_CtrlType == BaseCtrlType.SelectMultiple)
     {
         return(true);
     }
     return(false);
 }
Exemple #9
0
        /// <summary>
        /// 从取值对象中获得属性,从条件对象中获得值
        /// </summary>
        /// <param name="valObj"></param>
        /// <param name="condObj"></param>
        /// <returns></returns>
        public List <DataBaseField> Parse(ITableImplement valObj, ITableImplement condObj)
        {
            List <DataBaseField> list2 = new List <DataBaseField>();
            List <AttributeItem> list  = new List <AttributeItem>();

            list.AddRange(valObj.af_GetAvailableAttributeItem());
            if (list.Count == 0)
            {
                list.AddRange(valObj.af_AttributeItemList);
            }

            string tbName = valObj._TableName.ToLower();

            if (tbName == ITableImplement.defaultTableName.ToLower())
            {
                tbName = list[0].TableName;
            }
            #region 表操作
            DataBaseTable dt1 = null;
            dt1 = Runtime_PersistenceLayer.Factory(conn).DataBase.DataTables[tbName];
            if (dt1 == null)
            {
                ConsoleService.Warn(tbName + " 数据表不存在");
                return(new List <DataBaseField>());
            }
            #endregion

            foreach (AttributeItem item in list)
            {
                string fieldName = item.FieldName.ToLower();
                #region 列操作
                DataBaseField f1 = null;
                if (!dt1.DataFields.TryGetValue(fieldName, out f1))
                {
                    ConsoleService.Warn(string.Format("数据表{0},数据字段{1}不存在", tbName, fieldName));
                    continue;
                }
                if (f1.Desc.CtrlType == BaseCtrlType.Text || f1.Desc.CtrlType == BaseCtrlType.HTML ||
                    f1.Desc.CtrlType == BaseCtrlType.SmallText)
                {
                    continue;
                }
                if (condObj != null && condObj.IsNotNull())
                {
                    f1.Value = condObj.GetString(item);
                }
                #endregion
                list2.Add(f1);
            }
            return(list2);
        }
        /// <summary>
        /// 将query 转化为sql语句
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="query"></param>
        /// <returns></returns>
        internal static string ToSql <TEntity>(this IQueryable <TEntity> query) where TEntity : class
        {
            var queryCompiler           = (QueryCompiler)QueryCompilerField.GetValue(query.Provider);
            var modelGenerator          = (QueryModelGenerator)QueryModelGeneratorField.GetValue(queryCompiler);
            var queryModel              = modelGenerator.ParseQuery(query.Expression);
            var database                = (IDatabase)DataBaseField.GetValue(queryCompiler);
            var databaseDependencies    = (DatabaseDependencies)DatabaseDependenciesField.GetValue(database);
            var queryCompilationContext = databaseDependencies.QueryCompilationContextFactory.Create(false);
            var modelVisitor            = (RelationalQueryModelVisitor)queryCompilationContext.CreateQueryModelVisitor();

            modelVisitor.CreateQueryExecutor <TEntity>(queryModel);
            string sql = modelVisitor.Queries.First().ToString();

            return(sql);
        }
Exemple #11
0
    protected bool TryGetRequest(DataBaseField f1, out string fieldValue)
    {
        if (TryGetRequest(f1.Desc.FieldCtrlName, out fieldValue))
        {
            if (f1.Desc.CtrlType == BaseCtrlType.SelectDrop &&
                (fieldValue == "-1" || fieldValue == ""))
            {
                return(false);
            }

            if ((f1.Desc.CtrlType == BaseCtrlType.InputDate || f1.Desc.CtrlType == BaseCtrlType.InputDateTime) &&
                (fieldValue == "0001-01-01" || fieldValue == "1900-01-01"))
            {
                return(false);
            }
            return(true);
        }
        else if (TryGetRequest(f1.Desc.FieldName, out fieldValue))
        {
            return(true);
        }
        return(false);
    }
Exemple #12
0
    int recount = -1; //��ѯ�ܼ�¼��

    #endregion Fields

    #region Methods

    /// <summary>
    /// ��ȡlistҳ������Դ  
    /// ֧����ģ�������
    /// ֧��ö����
    /// ֧��ʱ���ʽ
    /// </summary>
    /// <param name="f1"></param>
    /// <returns></returns>
    public string GetHtmlList(DataBaseField f1, ITableImplement this1)
    {
        string html = "";
        try
        {
            DataBaseTable dt1 = f1.DataBaseTable;
            if (f1 != dt1.IDField && f1 != dt1.NameField)
            {
                if (!f1.Desc.af_Enable) return "";//�Ƿ����
                if (!f1.Desc.af_Visable) return "";//�Ƿ�ɼ�
            }
            AttributeItem attr1 = AttributeItem.Factory(f1);
            object value1 = (this1.GetValue(attr1));

             //DataBaseField f1;
            DataBaseField id1 = dt1.IDField;
            DataBaseField name1 = dt1.NameField;

            if (f1 == dt1.IDField)//����ֶ�
            {
                //html = "<a href='index.aspx?id=" + this1.GetValue(dt1.FieldID.FieldName) + "'>" + html + "</a>";
            }
            else if (f1 == dt1.NameField)// != null && dt1.NameField.FieldName == f1.FieldName)//��ģ��name��ϸ����
            {
                string showUrl = "../" + f1.TableName + "/show.aspx";
                if (!Exist(showUrl))
                {
                    showUrl = "show.aspx";
                }
                html = "<a href='" + showUrl + "?id=" + this1.GetValue(id1) + "&moduleName=" + f1.TableName
                    + "' target='_blank'>" + value1 + "</a>";
            }
            else if (isSelect(f1))//ö����
            {
                string str=Convert.ToString(value1);

                if (str.Contains(",")) {
                    //��ѡ
                    string[] strs = str.Split(',');
                    List<object> valueList = new List<object>(strs);
                    List<object> nameList = BaseFormHelper.Factory(this1.ConnectKey).GetOptionText(attr1, valueList);
                    StringBuilder sb = new StringBuilder();
                    foreach(object s in nameList){
                        String ss=Convert.ToString(s);
                        sb.Append(ss+",");
                    }
                    html = sb.ToString();
                    html=html.Substring(0,html.LastIndexOf(","));
                }
                else {
                    //��ѡ
                    html = BaseFormHelper.Factory(this1.ConnectKey).GetOptionText(attr1, value1);
                }

            }
            else if (isChaZhao(f1))//����
            {
                DataBaseField f2 = f1.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.NameField;
                AttributeItem attr2 = AttributeItem.Factory(f2);
                html = Convert.ToString(this1.GetValue(attr2));

                //Ϊ�����ı��name��������
                string showUrl = "../" + f1.TableName + "/show.aspx";
                if (!Exist(showUrl))
                {
                    showUrl = "show.aspx";
                }
                html = "<a href='" + showUrl + "?id=" + this1.GetValue(id1) + "&moduleName=" + f1.TableName
                    + "' target='_blank'>" + html + "</a>";
            }
            else if (f1.Desc.Switch_CtrlType == BaseCtrlType.FileUpImage)
            {
                html = "<img src ='" + value1 + "' style='height:40px' />";
            }
            else if (f1.Desc.Switch_CtrlType == BaseCtrlType.FileUpUpDoc)
            {//
                if(!value1.Equals(" ")){
                    string val = Convert.ToString(value1);
                    string[] strs = val.Split(';');
                    for (int i = 0; i < strs.Length - 1; i++)
                    {
                        string[] ss=strs[i].Split(',');
                        string title = ss[0];
                        string url=ss[1];

                        html += "<span>" + title + "&nbsp;<a href='Back.aspx?moduleName="+ModuleName+"&download=true&filename="+url+"'>����</a></span>";
                    }
                }
            }
            if (html == "")
            {
                html = Convert.ToString(value1);
            }
        }
        catch (Exception ex)
        {
            Cs.Error(ex.ToString());
        }
        return html;//.TrimEnd('\n').TrimEnd('\r').Trim();
    }
Exemple #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["deleteFile"] == null)
        {
            base.InitModule(ref valObj, ref KeyID, ref fieldList);
        }

        //在列表里点击删除按钮,通过AJAX执行这里的后台代码,删除一条记录
        if (Request["DelID"] != null)
        {
            valObj.SetValue(valObj.KeyID, Request["DelID"]);
            int re = BLLTable <ITableImplement> .Factory(conn).Delete(valObj);

            if (re > 0)
            {
                Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示
            }
            else
            {
                Response.Write("删除失败!");
            }
        }

        //在列表顶部点击删除按钮,通过AJAX执行这里的后台代码,删除多条记录
        if (Request["DelKeyIDS"] != null)
        {
            ITableImplement cond = valObj;
            cond.In(AttributeItem.Factory(cond.DataBaseTable.IDField), Request["DelKeyIDS"]);
            int re = BLLTable <ITableImplement> .Factory(conn).Delete(cond);

            if (re > 0)
            {
                Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示
            }
            else
            {
                Response.Write("删除失败!");
            }
        }

        //在用户详细信息查看编辑页面,点保存时,通过AJAX执行这里的后台代码,实现部门字段的更新
        if (Request["saveInfo"] != null)
        {
            valObj.SetValue(valObj.KeyID, Request["FieldKeyID"]);
            List <AttributeItem> lstCol = valObj.af_AttributeItemList;
            for (int i = 0; i < lstCol.Count; i++)
            {
                if (!string.IsNullOrEmpty(Request["txt" + lstCol[i].FieldName]))
                {
                    valObj.SetValue(lstCol[i], Request["txt" + lstCol[i].FieldName]);
                }
            }
            BLLTable <ITableImplement> .Factory(conn).Update(valObj, valObj.KeyID);

            Response.Write("修改记录信息成功");
        }
        //删除本地文件
        if (Request["deleteFile"] != null)
        {
            //string filepath=WebHelper.GetAppPath() + Request["fileName"];
            string filepath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + Request["fileName"];;
            if (File.Exists(filepath))
            {
                File.Delete(filepath);
            }
        }
        //分页AJAX请求
        if (Request["paging"] != null)
        {
            int pageSize = 10; int pageIndex = 1; int count1 = -1;

            pageIndex = Convert.ToInt32(HttpUtil.GetReqStrValue("pageIndex"));
            int           num = Convert.ToInt32(HttpUtil.GetReqStrValue("num"));;
            StringBuilder sb  = new StringBuilder();
            try
            {
                //DataBaseField[] flist = valObj.af_GetAvailableDataBaseField();
                //foreach (DataBaseField f1 in flist)
                {
                    //父表的id
                    object id1 = HttpUtil.GetReqStrValue("id1");

                    string tableName1 = "关系表1";
                    if (valObj.DataBaseTable.SubTable_ChaZhao.Count > 0)
                    {
                        // foreach (DataBaseTableRelation dr1 in valObj.DataBaseTable.SubTable_ChaZhao)
                        //{
                        DataBaseTableRelation dr1    = valObj.DataBaseTable.SubTable_ChaZhao[num];
                        DataBaseTable         table2 = dr1.DataBaseTable;
                        tableName1 = table2.TableName;
                        DataBaseField   IDField   = dr1.DataBaseTable.IDField;
                        DataBaseField   NameField = dr1.DataBaseTable.NameField;
                        List <Relation> lstRel    = new List <Relation>();
                        foreach (DataBaseRelation r1 in dr1.Relations)
                        {
                            lstRel.Add(new Relation(r1));
                        }
                        ITableImplement value2 = new ITableImplement(table2);

                        ITableImplement cond2 = new ITableImplement(table2);
                        cond2.SetValue(AttributeItem.Factory(value2.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.IDField), id1);
                        List <ITableImplement> lstCond = new List <ITableImplement>();
                        lstCond.Add(cond2);

                        List <ITableImplement> lstOther = new List <ITableImplement>();



                        //显示明显表的 父表的信息
                        //value2.setConn(conn).setModule("WEC_QC_CARS");
                        List <ITableImplement> list2 = BLLTable <ITableImplement> .Factory(conn).SelectByPage(value2, lstRel, lstOther, lstCond,
                                                                                                              pageSize, pageIndex, ref count1);

                        //  BLLTable.SQL_Test.ToString();
                        if (list2.Count > 0)
                        {
                            foreach (ITableImplement tb2 in list2)
                            {
                                sb.Append("<tr>");
                                foreach (DataBaseField d2 in tb2.af_GetAvailableDataBaseField())
                                {
                                    sb.Append("<td>" + GetHtmlList(d2, tb2) + "");
                                }
                                sb.Append("</tr>");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            Response.Write(sb.ToString());
        }

        //下载文件
        if (Request["download"] != null)
        {
            string filename = Request["filename"];
            string fullpath = Request.PhysicalApplicationPath + filename;
            Response.ContentType = "APPLICATION/OCTET-STREAM";
            Response.AddHeader("Content-Disposition", "attachment;filename=" + filename.Substring(filename.LastIndexOf("/") + 1));
            FileStream fs  = new FileStream(fullpath, FileMode.Open);
            int        len = (int)fs.Length;
            byte[]     buf = new byte[len];
            int        count;
            int        sum = 0;

            while ((count = fs.Read(buf, 0, len)) > 0)
            {
                sum += count;
                Response.OutputStream.Write(buf, 0, count);
            }
        }
        Response.End();
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        //try
        //{
        SYS_BILL_COL_SYN valObj = new SYS_BILL_COL_SYN();

        if (txtBILL_ID.Value != "")
        {
            valObj.BILL_ID = Convert.ToInt32(txtBILL_ID.Value);
        }

        //if (keyid == "")
        //{
        //    if (BLLTable<SYS_BILL_COL_SYN>.Exists(valObj))
        //    {
        //        litWarn.Text = "ÒѾ­´æÔÚ´Ë×ֶΣ¡";
        //        return;
        //    }
        //}

        #region
        if (txtTABLE_NAME.Value != "")
        {
            valObj.TABLE_NAME = Convert.ToString(txtTABLE_NAME.Value);
        }
        else
        {
            if (txtTABLE_NAME1.Value != "")
            {
                valObj.TABLE_NAME = Convert.ToString(txtTABLE_NAME1.Value);
            }
        }

        DataBaseField field = null;
        if (txtCOL_NAME.Value != "")
        {
            valObj.COL_NAME = Convert.ToString(txtCOL_NAME.Value);
            try
            {
                field = DataBase.Factory(MyConfigurationSettings.GetValue(txtDB_SRC.Value)).DataTables[valObj.TABLE_NAME].DataFields[valObj.COL_NAME];
            }
            catch { field = null; }
        }
        if (field == null)
        {
            litWarn.Text = "±£´æʧ°Ü£¡Ã»ÓÐÕÒµ½¸Ã×ֶΣ¡";
            return;
        }

        if (txtCOL_ID.Value != "")
        {
            valObj.COL_ID = Convert.ToInt32(txtCOL_ID.Value);
        }

        valObj.ISPK = field.IsKeyID ? "1" : "0";

        valObj.COL_NOTE = field.Desc.ZhName;

        valObj.DATA_TYPE = field.DataType.TypeNameString;

        valObj.DATA_LEN = field.DataType.DataLen;

        valObj.DATA_ACC = field.DataType.Scale;

        valObj.IS_AUTO = field.IsAutoIncrease ? "1" : "0";

        valObj.DVAL = field.DefaultValue;

        valObj.DB_SRC = txtDB_SRC.Value;

        valObj.PK_VALCODE = txtPK_VALCODE.Value;
        #endregion

        if (keyid != "")
        {
            valObj.COL_SYNID = Convert.ToInt32(keyid);

            count = BLLTable <SYS_BILL_COL_SYN> .Factory(conn).Update(valObj, SYS_BILL_COL_SYN.Attribute.COL_SYNID);
        }
        else
        {
            valObj.SetInitialized(SYS_BILL_COL_SYN.Attribute.COL_SYNID, false);
            count = BLLTable <SYS_BILL_COL_SYN> .InsertReturnID(valObj);

            keyid = count.ToString();
            ViewState["KEYID"] = keyid;
            if (count > 0 && valObj.ISPK == "1")
            {
                SYS_BILL_COL_EXD billExd = new SYS_BILL_COL_EXD(valObj.ToBILL_COL());
                billExd.Add();
            }
        }
        if (count > 0)
        {
            if (Request["tree"] != null)
            {
                StringBuilder sb = new StringBuilder("{");
                sb.Append("id:'");
                sb.Append(keyid).Append("',pid:'").Append(valObj.COL_ID).Append("',no:1,sc:0,name:'");

                sb.Append(valObj.COL_NAME + "[" + valObj.COL_NOTE + "]").Append("',ntype:'syncol'}");

                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;
        //}
    }
Exemple #15
0
    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 bool TryGetRequest(DataBaseField attr, out string fieldValue)
    {
        if (TryGetRequest(attr.Desc.FieldCtrlName, out fieldValue))
        {
            if (attr.Desc.CtrlType == BaseCtrlType.SelectDrop &&
                (fieldValue == "-1" || fieldValue == ""))
                return false;

            if ((attr.Desc.CtrlType == BaseCtrlType.InputDate||attr.Desc.CtrlType == BaseCtrlType.InputDateTime) &&
                (fieldValue == "0001-01-01" || fieldValue == "1900-01-01"))
                return false;
            return true;
        }
        else if (TryGetRequest(attr.Desc.FieldName, out fieldValue))
        {
            return true;
        }
        return false;
    }
Exemple #17
0
    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);
    }
Exemple #18
0
        /// <summary>
        /// TF_FORM 从配置中获得表单布局
        /// </summary>
        /// <param name="conn"></param>
        /// <param name="cond"></param>
        /// <returns></returns>
        public bool Parse(TF_TABLE cond,
                          out ITableImplement valObj, out ITableImplement condObj, out List <Relation> relationList, out List <ITableImplement> otherValueList,
                          out List <ITableImplement> condList, ref string msg)
        {
            valObj  = new ITableImplement();
            condObj = new ITableImplement();
            //载入关系
            otherValueList = new List <ITableImplement>();
            condList       = new List <ITableImplement>();
            relationList   = new List <Relation>();

            msg = "条件不存在";
            if (string.IsNullOrEmpty(cond.TB_NAME))
            {
                return(false);
            }

            DataBaseTable        tb1;
            List <DataBaseField> listf1  = new List <DataBaseField>();
            List <DataBaseTable> listTb1 = new List <DataBaseTable>();


            bool ret = true; tb1 = null;
            //TF_TABLE val = BLLTable<TF_TABLE>.Factory(conn).GetRowData(new TF_TABLE(), cond);

            TF_TB_FIELD val1 = new TF_TB_FIELD();
            TF_F_COLUMN val2 = new TF_F_COLUMN();
            TF_TABLE    val3 = new TF_TABLE();

            TF_TB_FIELD            cond1           = new TF_TB_FIELD();
            TF_F_COLUMN            cond2           = new TF_F_COLUMN();
            TF_FORM                cond3           = new TF_FORM();
            List <ITableImplement> otherValueList1 = new List <ITableImplement>();
            List <ITableImplement> condList1       = new List <ITableImplement>();

            otherValueList1.Add(val2); otherValueList1.Add(val3);

            condList1.Add(cond);
            List <Relation> relationList1 = new List <Relation>();

            relationList1.Add(RelationFactory.TF_TABLE_TF_FORM);
            relationList1.Add(RelationFactory.TF_TABLE_TF_TB_FIELD);
            relationList1.Add(RelationFactory.TF_TB_FIELD_TF_F_COLUMN);

            int                pageSize  = 100;
            int                pageIndex = 1;
            int                recount   = -1;
            string             cachekey  = null;
            List <TF_TB_FIELD> list1     = BLLTable <TF_TB_FIELD> .Factory(conn).SelectByPage(val1, relationList1, otherValueList1, condList1,
                                                                                              pageSize, pageIndex, ref recount, out cachekey);

            if (list1.Count == 0)
            {
                DataBaseTable dt1 = null;
                dt1 = Runtime_PersistenceLayer.Factory(conn).DataBase.DataTables[cond.TB_NAME];
                msg = cond.TB_NAME + " 数据表不存在";
                if (dt1 == null)
                {
                    ret = false;
                    ConsoleService.Warn(msg);
                }
                return(ret);
            }
            if (list1.Count > 90)
            {
                msg = "条件错误,所配置的字段记录超过90";
                return(false);
            }
            //生成布局模版用
            tb1 = new DataBaseTable();
            foreach (TF_TB_FIELD item in list1)
            {
                string tbName = Convert.ToString(item.GetValue(TF_TABLE.Attribute.TB_NAME)).ToLower();
                #region 表操作
                DataBaseTable dt1 = null;
                dt1 = Runtime_PersistenceLayer.Factory(conn).DataBase.DataTables[tbName];
                msg = tbName + " 数据表不存在"; ret = false;
                if (dt1 == null)
                {
                    ConsoleService.Warn(msg);
                    return(ret);
                }
                tb1 = dt1;
                listTb1.Add(dt1);
                //是否显示
                object obj1 = null;
                object obj2 = null;
                object obj3 = null;
                if (item.TryGetValue(TF_FORM.Attribute.FORM_ID, out obj1))
                {
                    dt1.IsVisable = true;
                }

                #endregion
                string fieldName = item.FIELD_NAME.ToLower();
                #region 列操作
                DataBaseField f1 = null;
                msg = string.Format("数据表{0},数据字段{1}不存在", tbName, fieldName);
                if (!dt1.DataFields.TryGetValue(fieldName, out f1))
                {
                    ret = false;
                    ConsoleService.Warn(msg);
                    continue;
                }
                //是否显示
                obj1 = null; obj2 = null; obj3 = null;
                if (item.TryGetValue(TF_F_COLUMN.Attribute.COLUMN_ID, out obj1) &&
                    item.TryGetValue(TF_F_COLUMN.Attribute.SHOW_NAME, out obj2) &&
                    item.TryGetValue(TF_F_COLUMN.Attribute.CTRL_TYPE, out obj3))
                {
                    //f1.IsVisable = true;
                }
                #endregion
                listf1.Add(f1);
            }
            //取值对象
            valObj = ITableImplement.Factory(tb1);
            //其他取值对象
            foreach (DataBaseTable tb2 in listTb1)
            {
                if (tb2.TableName == tb1.TableName)
                {
                    continue;
                }
                otherValueList.Add(ITableImplement.Factory(tb2));
            }
            //关系呢
            return(ret);
        }
Exemple #19
0
    /// <summary>
    /// ÊäÈëhtml
    /// </summary>
    /// <returns></returns>
    protected string getInput()
    {
        StringBuilder sb = new StringBuilder();

        try
        {
            foreach (DataBaseField f1 in fieldList)
            {
                if (f1.TableName.ToLower() == valObj._TableName.ToLower())//±¾±í×Ö¶Î
                {
                    AttributeItem attr1 = new AttributeItem(f1);
                    f1.Value = Convert.ToString(resultObj.GetValue(attr1));

                    if (f1.ZhName == "¶àÑ¡ÊýÁ¿")
                    {
                        "".ToString();
                    }
                    if (f1.ZhName == "¹Ø¼ü´Ê")
                    {
                        "".ToString();
                    }

                    string attrHtml = Input;

                    BuildByTag b1 = new BuildByTag(BuildType.ForHtmlValue);
                    b1.ParseForSwitch±êÇ©(ref attrHtml, f1);

                    if (isChaZhao(f1))
                    {
                        DataBaseField f2     = f1.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.NameField;
                        AttributeItem attr11 = AttributeItem.Factory(f2);
                        string        html   = Convert.ToString(resultObj.GetValue(attr11));
                        attrHtml = attrHtml.Replace("{×Ö¶ÎÏÔʾֵ}", html);
                    }
                    else if (f1.Desc.CtrlType == BaseCtrlType.SelectDrop)
                    {
                        string[] strs = null;
                        if (f1.Value.Contains(","))
                        {
                            strs = f1.Value.Split(',');
                            foreach (string s in strs)
                            {
                                string str = "value='" + s + "'";
                                attrHtml = attrHtml.Replace(str, str + " selected");
                            }
                        }
                    }
                    else if (f1.Desc.CtrlType == BaseCtrlType.FileUpUpDoc)
                    {
                        if (!f1.Value.Equals(" "))
                        {
                            string   val  = Convert.ToString(f1.Value);
                            string[] strs = val.Split(';');
                            string   html = "";
                            for (int i = 0; i < strs.Length - 1; i++)
                            {
                                string[] ss    = strs[i].Split(',');
                                string   title = ss[0];
                                string   url   = ss[1];
                                string   hidId = ss[2];
                                html += "<div>" + title + "<a href=\"javascript:\" flag=\"delete\" url=\"" + url + "\" onclick=\"deleteFileName(this,'" + hidId + "')\"><img src=\"../../Themes/WEC/del-icon.png\"></a></div>";
                            }
                            attrHtml = attrHtml.Replace("<div id='files' style='margin-bottom:10px;'></div>", "<div id='files' style='margin-bottom:10px;'>" + html + "</div>");
                        }
                    }
                    sb.Append("<dl><dt>").Append(f1.Desc.ZhName).Append("£º</dt><!--").Append(f1.FieldName)
                    .Append("--><dd><span>");
                    sb.Append(attrHtml);
                    sb.Append("</span></dd></dl>");
                }
            }
        }
        catch (Exception ex)
        {
            Cs.Error("34" + ex.ToString());
        }
        return(sb.ToString());
    }
Exemple #20
0
 private bool isChaZhao(DataBaseField f1)
 {
     if (f1.Desc.Switch_CtrlType == BaseCtrlType.Select_RelationUser
                     || f1.Desc.Switch_CtrlType == BaseCtrlType.Select_RelationFK)//����
         {
             return true;
         }
         return false;
 }
Exemple #21
0
 private bool isSelect(DataBaseField f1)
 {
     if (f1.Desc.Switch_CtrlType == BaseCtrlType.RadioBoxList
                     || f1.Desc.Switch_CtrlType == BaseCtrlType.CheckBoxList
                     || f1.Desc.Switch_CtrlType == BaseCtrlType.SelectDrop
                     || f1.Desc.Switch_CtrlType == BaseCtrlType.SelectSingle
                     || f1.Desc.Switch_CtrlType == BaseCtrlType.SelectMultiple)
         {
             return true;
         }
         return false;
 }
Exemple #22
0
        /// <summary>
        /// 操作物理表字段,插入或更新
        /// </summary>
        public int InsertOrUpdateField(TF_TB_FIELD field, string oldbame, ref string errMsg)
        {
            try
            {
                if (string.IsNullOrEmpty(oldbame))
                {
                    oldbame = field.FIELD_NAME;
                }
                int tb_id    = field.TB_ID;
                int FIELD_ID = field.FIELD_ID;
                if (FIELD_ID != 0)//修改的时候
                {
                    if (tb_id == 0)
                    {
                        errMsg = "物理数据库中新增字段失败!";
                        tb_id  = Convert.ToInt32(BLLTable <TF_TB_FIELD> .Factory(conn).GetOneValue(TF_TB_FIELD.Attribute.FIELD_ID,
                                                                                                   field.FIELD_ID, TF_TB_FIELD.Attribute.TB_ID));
                        field.TB_ID = tb_id;
                    }
                }
                TF_TABLE tbObj = null;
                if (tb_id != 0)//插入的时候
                {
                    errMsg = "物理数据库中编辑字段失败!";
                    tbObj  = BLLTable <TF_TABLE> .Factory(conn).GetRowData(TF_TABLE.Attribute.TB_ID, tb_id);
                }
                string tbname     = tbObj.TB_NAME;
                string colname    = field.FIELD_NAME;
                string sqlcoltype = field.DB_TYPE;//decimal(10,0)
                string msg        = null;

                //修改正式表字段名称或类型
                DataBaseField f1 = null;
                DataBaseTable t1 = null;
                if (DataBase.Factory(conn).TryGetValue(tbname, oldbame.Trim(), out t1, out f1))
                {
                    DataBaseField newf1 = f1.Clone();
                    if (field.IS_NULL == 0)
                    {
                        newf1.IsAllowNull = true;
                    }
                    newf1.FieldName = field.FIELD_NAME;
                    newf1.DataType  = FieldDataType.FromString(t1.DataBase.DataBaseType, sqlcoltype, true);
                    if (!newf1.Update(f1, true, ref msg))
                    {
                        errMsg += msg; return(0);
                    }
                }
                else//如果没有存在,则新增
                {
                    DataBaseField newf1 = new DataBaseField();
                    if (field.IS_NULL == 0)
                    {
                        newf1.IsAllowNull = true;
                    }
                    newf1.FieldName = field.FIELD_NAME;
                    newf1.DataType  = FieldDataType.FromString(t1.DataBase.DataBaseType, sqlcoltype, true);
                    if (!t1.AddField(newf1, ref msg))
                    {
                        errMsg += msg; return(0);
                    }
                    if (!DataBase.Factory(conn).TryGetValue(tbname, newf1.FieldName, out t1, out f1))
                    {
                        errMsg += "未存在";
                    }
                }

                #region                                       //流程对应流程的临时表对应的字段信息
                tbname = WFOBJECT_BLL.GetWFTempTBName(tbObj); //tbObj.WF_TB_NAME;
                //修改正式表字段名称或类型
                f1 = null;
                t1 = null;
                //CHG START 为空条件判断有误 jin-shenjian 2013/10/12
                //if (!string.IsNullOrEmpty(tbname) && DataBase.Factory(conn).TryGetValue(tbname, oldbame, out t1, out f1))
                if (!string.IsNullOrEmpty(tbname))
                {
                    if (DataBase.Factory(conn).TryGetValue(tbname, oldbame, out t1, out f1))
                    //CHG END 为空条件判断有误 jin-shenjian 2013/10/12
                    {
                        DataBaseField newf1 = f1.Clone();
                        if (field.IS_NULL == 0)
                        {
                            newf1.IsAllowNull = true;
                        }
                        newf1.FieldName = field.FIELD_NAME;
                        newf1.DataType  = FieldDataType.FromString(t1.DataBase.DataBaseType, sqlcoltype, true);
                        if (!newf1.Update(f1, true, ref msg))
                        {
                            errMsg += msg; return(0);
                        }
                    }
                    else//如果没有存在,则新增
                    {
                        DataBaseField newf1 = new DataBaseField();
                        if (field.IS_NULL == 0)
                        {
                            newf1.IsAllowNull = true;
                        }
                        newf1.FieldName = field.FIELD_NAME;
                        newf1.DataType  = FieldDataType.FromString(t1.DataBase.DataBaseType, sqlcoltype, true);
                        if (!t1.AddField(newf1, ref msg))
                        {
                            errMsg += msg; return(0);
                        }
                        if (!DataBase.Factory(conn).TryGetValue(tbname, newf1.FieldName, out t1, out f1))
                        {
                            errMsg += "未存在";
                        }
                    }
                }
                #endregion

                return(1);
            }
            catch (Exception ex)
            {
                errMsg = ex.ToString();
                return(0);
            }
        }
        /// <summary>
        /// 操作物理表字段,插入或更新
        /// </summary>
        public int InsertOrUpdateField(TF_TB_FIELD field, string oldbame, ref string errMsg)
        {
            try
            {
                if (string.IsNullOrEmpty(oldbame))
                    oldbame = field.FIELD_NAME;
                int tb_id = field.TB_ID;
                int FIELD_ID = field.FIELD_ID;
                if (FIELD_ID != 0)//修改的时候
                {
                    if (tb_id == 0)
                    {
                        errMsg = "物理数据库中新增字段失败!";
                        tb_id = Convert.ToInt32(BLLTable<TF_TB_FIELD>.Factory(conn).GetOneValue(TF_TB_FIELD.Attribute.FIELD_ID,
                            field.FIELD_ID, TF_TB_FIELD.Attribute.TB_ID));
                        field.TB_ID = tb_id;
                    }
                }
                TF_TABLE tbObj = null;
                if (tb_id != 0)//插入的时候
                {
                    errMsg = "物理数据库中编辑字段失败!";
                    tbObj = BLLTable<TF_TABLE>.Factory(conn).GetRowData(TF_TABLE.Attribute.TB_ID, tb_id);
                }
                string tbname = tbObj.TB_NAME;
                string colname = field.FIELD_NAME;
                string sqlcoltype = field.DB_TYPE;//decimal(10,0)
                string msg = null;

                //修改正式表字段名称或类型
                DataBaseField f1 = null;
                DataBaseTable t1 = null;
                if (DataBase.Factory(conn).TryGetValue(tbname, oldbame.Trim(), out t1, out f1))
                {
                    DataBaseField newf1 = f1.Clone();
                    if (field.IS_NULL == 0)
                        newf1.IsAllowNull = true;
                    newf1.FieldName = field.FIELD_NAME;
                    newf1.DataType = FieldDataType.FromString(t1.DataBase.DataBaseType, sqlcoltype, true);
                    if (!newf1.Update(f1, true, ref msg))
                    {
                        errMsg += msg; return 0;
                    }
                }
                else//如果没有存在,则新增
                {
                    DataBaseField newf1 = new DataBaseField();
                    if (field.IS_NULL == 0)
                        newf1.IsAllowNull = true;
                    newf1.FieldName = field.FIELD_NAME;
                    newf1.DataType = FieldDataType.FromString(t1.DataBase.DataBaseType, sqlcoltype, true);
                    if (!t1.AddField(newf1, ref msg))
                    {
                        errMsg += msg; return 0;
                    }
                    if (!DataBase.Factory(conn).TryGetValue(tbname, newf1.FieldName, out t1, out f1))
                    {
                        errMsg += "未存在";
                    }
                }

                #region//流程对应流程的临时表对应的字段信息
                tbname = WFOBJECT_BLL.GetWFTempTBName(tbObj); //tbObj.WF_TB_NAME;
                //修改正式表字段名称或类型
                f1 = null;
                t1 = null;
                //CHG START 为空条件判断有误 jin-shenjian 2013/10/12
                //if (!string.IsNullOrEmpty(tbname) && DataBase.Factory(conn).TryGetValue(tbname, oldbame, out t1, out f1))
                if (!string.IsNullOrEmpty(tbname))
                {
                    if (DataBase.Factory(conn).TryGetValue(tbname, oldbame, out t1, out f1))
                    //CHG END 为空条件判断有误 jin-shenjian 2013/10/12
                    {
                        DataBaseField newf1 = f1.Clone();
                        if (field.IS_NULL == 0)
                            newf1.IsAllowNull = true;
                        newf1.FieldName = field.FIELD_NAME;
                        newf1.DataType = FieldDataType.FromString(t1.DataBase.DataBaseType, sqlcoltype, true);
                        if (!newf1.Update(f1, true, ref msg))
                        {
                            errMsg += msg; return 0;
                        }
                    }
                    else//如果没有存在,则新增
                    {
                        DataBaseField newf1 = new DataBaseField();
                        if (field.IS_NULL == 0)
                            newf1.IsAllowNull = true;
                        newf1.FieldName = field.FIELD_NAME;
                        newf1.DataType = FieldDataType.FromString(t1.DataBase.DataBaseType, sqlcoltype, true);
                        if (!t1.AddField(newf1, ref msg))
                        {
                            errMsg += msg; return 0;
                        }
                        if (!DataBase.Factory(conn).TryGetValue(tbname, newf1.FieldName, out t1, out f1))
                        {
                            errMsg += "未存在";
                        }
                    }
                }
                #endregion

                return 1;
            }
            catch (Exception ex)
            {
                errMsg = ex.ToString();
                return 0;
            }
        }
 public TF_TB_FIELD Parse(DataBaseField f2)
 {
     int sortInt = 0;
     TF_TB_FIELD f1 = new TF_TB_FIELD();
     f1.FIELD_NAME = f2.FieldName;
     f1.NOTE = f2.Desc.ZhName;
     f1.DEFAULT_VAL = f2.DefaultValue;
     //f1.TB_ID;
     sortInt++;
     f1.SORT_NO = sortInt;
     f1.IS_KEY = (f2.IsKeyID) ? 1 : 0;
     f1.IS_AUTONUM = (f2.IsAutoIncrease) ? 1 : 0;
     f1.IS_NULL = (f2.IsAllowNull) ? 1 : 0;
     f1._CREATED = 1;
     switch (f2.Desc.Switch_CtrlType)
     {
         //case BaseCtrlType.SelectDrop:
         default:
             f1._CTRL_TYPE = f2.Desc.Switch_CtrlType == BaseCtrlType.UnKnown ? BaseCtrlType.InputString.ToString() : f2.Desc.Switch_CtrlType.ToString();
             //f1._DB_TYPE = f2.DataType.TypeNameString;
             f1._DB_TYPE = f2.DataType.GetParamSql();//char(8), decaml(8,0)
             f1.TYPE_CODE = StringHelper.HeadUpper(f2.DataType.NetType);
             f1.TYPE_ID = 0;
             break;
     }
     return f1;
 }
Exemple #25
0
    /// <summary>
    /// 相关子表
    /// </summary>
    /// <returns></returns>
    protected string getSubForm()
    {
        StringBuilder sb = new StringBuilder();

        try
        {
            //DataBaseField[] flist = valObj.af_GetAvailableDataBaseField();
            //foreach (DataBaseField f1 in flist)
            {
                //父表的id
                object id1 = resultObj.GetValue(valObj.DataBaseTable.IDField);

                string tableName1 = "关系表1";
                if (valObj.DataBaseTable.SubTable_ChaZhao.Count > 0)
                {
                    int count2 = 0;//计数
                    foreach (DataBaseTableRelation dr1 in valObj.DataBaseTable.SubTable_ChaZhao)
                    {
                        DataBaseTable table2 = dr1.DataBaseTable;
                        tableName1 = table2.TableName;
                        DataBaseField   IDField   = dr1.DataBaseTable.IDField;
                        DataBaseField   NameField = dr1.DataBaseTable.NameField;
                        List <Relation> lstRel    = new List <Relation>();
                        foreach (DataBaseRelation r1 in dr1.Relations)
                        {
                            lstRel.Add(new Relation(r1));
                        }
                        ITableImplement value2 = new ITableImplement(table2);

                        ITableImplement cond2 = new ITableImplement(table2);
                        cond2.SetValue(AttributeItem.Factory(value2.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.IDField), id1);
                        List <ITableImplement> lstCond = new List <ITableImplement>();
                        lstCond.Add(cond2);

                        List <ITableImplement> lstOther = new List <ITableImplement>();

                        count1 = -1;

                        //显示明显表的 父表的信息
                        //value2.setConn(conn).setModule("WEC_QC_CARS");
                        List <ITableImplement> list2 = BLLTable <ITableImplement> .Factory(conn).SelectByPage(value2, lstRel, lstOther, lstCond,
                                                                                                              pageSize, pageIndex, ref count1);

                        int num = count1 / pageSize;
                        if (list2.Count > 0)
                        {
                            sb.Append("<script type=\"text/javascript\">");
                            sb.Append("$(function () {");
                            sb.Append("$(\"#tbl" + tableName1 + "Title\").click(function () {");
                            sb.Append("$(\"#tbl" + tableName1 + "\").toggleClass(\"hide\");");
                            sb.Append("$(\"#tbl" + tableName1 + "Img\").toggleClass(\"showUp\");");
                            sb.Append("});");
                            //sb.Append("$(\"ul >li >a[name="+count2+"]\").click(function () {" +
                            //    "alert($(this).attr(\"rel\"))" +
                            //    "});");

                            //  sb.Append("$(\"ul >li >a[name=" + count2 + "]\").click(function () {" +
                            //     //"$(\"ul >li >a[name=" + count2 + "]\").parent().removeClass(\"active\");"+
                            //     //"$(this).parent().addClass(\"active\");"+

                            //     "var str = $(this).attr(\"rel\");" +
                            //     "var strs = str.split(\".\");" +
                            //     "var content=$(this).html();"+
                            //    // "alert(content==\"下一页\");" +
                            //     "if(content==\"下一页\"){"+
                            //     "if((parseInt(strs[1])+1)<="+(num+1)+"){"+
                            //        "var nextStr=strs[0]+\".\"+(parseInt(strs[1])+1);"+
                            //        "var prevStr=strs[0]+\".\"+(parseInt(strs[1])-1);" +
                            //       "$(this).attr(\"rel\",nextStr);"+
                            //       "$(this).parent().siblings().find(\"a\").attr(\"rel\",prevStr);" +
                            //       "$(this).parent().siblings().removeClass(\"disabled\");" +
                            //      "}else{"+
                            //          "var nextStr=strs[0]+\".\"+(parseInt(strs[1])+1);" +
                            //          "var prevStr=strs[0]+\".\"+(parseInt(strs[1])-1);" +
                            //          "$(this).attr(\"rel\",nextStr);" +
                            //           "$(this).parent().siblings().find(\"a\").attr(\"rel\",prevStr);" +
                            //          "$(this).parent().siblings().removeClass(\"disabled\");" +
                            //           "$(this).parent().addClass(\"disabled\");"+
                            //      "}"+
                            //     " }else{"+
                            //       "if((parseInt(strs[1])-1)>=1){"+
                            //           "var nextStr=strs[0]+\".\"+(parseInt(strs[1])+1);" +
                            //          "var prevStr=strs[0]+\".\"+(parseInt(strs[1])-1);"+
                            //          "$(this).attr(\"rel\",prevStr);"+
                            //         "$(this).parent().siblings().find(\"a\").attr(\"rel\",nextStr);" +
                            //          "$(this).parent().siblings().removeClass(\"disabled\");" +
                            //          "}else{"+
                            //           "var nextStr=strs[0]+\".\"+(parseInt(strs[1])+1);" +
                            //           "var prevStr=strs[0]+\".\"+(parseInt(strs[1])-1);" +
                            //           "$(this).attr(\"rel\",prevStr);" +
                            //           "$(this).parent().siblings().find(\"a\").attr(\"rel\",nextStr);" +
                            //          "$(this).parent().siblings().removeClass(\"disabled\");" +
                            //          "$(this).parent().addClass(\"disabled\");"+
                            //           "}"+
                            //      "}"+
                            //     "$.ajax({" +
                            //       "url:\"Back.aspx\"," +
                            //       "type:\"post\"," +
                            //       "data:{\"ModuleName\":\"" + ModuleName + "\",\"pageIndex\":strs[1],\"num\":strs[0],\"id1\":"+id1+",\"paging\":\"true\"}," +
                            //       "dataType:\"text\"," +
                            //       "success: function (data) {" +
                            //           "$(\"tbody[rel=\" + strs[0] + \"]\").html(data);" +

                            //       "}," +
                            //       "error: function (data) {" +
                            //           "alert(data);" +
                            //       "}" +
                            //   "});" +
                            //"});");

                            sb.Append(" var options = {" +
                                      "currentPage: 1," +
                                      "totalPages: " + (count1 / 10 + 1) + "," +
                                      "numberOfPages:5," +
                                      "onPageChanged:function(event){" +
                                      // "alert($(event.currentTarget).find(\"ul li.active a\").html());" +
                                      "$.ajax({" +
                                      "url:\"Back.aspx\"," +
                                      "type:\"post\"," +
                                      "data:{\"ModuleName\":\"" + ModuleName + "\",\"pageIndex\":$(event.currentTarget).find(\"ul li.active a\").html(),\"num\":" + count2 + ",\"id1\":" + id1 + ",\"paging\":\"true\"}," +
                                      "dataType:\"text\"," +
                                      "success: function (data) {" +
                                      "$(\"tbody[rel=" + count2 + "]\").html(data);" +

                                      "}," +
                                      "error: function (data) {" +
                                      "alert(data);" +
                                      "}" +
                                      "});" +
                                      "}" +
                                      "};" +
                                      "$('#page" + count2 + "').bootstrapPaginator(options);");
                            sb.Append("});");
                            sb.Append("</script>");
                            sb.Append("<div id='tbl" + tableName1 + "Title' class='showTitle'><span >" + value2._ZhName + "信息</span><span id='tbl" + tableName1 + "Img' class='showImg'></span></div>");

                            sb.Append("<div id='tbl" + tableName1 + "' class=\"tblist\">");
                            sb.Append("<table cellpadding=\"0\" cellspacing=\"0\" id=\"tbList\" class=\"table table-hover\">");
                            sb.Append("<thead>");
                            sb.Append("<tr keyname=\"ID\">");
                            foreach (DataBaseField d2 in value2.af_GetAvailableDataBaseField())
                            {
                                sb.Append("<td data=\"{colname:'" + d2.LongAttributeName + "',show:1}\">" + d2.ZhName + "</td>");
                            }
                            sb.Append("</tr>");
                            sb.Append("</thead>");
                            sb.Append("<tbody rel=\"" + count2 + "\">");
                            foreach (ITableImplement tb2 in list2)
                            {
                                sb.Append("<tr>");
                                foreach (DataBaseField d2 in tb2.af_GetAvailableDataBaseField())
                                {
                                    sb.Append("<td>" + GetHtmlList(d2, tb2) + "");
                                }
                                sb.Append("</tr>");
                            }
                            sb.Append("</tbody>");
                            sb.Append("</table>");

                            //sb.Append("<div class=\"container\"><div><ul  class=\"pager\">");

                            ////for (int i = 0; i <= num;i++ )
                            ////{
                            ////    if (pageIndex == i + 1)
                            ////    {
                            ////        sb.Append("<li class=\"active\"><a href=\"javascript:;\" name=\""+count2+"\" rel="+count2+"."+(i+1)+">" + (i + 1) + "</a></li>");
                            ////    }
                            ////    else
                            ////    {
                            ////        sb.Append("<li><a href=\"javascript:;\" name=\""+count2+"\" rel=" + count2 + "." + (i + 1) + ">" + (i + 1) + "</a></li>");
                            ////    }
                            ////}
                            //sb.Append("<li class=\"disabled\"><a href=\"javascript:;\" name=\"" + count2 + "\" rel=" + count2 + "." + 1 + ">上一页</a></li>");

                            //if (num==0)
                            //{
                            //    sb.Append("<li class=\"disabled\"><a href=\"javascript:;\" name=\"" + count2 + "\" rel=" + count2 + "." + 2 + ">下一页</a></li>");
                            //}else{

                            //    sb.Append("<li><a href=\"javascript:;\" name=\"" + count2 + "\" rel=" + count2 + "." + 2 + ">下一页</a></li>");
                            //}
                            //sb.Append("</ul></div></div>");
                            sb.Append("<div id=\"page" + count2 + "\"></div>");
                            sb.Append("</div>");
                            count2++;
                        }
                    }
                }
                else if (valObj.DataBaseTable.SubTable_ExtField.Count > 0)
                {
                    DataBaseField IDField = valObj.DataBaseTable.SubTable_ChaZhao[0].DataBaseTable.IDField;
                }
                else if (valObj.DataBaseTable.SubTable_Many2Many.Count > 0)
                {
                    DataBaseField IDField = valObj.DataBaseTable.SubTable_ChaZhao[0].DataBaseTable.IDField;
                }
                else if (valObj.DataBaseTable.SubTable_MingXi.Count > 0)
                {
                    DataBaseField IDField = valObj.DataBaseTable.SubTable_ChaZhao[0].DataBaseTable.IDField;
                }
                else if (valObj.DataBaseTable.SubTable_MyTree.Count > 0)
                {
                    DataBaseField IDField = valObj.DataBaseTable.SubTable_ChaZhao[0].DataBaseTable.IDField;
                }
                else if (valObj.DataBaseTable.SubTable_Tree.Count > 0)
                {
                    DataBaseField IDField = valObj.DataBaseTable.SubTable_ChaZhao[0].DataBaseTable.IDField;
                }
            }
        }
        catch (Exception ex)
        {
        }
        return(sb.ToString());
    }
Exemple #26
0
    /// <summary>
    /// 输入html
    /// </summary>
    /// <returns></returns>
    protected string getInput()
    {
        StringBuilder sb           = new StringBuilder();
        string        strChazhaoID = "";

        try
        {
            DataBaseField[] flist = valObj.af_GetAvailableDataBaseField();
            foreach (DataBaseField f1 in flist)
            {
                string block = "基础信息";
                block = f1.Desc.af_BlockName;
                string blockid = f1.Desc.af_BlockID;

                if (f1.TableName != resultObj._TableName) //说明不是本表字段
                {
                    block = f1.TableName;                 //布局名,就是 关联表的父表 表名

                    if (resultObj.IsOnlyForModuleIDName == true)
                    {
                        break;
                    }
                    else
                    {
                    }
                }

                f1.Value = Convert.ToString(resultObj.GetValue(f1));

                string attrHtml = Input;

                BuildByTag b1 = new BuildByTag(BuildType.ForHtmlValue);
                b1.ParseForSwitch标签(ref attrHtml, f1);

                if (isChaZhao(f1))
                {
                    DataBaseField f2   = f1.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.NameField;
                    string        html = Convert.ToString(resultObj.GetValue(f2));
                    attrHtml     = attrHtml.Replace("{字段显示值}", html);
                    strChazhaoID = f1.Value;
                }

                else if (isSelect(f1))//枚举量
                {
                    AttributeItem attr2 = AttributeItem.Factory(f1);
                    string        html  = BaseFormHelper.Factory(resultObj.ConnectKey).GetOptionText(attr2, f1.Value);
                    attrHtml = html;
                }
                else if (f1.Desc.Switch_CtrlType == BaseCtrlType.FileUpImage)
                {
                    attrHtml = "<img style='height:19px;top:5px;postion:relative;' src ='" + f1.Value + "' style='height:40px' />";
                }



                sb.Append("<dl class=\"dl-horizontal\"><dt><span>").Append(f1.Desc.ZhName).Append("</span></dt><!--").Append(f1.FieldName)
                .Append("--><dd><span>");
                sb.Append(attrHtml);
                sb.Append("</span></dd></dl>");
            }
        }
        catch (Exception ex)
        {
            Cs.Error("34" + ex.ToString());
        }
        return(sb.ToString());
    }
 protected string GetShowFieldName(DataBaseField field)
 {
     if (field == null)
         return "";
     return field.FieldName + (string.IsNullOrEmpty(field.Desc.ZhName) ? "" : ("(" + field.Desc.ZhName + ")"));
 }
Exemple #28
0
    /// <summary>
    /// 获取list页的数据源
    /// 支持主模块的链接
    /// 支持枚举量
    /// 支持时间格式
    /// </summary>
    /// <param name="f1"></param>
    /// <returns></returns>
    public string GetHtmlList(DataBaseField f1, ITableImplement this1)
    {
        string html = "";

        try
        {
            DataBaseTable dt1 = f1.DataBaseTable;
            if (f1 != dt1.IDField && f1 != dt1.NameField)
            {
                if (!f1.Desc.af_Enable)
                {
                    return("");                   //是否可用
                }
                if (!f1.Desc.af_Visable)
                {
                    return("");                    //是否可见
                }
            }
            AttributeItem attr1  = AttributeItem.Factory(f1);
            object        value1 = (this1.GetValue(attr1));

            //DataBaseField f1;
            DataBaseField id1   = dt1.IDField;
            DataBaseField name1 = dt1.NameField;

            if (f1 == dt1.IDField)//编号字段
            {
                //html = "<a href='index.aspx?id=" + this1.GetValue(dt1.FieldID.FieldName) + "'>" + html + "</a>";
            }
            else if (f1 == dt1.NameField)// != null && dt1.NameField.FieldName == f1.FieldName)//本模块name详细链接
            {
                string showUrl = "../" + f1.TableName + "/show.aspx";
                if (!Exist(showUrl))
                {
                    showUrl = "show.aspx";
                }
                html = "<a href='" + showUrl + "?id=" + this1.GetValue(id1) + "&moduleName=" + f1.TableName
                       + "' target='_blank'>" + value1 + "</a>";
            }
            else if (isSelect(f1))//枚举量
            {
                string str = Convert.ToString(value1);

                if (str.Contains(","))
                {
                    //多选
                    string[]      strs      = str.Split(',');
                    List <object> valueList = new List <object>(strs);
                    List <object> nameList  = BaseFormHelper.Factory(this1.ConnectKey).GetOptionText(attr1, valueList);
                    StringBuilder sb        = new StringBuilder();
                    foreach (object s in nameList)
                    {
                        String ss = Convert.ToString(s);
                        sb.Append(ss + ",");
                    }
                    html = sb.ToString();
                    html = html.Substring(0, html.LastIndexOf(","));
                }
                else
                {
                    //单选
                    html = BaseFormHelper.Factory(this1.ConnectKey).GetOptionText(attr1, value1);
                }
            }
            else if (isChaZhao(f1))//父表
            {
                DataBaseField f2    = f1.DataBaseTable.FatherTable_ChaZhao[0].DataBaseTable.NameField;
                AttributeItem attr2 = AttributeItem.Factory(f2);
                html = Convert.ToString(this1.GetValue(attr2));

                //为关联的表的name设置链接
                string showUrl = "../" + f1.TableName + "/show.aspx";
                if (!Exist(showUrl))
                {
                    showUrl = "show.aspx";
                }
                html = "<a href='" + showUrl + "?id=" + this1.GetValue(id1) + "&moduleName=" + f1.TableName
                       + "' target='_blank'>" + html + "</a>";
            }
            else if (f1.Desc.Switch_CtrlType == BaseCtrlType.FileUpImage)
            {
                html = "<img src ='" + value1 + "' style='height:40px' />";
            }
            else if (f1.Desc.Switch_CtrlType == BaseCtrlType.FileUpUpDoc)
            {//
                if (!value1.Equals(" "))
                {
                    string   val  = Convert.ToString(value1);
                    string[] strs = val.Split(';');
                    for (int i = 0; i < strs.Length - 1; i++)
                    {
                        string[] ss    = strs[i].Split(',');
                        string   title = ss[0];
                        string   url   = ss[1];

                        html += "<span>" + title + "&nbsp;<a href='Back.aspx?moduleName=" + ModuleName + "&download=true&filename=" + url + "'>下载</a></span>";
                    }
                }
            }
            if (html == "")
            {
                html = Convert.ToString(value1);
            }
        }
        catch (Exception ex)
        {
            Cs.Error(ex.ToString());
        }
        return(html);//.TrimEnd('\n').TrimEnd('\r').Trim();
    }