Example #1
0
        /// <summary>
        /// 添加控件至F4的集合
        /// </summary>
        /// <param name="F4">F4控件</param>
        /// <param name="Ctr">数据字典包括的控件</param>
        /// <param name="sAttr">控件属性。P:主键;R;查询条件;I:需F4查出来后返回值;B:往后台传的参数</param>
        /// <param name="sBackname">对应后台字段名</param>
        /// <param name="sColName">前台显示列名</param>
        /// <param name="siCol">前台对应的列号。从1开始</param>
        public static void Gp_DD_Collection(C1.Win.C1FlexGrid.Column F4, C1.Win.C1FlexGrid.Column Ctr, string sAttr, string sBackname, string sColName, int siCol)
        {
            // if (F4 is F4COMN)
            // {
            F4COMN f4_temp = (F4COMN)F4.Editor;

            f4_temp.Contrl.Add(Ctr);
            f4_temp.CtlAttr.Add(sAttr == null ? "" : sAttr.ToUpper());
            f4_temp.ColName.Add(sColName == null ? "" : sColName);
            f4_temp.BackName.Add(sBackname == null ? "" : sBackname);
            f4_temp.iCol.Add(siCol < 1 ? 1 : siCol);
            //  }
            // else if (F4 is F4COMR)
            // {
            //    F4COMR f4_temp = (F4COMR)F4;
            //    f4_temp.Contrl.Add(Ctr);
            //    f4_temp.CtlAttr.Add(sAttr == null ? "" : sAttr.ToUpper());
            //    f4_temp.ColName.Add(sColName == null ? "" : sColName);
            //    f4_temp.BackName.Add(sBackname == null ? "" : sBackname);
            //    f4_temp.iCol.Add(siCol < 1 ? 1 : siCol);
            //}
            //else
            //{
            //    throw new System.Exception("Gp_DD_Collection没有找到控件" + F4.Name);
            //}
        }
Example #2
0
 /// <summary>
 /// 添加控件至F4的集合
 /// </summary>
 /// <param name="F4">F4控件</param>
 /// <param name="Ctr">数据字典包括的控件</param>
 /// <param name="sAttr">控件属性。P:主键;R;查询条件;I:需F4查出来后返回值;B:往后台传的参数</param>
 /// <param name="sBackname">对应后台字段名</param>
 /// <param name="sColName">前台显示列名</param>
 /// <param name="siCol">前台对应的列号。从1开始</param>
 public static void Gp_DD_Collection(Control F4, object Ctr, string sAttr, string sBackname, string sColName, int siCol)
 {
     if (F4 is F4COMN)
     {
         F4COMN f4_temp = (F4COMN)F4;
         f4_temp.Contrl.Add(Ctr);
         f4_temp.CtlAttr.Add(sAttr == null ? "" : sAttr.ToUpper());
         f4_temp.ColName.Add(sColName == null ? "" : sColName);
         f4_temp.BackName.Add(sBackname == null ? "" : sBackname);
         f4_temp.iCol.Add(siCol < 1 ? 1 : siCol);
     }
     else if (F4 is F4COMR)
     {
         F4COMR f4_temp = (F4COMR)F4;
         f4_temp.Contrl.Add(Ctr);
         f4_temp.CtlAttr.Add(sAttr == null ? "" : sAttr.ToUpper());
         f4_temp.ColName.Add(sColName == null ? "" : sColName);
         f4_temp.BackName.Add(sBackname == null ? "" : sBackname);
         f4_temp.iCol.Add(siCol < 1 ? 1 : siCol);
     }
     else
     {
         throw new System.Exception("Gp_DD_Collection没有找到控件" + F4.Name);
     }
 }
Example #3
0
        /// <summary>
        /// 设置F4控件的相关属性
        /// </summary>
        /// <param name="F4">F4控件</param>
        /// <param name="sBackTableName">对应的后台表名</param>
        /// <param name="sKeyName">代码对应的列名</param>
        /// <param name="sKeyValue">代码值</param>
        /// <param name="sJoin">限制条件</param>
        /// <param name="sOrderBy">排序顺序</param>
        /// <param name="sCusSql">自定义SQL语句</param>
        /// <param name="sPrcoCode">自定义后台包名.过程名。eg:PKG_QZA1010C.P_AMODIFY1</param>
        /// <param name="iMaxLength">F4COMR的长度</param>
        public static void Gp_DD_Set(C1.Win.C1FlexGrid.Column F4, string sBackTableName, string sKeyName, string sKeyValue, string sJoin, string sOrderBy, string sCusSql, string sPrcoCode, int iMaxLength)
        {
            F4COMN f4_temp = new F4COMN();

            f4_temp.BackTableName = sBackTableName == null ? "TZ_CD" : sBackTableName;
            f4_temp.KeyName       = sKeyName == null ? "" : sKeyName;
            f4_temp.Key           = sKeyValue == null ? "" : sKeyValue;
            f4_temp.OrderBy       = sOrderBy == null ? "" : sOrderBy;
            f4_temp.Join          = sJoin == null ? "" : sJoin;
            f4_temp.CusSql        = sCusSql == null ? "" : sCusSql;
            f4_temp.PrcoCode      = sPrcoCode == null ? "" : sPrcoCode;
            if (sPrcoCode != null && sPrcoCode.Length > 0)
            {
                f4_temp.Set_Witch2Cus();
            }
            F4.Editor = f4_temp;
            //if (F4 is F4COMN)
            //{
            //    F4COMN f4_temp = (F4COMN)F4;
            //    f4_temp.BackTableName = sBackTableName == null ? "TZ_CD" : sBackTableName;
            //    f4_temp.KeyName = sKeyName == null ? "" : sKeyName;
            //    f4_temp.Key = sKeyValue == null ? "" : sKeyValue;
            //    f4_temp.OrderBy = sOrderBy == null ? "" : sOrderBy;
            //    f4_temp.Join = sJoin == null ? "" : sJoin;
            //    f4_temp.CusSql = sCusSql == null ? "" : sCusSql;
            //    f4_temp.PrcoCode = sPrcoCode == null ? "" : sPrcoCode;
            //    if (sPrcoCode != null && sPrcoCode.Length > 0)
            //        f4_temp.Set_Witch2Cus();
            //}
            //else if (F4 is F4COMR)
            //{
            //    F4COMR f4_temp = (F4COMR)F4;
            //    f4_temp.BackTableName = sBackTableName == null ? "TZ_CD" : sBackTableName;
            //    f4_temp.KeyName = sKeyName == null ? "" : sKeyName;
            //    f4_temp.Key = sKeyValue == null ? "" : sKeyValue;
            //    f4_temp.OrderBy = sOrderBy == null ? "" : sOrderBy;
            //    f4_temp.Join = sJoin == null ? "" : sJoin;
            //    f4_temp.CusSql = sCusSql == null ? "" : sCusSql;
            //    f4_temp.PrcoCode = sPrcoCode == null ? "" : sPrcoCode;
            //    f4_temp.MaxLength = iMaxLength < 1 ? 9999 : iMaxLength;
            //    if (sPrcoCode != null && sPrcoCode.Length > 0)
            //        f4_temp.Set_Witch2Cus();
            //}
            //else
            //{
            //    throw new System.Exception("Gp_DD_Set没有找到控件" + F4.Name);
            //}
        }
Example #4
0
 /// <summary>
 /// 设置F4控件的相关属性
 /// </summary>
 /// <param name="F4">F4控件</param>
 /// <param name="sBackTableName">对应的后台表名</param>
 /// <param name="sKeyName">代码对应的列名</param>
 /// <param name="sKeyValue">代码值</param>
 /// <param name="sJoin">限制条件</param>
 /// <param name="sOrderBy">排序顺序</param>
 /// <param name="sCusSql">自定义SQL语句</param>
 /// <param name="sPrcoCode">自定义后台包名.过程名。eg:PKG_QZA1010C.P_AMODIFY1</param>
 /// <param name="iMaxLength">F4COMR的长度</param>
 public static void Gp_DD_Set(Control F4, string sBackTableName, string sKeyName, string sKeyValue, string sJoin, string sOrderBy, string sCusSql, string sPrcoCode, int iMaxLength)
 {
     if (F4 is F4COMN)
     {
         F4COMN f4_temp = (F4COMN)F4;
         f4_temp.BackTableName = sBackTableName == null?"TZ_CD":sBackTableName;
         f4_temp.KeyName       = sKeyName == null?"":sKeyName;
         f4_temp.Key           = sKeyValue == null?"":sKeyValue;
         f4_temp.OrderBy       = sOrderBy == null?"":sOrderBy;
         f4_temp.Join          = sJoin == null?"":sJoin;
         f4_temp.CusSql        = sCusSql == null?"":sCusSql;
         f4_temp.PrcoCode      = sPrcoCode == null?"":sPrcoCode;
         if (sPrcoCode != null && sPrcoCode.Length > 0)
         {
             f4_temp.Set_Witch2Cus();
         }
     }
     else if (F4 is F4COMR)
     {
         F4COMR f4_temp = (F4COMR)F4;
         f4_temp.BackTableName = sBackTableName == null ? "TZ_CD" : sBackTableName;
         f4_temp.KeyName       = sKeyName == null ? "" : sKeyName;
         f4_temp.Key           = sKeyValue == null ? "" : sKeyValue;
         f4_temp.OrderBy       = sOrderBy == null ? "" : sOrderBy;
         f4_temp.Join          = sJoin == null ? "" : sJoin;
         f4_temp.CusSql        = sCusSql == null ? "" : sCusSql;
         f4_temp.PrcoCode      = sPrcoCode == null ? "" : sPrcoCode;
         f4_temp.MaxLength     = iMaxLength < 1 ? 9999 : iMaxLength;
         if (sPrcoCode != null && sPrcoCode.Length > 0)
         {
             f4_temp.Set_Witch2Cus();
         }
     }
     else
     {
         throw new System.Exception("Gp_DD_Set没有找到控件" + F4.Name);
     }
 }
Example #5
0
        private TableLayoutPanel CreateField(int colIndex)
        {
            //Create TableLayoutPanel
            TableLayoutPanel tlp = new TableLayoutPanel();

            tlp.ColumnCount = 2;
            tlp.RowCount    = 1;
            tlp.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 36.0F));
            tlp.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 64.0F));
            tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0F));

            //Create Label
            Label lbl = new Label();

            lbl.BorderStyle = BorderStyle.Fixed3D;
            lbl.TextAlign   = ContentAlignment.MiddleRight;
            lbl.Text        = (string)((Collection )Sc["CHTitle"])[colIndex];

            tlp.Controls.Add(lbl, 0, 0);
            lbl.Dock = System.Windows.Forms.DockStyle.Fill;

            string sType = ((string)((Collection )Sc["ColType"])[colIndex]).ToUpper();
            object ctl   = null;

            switch (sType)
            {
            case "E":                     //'TextEdit,Password
            case "P":
                TextBox ctl_t = new TextBox();
                if (sType == "P")
                {
                    ctl_t.PasswordChar = '*';
                }
                if (((Collection)Sc["ColLength"])[colIndex] == "")
                {
                    ctl_t.MaxLength = 200;
                }
                else
                {
                    ctl_t.MaxLength = (int)((Collection)Sc["ColLength"])[colIndex];
                }
                //ctl_t.MaxLength = ги((Collection)Sc["ColLength"])[colIndex] == "" ? 200 : ((Collection)Sc["ColLength"])[colIndex]));
                tlp.Controls.Add(ctl_t, 1, 0);
                ctl_t.Dock = DockStyle.Fill;
                ctl_t.Text = (string)Record[colIndex];
                ctl        = ctl_t;
                break;

            case "N":                     //'NumberEdit
                ctl = new System.Windows.Forms.MaskedTextBox();
                MaskedTextBox ctl_m = new MaskedTextBox();
                string[]      Ass_1 = new string[3];
                Ass_1      = ((Collection)Sc["ColLength"])[colIndex].ToString().Split(',');
                ctl_m.Mask = " ".PadLeft(int.Parse(Ass_1[0])).Trim() + "." + " ".PadLeft(int.Parse(Ass_1[1])).Trim();
                tlp.Controls.Add(ctl_m, 1, 0);
                ctl_m.Dock = DockStyle.Fill;
                ctl_m.Text = (string)Record[colIndex];
                ctl        = ctl_m;
                break;

            case "ON":
            case "OE":
                //'Combox not editable ''Combox Editable
                ctl = new ComboBox();
                ComboBox ctl_c     = new ComboBox();
                string[] splitCom  = ((Collection)Sc["ComCode"])[colIndex].ToString().Split(';');
                string[] splitProc = ((Collection)Sc["Filter"])[colIndex].ToString().Split(';');
                string[] splitCus  = ((Collection)Sc["CustQuery"])[colIndex].ToString().Split(';');
                DataSet  ds        = null;
                if (splitCom[0].Trim() != "")
                {
                    ds = new CdQuery(splitCom[0].Trim(), "").CreateDataSet(true);
                    ctl_c.DataSource = ds;
                }
                else if (splitProc[0].Trim() != "")
                {
                    ds = new ProcQuery(splitProc[0].Trim(), new ArrayList()).CreateDataSet(true);
                    ctl_c.DataSource = ds;
                }
                else if (splitCus[0].Trim() != "")
                {
                    ds = new Query(splitCus[0].Trim()).CreateDataSet(true);
                    ctl_c.DataSource = ds;
                }
                ctl_c.DataSource    = ds.Tables[0].DefaultView;
                ctl_c.DisplayMember = ds.Tables[0].Columns[0].ToString();
                ctl_c.ValueMember   = ds.Tables[0].Columns[1].ToString();
                ctl_c.SelectedValue = "";
                if (sType == "ON")
                {
                    ctl_c.DropDownStyle = ComboBoxStyle.DropDownList;
                }
                else
                {
                    ctl_c.DropDownStyle = ComboBoxStyle.DropDown;
                }

                tlp.Controls.Add(ctl_c, 1, 0);
                ctl_c.Dock = DockStyle.Fill;
                ctl_c.Text = (string)Record[colIndex];
                ctl        = ctl_c;
                break;

            case "C":                     //'Checkbox
                CheckBox ctl_c2 = new CheckBox();
                tlp.Controls.Add(ctl_c2, 1, 0);
                ctl_c2.Dock = DockStyle.Fill;
                ctl_c2.Text = (string)Record[colIndex];
                ctl         = ctl_c2;
                break;

            case "D":                     //'Date ,Time
            case "T":
                DateTimePicker ctl_d = new DateTimePicker();
                ctl_d.Format = DateTimePickerFormat.Custom;
                if (sType == "D")
                {
                    ctl_d.CustomFormat = "yyyy-MM-dd";
                }
                else
                {
                    ctl_d.CustomFormat = "HH:mm:ss";
                }
                tlp.Controls.Add(ctl_d, 1, 0);
                ctl_d.Dock = DockStyle.Fill;
                ctl_d.Text = (string)Record[colIndex];
                ctl        = ctl_d;
                break;

            case "COMR":                     //'TextEdit with F4 Event return Common code and name
                ctl = new F4COMR();
                F4COMR ctl_f = new F4COMR();
                ctl_f.sKey  = ((Collection)Sc["ComCode"])[colIndex].ToString();
                ctl_f.sJoin = ((Collection)Sc["Filter"])[colIndex].ToString();
                ctl_f.sMax  = 20;
                tlp.Controls.Add(ctl_f, 1, 0);
                ctl_f.Dock = DockStyle.Fill;
                ctl_f.Text = (string)Record[colIndex];
                ctl        = ctl_f;
                break;

            case "COMN":                     //'TextEdit with F4 Event return Common code only
                F4COMN ctl_f2 = new F4COMN();
                ctl_f2.sKey  = ((Collection)Sc["ComCode"])[colIndex].ToString();
                ctl_f2.sJoin = ((Collection)Sc["Filter"])[colIndex].ToString();
                tlp.Controls.Add(ctl_f2, 1, 0);
                ctl_f2.Dock = DockStyle.Fill;
                ctl_f2.Text = (string)Record[colIndex];
                ctl         = ctl_f2;
                break;

            case "ETCR":                     //'TextEdit with F4 Event return code and name
                break;

            case "ETCN":                     //'TextEdit with F4 Event return code only
                F4ETCN ctl_f3 = new F4ETCN();
                ctl_f3.sJoin = ((Collection)Sc["Filter"])[colIndex].ToString();
                string[] Ass = new string[3];
                Ass              = (((Collection)Sc["CustQuery"])[colIndex]).ToString().Split(';');
                ctl_f3.sSqletc   = Ass[0];
                ctl_f3.sFcontrol = Ass[1];
                tlp.Controls.Add(ctl_f3, 1, 0);
                ctl_f3.Dock = DockStyle.Fill;
                ctl_f3.Text = (string)Record[colIndex];
                ctl         = ctl_f3;
                break;
            }
            string sAttr = (string)(((Collection)Sc["ColAttr"])[colIndex].ToString().ToUpper());

            if (sAttr.IndexOf("P") > -1)
            {
                ((Collection)m_Master["pControl"]).Add(ctl);
            }
            else if (sAttr.IndexOf("N") > -1)
            {
                ((Collection)m_Master["nControl"]).Add(ctl);
            }
            else if (sAttr.IndexOf("M") > -1)
            {
                ((Collection)m_Master["mControl"]).Add(ctl);
            }
            else if (sAttr.IndexOf("I") > -1)
            {
                ((Collection)m_Master["iControl"]).Add(ctl);
            }
            else if (sAttr.IndexOf("L") > -1)
            {
                ((Collection)m_Master["lControl"]).Add(ctl);
            }

            return(tlp);
        }
Example #6
0
        public static void Gp_F4Find(Control F4)
        {
            string sWhere = "";
            string sQuery = "";

            if (F4 is F4COMN)
            {
                F4COMN f4_temp = (F4COMN)F4;


                if (f4_temp.Get_Witch() == "MS" || f4_temp.Get_Witch() == "CUS")
                {
                    if (!string.IsNullOrEmpty(f4_temp.CusSql))
                    {
                        sQuery = f4_temp.CusSql;
                        sWhere = "";
                    }
                    else if (!string.IsNullOrEmpty(f4_temp.PrcoCode))
                    {
                        string callSql = "{call " + f4_temp.PrcoCode + "(";
                        string Par     = "";
                        for (int i = 0; i < f4_temp.Contrl.Count; i++)
                        {
                            if (f4_temp.CtlAttr[i].ToString().ToUpper().Contains("R"))
                            {
                                Par += "'" + MasterCommon.GetControlValue(f4_temp.Contrl[i]).ToString().Replace("'", "''") + "',";
                            }
                        }
                        if (Par.Length > 0)
                        {
                            Par = Par.Substring(0, Par.Length - 1);
                        }
                        callSql = callSql + Par + ")}";

                        sQuery = callSql;
                        sWhere = "";
                    }
                    else
                    {
                        string sQuery_temp   = " ";
                        string sWhere_after  = "";
                        string sWhere_before = "";
                        string sOrder_Temp   = " ";
                        if (f4_temp.KeyName.Trim().Length > 0 && f4_temp.Key.Trim().Length > 0)
                        {
                            sWhere_before = "where " + f4_temp.KeyName.Trim() + "='" + f4_temp.Key.Trim() + "' and ";
                        }
                        else
                        {
                            sWhere_before = "where ";
                        }
                        sQuery = " SELECT ";

                        //拼Where 后面的限制条件 和 Select 后的字段
                        for (int i = 0; i < f4_temp.Contrl.Count; i++)
                        {
                            if (!string.IsNullOrEmpty(Convert.ToString(f4_temp.BackName[i])))
                            {
                                if (f4_temp.CtlAttr[i].ToString().ToUpper().Contains("R") && !f4_temp.CtlAttr[i].ToString().ToUpper().Contains("P"))
                                {
                                    sWhere_after += "and    nvl(" + f4_temp.BackName[i].ToString().Trim() + ",'')        LIKE '%" + MasterCommon.GetControlValue(f4_temp.Contrl[i]).ToString().Trim().Replace("'", "''") + "%' ";
                                }
                                else if (f4_temp.CtlAttr[i].ToString().ToUpper().Contains("P"))
                                {
                                    sWhere_after += "and    " + f4_temp.BackName[i].ToString().Trim() + "       LIKE '%" + MasterCommon.GetControlValue(f4_temp.Contrl[i]).ToString().Trim().Replace("'", "''") + "%' ";
                                    sOrder_Temp  += " " + f4_temp.BackName[i].ToString().Trim() + " Asc ,";
                                }

                                if (string.IsNullOrEmpty(Convert.ToString(f4_temp.ColName[i])))
                                {
                                    sQuery_temp += " " + f4_temp.BackName[i] + " \" " + f4_temp.BackName[i] + " \",";
                                }
                                sQuery_temp += " " + f4_temp.BackName[i] + " \" " + f4_temp.ColName[i] + " \",";
                            }
                        }

                        sQuery += sQuery_temp.Substring(0, sQuery_temp.Length - 1) + "    FROM " + f4_temp.BackTableName + " ";
                        sQuery += sWhere_before;

                        sWhere_after += "    ";

                        //  if (!sWhere_before.Contains("="))
                        {
                            sWhere_after = sWhere_after.Substring(4);
                        }

                        sWhere += sWhere_after + " ";

                        sWhere += "   " + f4_temp.Join;
                        if (!string.IsNullOrEmpty(f4_temp.OrderBy))
                        {
                            sWhere += "  " + f4_temp.OrderBy;
                        }
                        else
                        {
                            sWhere += " order by " + sOrder_Temp.Substring(0, sOrder_Temp.Length - 1);
                        }
                    }
                }

                System.Data.DataTable DataTab = GeneralCommon.Gf_ExecProc2Ref(sQuery + sWhere);

                if (DataTab.Rows.Count == 1)
                {
                    int    i      = 0;
                    string CtlAtt = "";
                    for (i = 0; i < f4_temp.Contrl.Count; i++)
                    {
                        CtlAtt = f4_temp.CtlAttr[i].ToString().ToUpper();
                        if (CtlAtt.Contains("I"))
                        {
                            Control Ctr = (Control)f4_temp.Contrl[i];
                            MasterCommon.SetControlValue(Ctr, DataTab.Rows[0][Convert.ToInt32(f4_temp.iCol[i]) - 1]);
                        }
                    }
                }
            }
            else if (F4 is F4COMR)
            {
                F4COMR f4_temp = (F4COMR)F4;
                if (f4_temp.Get_Witch() == "MS" || f4_temp.Get_Witch() == "CUS")
                {
                    if (!string.IsNullOrEmpty(f4_temp.CusSql))
                    {
                        sQuery = f4_temp.CusSql;
                        sWhere = "";
                    }
                    else if (!string.IsNullOrEmpty(f4_temp.PrcoCode))
                    {
                        string callSql = "{call " + f4_temp.PrcoCode + "(";
                        string Par     = "";
                        for (int i = 0; i < f4_temp.Contrl.Count; i++)
                        {
                            if (f4_temp.CtlAttr[i].ToString().ToUpper().Contains("R"))
                            {
                                Par += "'" + MasterCommon.GetControlValue(f4_temp.Contrl[i]).ToString().Replace("'", "''") + "',";
                            }
                        }
                        if (Par.Length > 0)
                        {
                            Par = Par.Substring(0, Par.Length - 1);
                        }
                        callSql = callSql + Par + ")}";

                        sQuery = callSql;
                        sWhere = "";
                    }
                    else
                    {
                        string sQuery_temp   = " ";
                        string sWhere_after  = "";
                        string sWhere_before = "";
                        string sOrder_Temp   = " ";
                        if (f4_temp.KeyName.Trim().Length > 0 && f4_temp.Key.Trim().Length > 0)
                        {
                            sWhere_before = "where " + f4_temp.KeyName.Trim() + "='" + f4_temp.Key.Trim() + "' and ";
                        }
                        else
                        {
                            sWhere_before = "where ";
                        }
                        sQuery = " SELECT ";

                        //拼Where 后面的限制条件 和 Select 后的字段
                        for (int i = 0; i < f4_temp.Contrl.Count; i++)
                        {
                            if (!string.IsNullOrEmpty(Convert.ToString(f4_temp.BackName[i])))
                            {
                                if (f4_temp.CtlAttr[i].ToString().ToUpper().Contains("R") && !f4_temp.CtlAttr[i].ToString().ToUpper().Contains("P"))
                                {
                                    sWhere_after += "and    nvl(" + f4_temp.BackName[i].ToString().Trim() + ",'')        LIKE '%" + MasterCommon.GetControlValue(f4_temp.Contrl[i]).ToString().Trim().Replace("'", "''") + "%' ";
                                }
                                else if (f4_temp.CtlAttr[i].ToString().ToUpper().Contains("P"))
                                {
                                    sWhere_after += "and    " + f4_temp.BackName[i].ToString().Trim() + "       LIKE '%" + MasterCommon.GetControlValue(f4_temp.Contrl[i]).ToString().Trim().Replace("'", "''") + "%' ";
                                    sOrder_Temp  += " " + f4_temp.BackName[i].ToString().Trim() + " Asc ,";
                                }

                                if (string.IsNullOrEmpty(Convert.ToString(f4_temp.ColName[i])))
                                {
                                    sQuery_temp += " " + f4_temp.BackName[i] + " \" " + f4_temp.BackName[i] + " \",";
                                }
                                sQuery_temp += " " + f4_temp.BackName[i] + " \" " + f4_temp.ColName[i] + " \",";
                            }
                        }

                        sQuery += sQuery_temp.Substring(0, sQuery_temp.Length - 1) + "    FROM " + f4_temp.BackTableName + " ";
                        sQuery += sWhere_before;

                        sWhere_after += "    ";

                        //  if (!sWhere_before.Contains("="))
                        {
                            sWhere_after = sWhere_after.Substring(4);
                        }

                        sWhere += sWhere_after + " ";

                        sWhere += "   " + f4_temp.Join;
                        if (!string.IsNullOrEmpty(f4_temp.OrderBy))
                        {
                            sWhere += "  " + f4_temp.OrderBy;
                        }
                        else
                        {
                            sWhere += " order by " + sOrder_Temp.Substring(0, sOrder_Temp.Length - 1);
                        }
                    }
                }

                System.Data.DataTable DataTab = GeneralCommon.Gf_ExecProc2Ref(sQuery + sWhere);

                if (DataTab.Rows.Count == 1)
                {
                    int    i      = 0;
                    string CtlAtt = "";
                    for (i = 0; i < f4_temp.Contrl.Count; i++)
                    {
                        CtlAtt = f4_temp.CtlAttr[i].ToString().ToUpper();
                        if (CtlAtt.Contains("I"))
                        {
                            Control Ctr = (Control)f4_temp.Contrl[i];
                            MasterCommon.SetControlValue(Ctr, DataTab.Rows[0][Convert.ToInt32(f4_temp.iCol[i]) - 1]);
                        }
                    }
                }
            }
            else
            {
                throw new System.Exception("Gp_DD_Collection没有找到控件" + F4.Name);
            }
        }