示例#1
0
        //***************penglei***************//
        //return :0:普通行,1:Input行,2:Update行,3:Delete行
        public static int GF_RowType(FlexGrid_User fg, int iRow)
        {
            try
            {
                switch (fg.Rows[iRow].Caption)
                {
                case "插入":
                    return(1);   // return RowType.Input;

                case "修改":
                    return(2);   //return RowType.Update;

                case "删除":
                    return(3);   //return RowType.Delete;

                default:
                    return(4);   //return RowType.Normal;
                }
            }
            catch// (OverflowException ex)
            {
                //Throw New Exception("GF_RowType error:" & ex.Message)
                return(4); // RowType.Normal;
            }
        }
示例#2
0
 public static string FG_ColName(FlexGrid_User oFlexGrid, int ColIndex)
 {
     try
     {
         return(oFlexGrid.Cols[ColIndex].Caption);
     }
     catch (OverflowException ex)
     {
         MessageBox.Show(ex.ToString());
         return(null);
     }
 }
示例#3
0
        private void DataDic_Activated(object sender, EventArgs e)
        {
            if (ssWhere.Cols.Count < 2)
            {
                this.Close();
                return;
            }
            ssWhere_setting();
            ssResult_setting();

            if (GeneralCommon.DD_New.sWitch == "CUS" || GeneralCommon.DD_New.sWitch == "MS")
            {
                if (GeneralCommon.DD_New.DicRefType == "C")
                {
                    for (int i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++)
                    {
                        if (GeneralCommon.DD_New.sCtlAttr[i].ToString().Contains("R") || GeneralCommon.DD_New.sCtlAttr[i].ToString().Contains("P"))
                        {
                            ssWhere[1, Convert.ToInt32(GeneralCommon.DD_New.siCol[i])] = MasterCommon.GetControlValue(GeneralCommon.DD_New.sContrl[i]);
                        }
                    }
                }
            }
            else if (GeneralCommon.DD_New.sWitch == "SP")
            {//待检查
                FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD_New.sPname;
                if (GeneralCommon.DD_New.DicRefType == "C")
                {
                    for (int i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++)
                    {
                        if (GeneralCommon.DD_New.sCtlAttr[i].ToString().Contains("R") || GeneralCommon.DD_New.sCtlAttr[i].ToString().Contains("P"))
                        {
                            ssWhere[1, Convert.ToInt32(GeneralCommon.DD_New.siCol[i])] = SpreadCommon.GetCellValue((FlexGrid_User)GeneralCommon.DD_New.sPname, ((FlexGrid_User)GeneralCommon.DD_New.sPname).RowSel, ((C1.Win.C1FlexGrid.Column)GeneralCommon.DD_New.sContrl[i]).Index).ToString().Trim();
                        }
                    }
                }
                // ssWhere[1,1] = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(GeneralCommon.rControl[0].ToString())].ToString();
            }
            ssWhere.Select(1, 1);

            this.BackColor = GeneralCommon.VbFormBKColor;
        }
示例#4
0
        private void ssResult2Ctl()
        {
            if (ssResult.Rows.Count > 1)
            {
                if (GeneralCommon.DD_New.sWitch == "MS" || GeneralCommon.DD_New.sWitch == "CUS")
                {
                    /* 控件F4涉及到两个信息 CD/CD_NAME两个信息分别填写在TextBox的两个部分. */

                    /* rControl[1] 保存CD, rControl[2] 保存CD_NAME.
                     * */
                    int    i      = 0;
                    string CtlAtt = "";
                    for (i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++)
                    {
                        CtlAtt = GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper();
                        if (CtlAtt.Contains("I"))
                        {
                            Control Ctr = (Control)GeneralCommon.DD_New.sContrl[i];
                            MasterCommon.SetControlValue(Ctr, ssResult[ssResult.RowSel, Convert.ToInt32(GeneralCommon.DD_New.siCol[i])].ToString());
                        }
                    }
                }
                else
                {
                    FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD_New.sPname;
                    /* 只将代码赋值给原来的F4列上. */
                    //  oFlexGrid[oFlexGrid.RowSel, oFlexGrid.ColSel] = ssResult[ssResult.RowSel, 1].ToString();
                    int    i      = 0;
                    string CtlAtt = "";
                    for (i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++)
                    {
                        CtlAtt = GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper();
                        if (CtlAtt.Contains("I"))
                        {
                            // Control Ctr = (Control)GeneralCommon.DD_New.sContrl[i];
                            SpreadCommon.SetCellValue(oFlexGrid, oFlexGrid.RowSel, ((C1.Win.C1FlexGrid.Column)GeneralCommon.DD_New.sContrl[i]).Index, ssResult[ssResult.RowSel, Convert.ToInt32(GeneralCommon.DD_New.siCol[i])].ToString());
                        }
                    }
                }
            }
        }
示例#5
0
        public static C1.Win.C1FlexGrid.Column FG_ColObjectFind(FlexGrid_User oFlexGrid, string sColName)
        {
            try
            {
                foreach (C1.Win.C1FlexGrid.Column col in oFlexGrid.Cols)
                {
                    if (sColName == col.Caption)
                    {
                        return(col);
                    }
                }

                GeneralCommon.Gp_MsgBoxDisplay("未找到指定列名!");
                return(null);
            }
            catch (OverflowException ex)
            {
                MessageBox.Show(ex.ToString());
                return(null);
            }
        }
示例#6
0
文件: DataDic.cs 项目: dmgfhc/NGHB
        private void cmd_selection_Click(object sender, EventArgs e)
        {
            // int iColCount = 0;

            if (ssResult.Rows.Count >= 1)
            {
                if (GeneralCommon.DD.sWitch == "MS")
                {
                    /* 控件F4涉及到两个信息 CD/CD_NAME两个信息分别填写在TextBox的两个部分. */
                    /* rControl[1] 保存CD, rControl[2] 保存CD_NAME.                        */
                    ((System.Windows.Forms.TextBox)(GeneralCommon.rControl[0])).Text = ssResult[ssResult.RowSel, 1].ToString();
                    ((System.Windows.Forms.TextBox)(GeneralCommon.rControl[1])).Text = ssResult[ssResult.RowSel, 2].ToString();
                }
                else
                {
                    FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD.sPname;
                    /* 只将代码赋值给原来的F4列上. */
                    oFlexGrid[oFlexGrid.RowSel, oFlexGrid.ColSel] = ssResult[ssResult.RowSel, 1].ToString();
                }
            }
            this.Close();
        }
示例#7
0
 public static string GF_CellFind(FlexGrid_User oFlexGrid, string iColName)
 {
     try
     {
         if (oFlexGrid.Rows.Count > 0 && oFlexGrid.RowSel < 1)
         {
             oFlexGrid.RowSel = 0;
         }
         int icol = FG_ColIndexFind(oFlexGrid, iColName);
         if (icol > 0)
         {
             return(oFlexGrid.Rows[oFlexGrid.RowSel][icol].ToString());
         }
         else
         {
             return(string.Empty);
         }
     }
     catch (OverflowException ex)
     {
         MessageBox.Show(ex.ToString());
         return("");
     }
 }
示例#8
0
文件: DataDic.cs 项目: dmgfhc/NGHB
        private void DataDic_Activated(object sender, EventArgs e)
        {
            int          iColCount    = 0;
            SpreadCommon SpreadCommon = new SpreadCommon();

            ssWhere_setting();
            ssResult_setting();

            if (GeneralCommon.DD.DataDicType == "ETC")
            {
                // Control F4 Call
                if (GeneralCommon.DD.sWitch == "MS")
                {
                    for (iColCount = 0; iColCount < GeneralCommon.rControl.Count; iColCount++)
                    {
                        ssWhere[0, iColCount] = GeneralCommon.rControl[iColCount].ToString();
                    }
                }
                //SpreadSheet F4 Call
                else
                {
                    FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD.sPname;

                    for (iColCount = 0; iColCount < GeneralCommon.rControl.Count; iColCount++)
                    {
                        ssWhere[0, 0] = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(GeneralCommon.rControl[iColCount].ToString())].ToString();
                    }
                }
            }

            else
            {
                if (GeneralCommon.DD.sWitch == "MS")
                {
                    ssWhere[1, 1] = ((System.Windows.Forms.TextBox)(GeneralCommon.rControl[0])).Text;
                }
                else
                {
                    FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD.sPname;
                    ssWhere[1, 1] = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(GeneralCommon.rControl[0].ToString())].ToString();
                }

                switch (GeneralCommon.DD.DataDicType)
                {
                case "M":
                    //Common Code
                    switch (GeneralCommon.DD.nameType)
                    {
                    case "1":
                        ssWhere.ColSel = 1;
                        break;

                    case "2":
                        ssWhere.ColSel = 2;
                        break;

                    case "3":
                        ssWhere.ColSel = 3;
                        break;

                    case "4":
                        ssWhere.ColSel = 4;
                        break;
                    }
                    break;

                case "A":
                    ssWhere.ColSel = 1;
                    break;

                case "EMP":
                    ssWhere.ColSel = 1;
                    break;

                case "PGM":
                    ssWhere.ColSel = 1;
                    break;

                case "CUST":
                    ssWhere.ColSel = 1;
                    break;

                case "MAT":
                    ssWhere.ColSel = 1;
                    break;
                }

                if (GeneralCommon.DD.sWitch == "MS")
                {
                    if (GeneralCommon.rControl.Count > 0)
                    {
                        ssWhere[1, 2] = ((System.Windows.Forms.TextBox)(GeneralCommon.rControl[1])).Text;
                    }
                }
                else
                {
                    FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD.sPname;

                    if (GeneralCommon.rControl.Count > 0)
                    {
                        ssWhere[1, 2] = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(GeneralCommon.rControl[0].ToString())].ToString();
                    }
                }
            }

            this.BackColor = GeneralCommon.VbFormBKColor;
        }
示例#9
0
 public static void Gp_Sp_SendData(FlexGrid_User oFlexGrid, string Indata, int iRow, int iCol)
 {
     oFlexGrid.Rows[iRow][iCol] = Indata;
 }
示例#10
0
 public static void Gp_Sp_SendData(FlexGrid_User oFlexGrid, string Indata, int iRow, string iColName)
 {
     Gp_Sp_SendData(oFlexGrid, Indata, iRow, FG_ColIndexFind(oFlexGrid, iColName));
 }
示例#11
0
        //---------------------------------------------------------------------------------------
        //  1.ID           : Gf_DD_Display
        //  2.Input  Value : Conn Connection, sQuery String, [MsgChk Boolean]
        //  3.Return Value : Boolean
        //  4.Create Date  :
        //  5.Modify Date  :
        //  6.Comment      : Data Dictionary Result Data Display
        //---------------------------------------------------------------------------------------
        public static bool Gf_Common_DD(Keys KeyCode)
        {
            SpreadCommon SpreadCommon = new SpreadCommon();
            string       sOld_Code    = "";
            string       sNew_Code    = "";
            // string sOld_Name = "";
            string sNew_Name = "";

            /* 如果退出F4窗口. */
            if (KeyCode == Keys.Return || KeyCode == Keys.Escape || GeneralCommon.GF_DbConnect() == false)
            {
                GeneralCommon.Gp_DD_New_Clear();
                return(false);
            }

            GeneralCommon.DD_New.DicRefType = "C";      //Active Form DataDic Call

            try
            {
                if (GeneralCommon.DD_New.sWitch == "MS" || GeneralCommon.DD_New.sWitch == "CUS")
                {
                    if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sCusCode))
                    {
                        GeneralCommon.DD_New.sQuery = GeneralCommon.DD_New.sCusCode;
                        GeneralCommon.DD_New.sWhere = "";
                    }
                    else if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sPrcoCode))
                    {
                        string callSql = "{call " + GeneralCommon.DD_New.sPrcoCode + "(";
                        string Par     = "";
                        for (int i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++)
                        {
                            if (GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper().Contains("R"))
                            {
                                Par += "'" + MasterCommon.GetControlValue(GeneralCommon.DD_New.sContrl[i]).ToString().Replace("'", "''") + "',";
                            }
                        }
                        if (Par.Length > 0)
                        {
                            Par = Par.Substring(0, Par.Length - 1);
                        }
                        callSql = callSql + Par + ")}";

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

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

                                if (string.IsNullOrEmpty(Convert.ToString(GeneralCommon.DD_New.sColName[i])))
                                {
                                    sQuery_temp += " " + GeneralCommon.DD_New.sBackName[i] + " \" " + GeneralCommon.DD_New.sBackName[i] + " \",";
                                }
                                sQuery_temp += " " + GeneralCommon.DD_New.sBackName[i] + " \" " + GeneralCommon.DD_New.sColName[i] + " \",";
                            }
                        }

                        GeneralCommon.DD_New.sQuery += sQuery_temp.Substring(0, sQuery_temp.Length - 1) + "    FROM " + GeneralCommon.DD_New.sBackTableName + " ";
                        GeneralCommon.DD_New.sQuery += sWhere_before;

                        sWhere_after += "    ";

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

                        GeneralCommon.DD_New.sWhere += sWhere_after + " ";

                        GeneralCommon.DD_New.sWhere += "   " + GeneralCommon.DD_New.sJoin;
                        if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sOrderBy))
                        {
                            GeneralCommon.DD_New.sWhere += "  " + GeneralCommon.DD_New.sOrderBy;
                        }
                        else
                        {
                            GeneralCommon.DD_New.sWhere += " order by " + sOrder_Temp.Substring(0, sOrder_Temp.Length - 1);
                        }
                    }
                }
                else
                {//带检查
                    if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sCusCode))
                    {
                        GeneralCommon.DD_New.sQuery = GeneralCommon.DD_New.sCusCode;
                        GeneralCommon.DD_New.sWhere = "";
                    }
                    else if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sPrcoCode))
                    {
                        string callSql = "{call " + GeneralCommon.DD_New.sPrcoCode + "(";
                        string Par     = "";
                        for (int i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++)
                        {
                            if (GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper().Contains("R"))
                            {
                                Par += "'" + SpreadCommon.GetColValue((C1.Win.C1FlexGrid.Column)GeneralCommon.DD_New.sContrl[i]).ToString().Replace("'", "''") + "',";
                            }
                        }
                        if (Par.Length > 0)
                        {
                            Par = Par.Substring(0, Par.Length - 1);
                        }
                        callSql = callSql + Par + ")}";

                        GeneralCommon.DD_New.sQuery = callSql;
                        GeneralCommon.DD_New.sWhere = "";
                    }
                    else
                    {
                        string sQuery_temp   = " ";
                        string sWhere_after  = "";
                        string sWhere_before = "";
                        string sOrder_Temp   = " ";
                        if (GeneralCommon.DD_New.sKeyName.Trim().Length > 0 && GeneralCommon.DD_New.sKey.Trim().Length > 0)
                        {
                            sWhere_before = "where " + GeneralCommon.DD_New.sKeyName.Trim() + "='" + GeneralCommon.DD_New.sKey.Trim() + "' ";
                        }
                        else
                        {
                            sWhere_before = "where ";
                        }
                        GeneralCommon.DD_New.sQuery = " SELECT ";

                        //拼Where 后面的限制条件 和 Select 后的字段
                        for (int i = 0; i < GeneralCommon.DD_New.sContrl.Count; i++)
                        {
                            if (!string.IsNullOrEmpty(Convert.ToString(GeneralCommon.DD_New.sBackName[i])))
                            {
                                if (GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper().Contains("R") && !GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper().Contains("P"))
                                {
                                    sWhere_after += "and    nvl(" + GeneralCommon.DD_New.sBackName[i].ToString().Trim() + ",'%')        LIKE '%" + SpreadCommon.GetCellValue((FlexGrid_User)GeneralCommon.DD_New.sPname, ((FlexGrid_User)GeneralCommon.DD_New.sPname).RowSel, ((C1.Win.C1FlexGrid.Column)GeneralCommon.DD_New.sContrl[i]).Index).ToString().Trim().Replace("'", "''") + "%' ";
                                }
                                else if (GeneralCommon.DD_New.sCtlAttr[i].ToString().ToUpper().Contains("P"))
                                {
                                    sWhere_after += "and    " + GeneralCommon.DD_New.sBackName[i].ToString().Trim() + "       LIKE '%" + SpreadCommon.GetCellValue((FlexGrid_User)GeneralCommon.DD_New.sPname, ((FlexGrid_User)GeneralCommon.DD_New.sPname).RowSel, ((C1.Win.C1FlexGrid.Column)GeneralCommon.DD_New.sContrl[i]).Index).ToString().Trim().Replace("'", "''") + "%' ";
                                    sOrder_Temp  += " " + GeneralCommon.DD_New.sBackName[i].ToString().Trim() + " Asc ,";
                                }

                                if (string.IsNullOrEmpty(Convert.ToString(GeneralCommon.DD_New.sColName[i])))
                                {
                                    sQuery_temp += " " + GeneralCommon.DD_New.sBackName[i] + " \" " + GeneralCommon.DD_New.sBackName[i] + " \",";
                                }
                                sQuery_temp += " " + GeneralCommon.DD_New.sBackName[i] + " \" " + GeneralCommon.DD_New.sColName[i] + " \",";
                            }
                        }

                        GeneralCommon.DD_New.sQuery += sQuery_temp.Substring(0, sQuery_temp.Length - 1) + "    FROM " + GeneralCommon.DD_New.sBackTableName + " ";
                        GeneralCommon.DD_New.sQuery += sWhere_before;

                        sWhere_after += "    ";

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

                        GeneralCommon.DD_New.sWhere += sWhere_after + " ";

                        GeneralCommon.DD_New.sWhere += "   " + GeneralCommon.DD_New.sJoin;
                        if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sOrderBy))
                        {
                            GeneralCommon.DD_New.sWhere += "  " + GeneralCommon.DD_New.sOrderBy;
                        }
                        else
                        {
                            GeneralCommon.DD_New.sWhere += " order by " + sOrder_Temp.Substring(0, sOrder_Temp.Length - 1);
                        }
                    }

                    //FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD_New.sPname;

                    ///* 取出当前单元格编辑的内容. */
                    //sOld_Code = "";//oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(GeneralCommon.rControl[0])].ToString();

                    //GeneralCommon.DD_New.sQuery = "            SELECT CD \"代码\", CD_SHORT_NAME \"代码简称\",    CD_NAME \"代码名称\", ";
                    //GeneralCommon.DD_New.sQuery += "                               CD_SHORT_ENG \"代码英文简称\", CD_FULL_ENG \"代码英文名称\" FROM TZ_CD ";
                    //GeneralCommon.DD_New.sQuery += "            WHERE CD_MANA_NO =    '" + GeneralCommon.DD.sKey.Trim() + "' ";
                    //GeneralCommon.DD_New.sWhere += "              and  CD         LIKE '" + sOld_Code.Trim() + "%' ";

                    ///* 判断当前传入查询参数的个数. */
                    //if (GeneralCommon.rControl.Count > 0)
                    //{
                    //    //sOld_Code = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(((System.Windows.Forms.TextBox)(GeneralCommon.rControl[2])).Text)].ToString();
                    //    sOld_Code = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(GeneralCommon.rControl[0])].ToString();


                    //    //}
                    //    GeneralCommon.DD_New.sWhere += "  and NVL(CD_NAME,'%')       LIKE '" + sOld_Name.Trim() + "%' ";
                    //    GeneralCommon.DD_New.sWhere += " AND CD !=  ' ' ";
                    //    GeneralCommon.DD_New.sWhere += " AND APLY_STD = '1' ";

                    //    if (!string.IsNullOrEmpty(GeneralCommon.DD_New.sJoin))
                    //    {
                    //        GeneralCommon.DD_New.sWhere += " and " + GeneralCommon.DD_New.sJoin + "Order by CD";
                    //    }
                    //}
                }

                if (Gf_DD_Display(GeneralCommon.DD_New.sQuery + GeneralCommon.DD_New.sWhere, false))
                {
                    /* F4 窗口退出处理程序 [FlexGrid中的F4功能] */
                    if (GeneralCommon.DD_New.sWitch == "SP")
                    {
                        /* 如果当前为 Spread F4 控件. */
                        FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD_New.sPname;
                        sNew_Code = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32((GeneralCommon.rControl[0]))].ToString();

                        if (GeneralCommon.rControl.Count > 0)
                        {
                            sNew_Name = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32((GeneralCommon.rControl[0]))].ToString();
                        }

                        switch (oFlexGrid.Rows[oFlexGrid.RowSel].Caption)
                        {
                        case "插入":
                            break;

                        case "删除":
                            break;

                        case "修改":
                            break;

                        default:
                        {
                            //ss.ActiveSheet.RowHeader.Cells[ss.ActiveSheet.ActiveRowIndex, 0].Text = "Update";
                            oFlexGrid.Rows[oFlexGrid.RowSel].Caption = "修改";
                            break;
                        }
                        }

                        if (GeneralCommon.DD_New.sSelect)
                        {
                            if (sOld_Code != sNew_Code)
                            {
                                SpreadCommon.Gp_Sp_UpdateMark(oFlexGrid, true);
                            }
                        }
                    }
                }

                GeneralCommon.Gp_DD_New_Clear();

                return(true);
            }
            catch (Exception ex)
            {
                GeneralCommon.Gp_DD_Clear();
                GeneralCommon.Gp_MsgBoxDisplay("DataDic 查询出错啦...!!!" + ex.Message, "I");
                return(false);
            }
        }
示例#12
0
        public static bool Gf_Common_DD(System.Data.OleDb.OleDbConnection Conn, Keys KeyCode)
        {
            SpreadCommon SpreadCommon = new SpreadCommon();
            //  int iCollCnt;
            string sOld_Code = "";
            string sNew_Code = "";
            string sOld_Name = string.Empty, sNew_Name = string.Empty;


            /* 如果退出F4窗口. */
            if (GeneralCommon.GF_DbConnect() == false || KeyCode == Keys.Return || KeyCode == Keys.Escape)
            {
                GeneralCommon.Gp_DD_Clear();
                //  int rCount = GeneralCommon.rControl.Count;
                GeneralCommon.rControl.RemoveRange(0, GeneralCommon.rControl.Count);


                GeneralCommon.DD.sPname = null;


                return(false);
            }

            if (GeneralCommon.rControl.Count == 0 || GeneralCommon.DD.nameType == "")
            {
                GeneralCommon.Gp_MsgBoxDisplay("DataDic 参数有错误...!!!", "I");
                GeneralCommon.Gp_DD_Clear();
                // int rCount = GeneralCommon.rControl.Count;
                GeneralCommon.rControl.RemoveRange(0, GeneralCommon.rControl.Count);
                //for (iCollCnt = 1; iCollCnt <= rCount; iCollCnt++)
                //{
                //    GeneralCommon.rControl.Remove(1);
                //}

                GeneralCommon.DD.sPname = null;


                return(false);
            }

            GeneralCommon.DD.DataDicType = "M";     //Common Code
            GeneralCommon.DD.DicRefType  = "C";     //Active Form DataDic Call

            try
            {
                if (GeneralCommon.DD.sWitch == "MS" || GeneralCommon.DD.sWitch == "CUS")
                {
                    if (!string.IsNullOrEmpty(GeneralCommon.DD.sCusCode))
                    {
                        GeneralCommon.DD.sQuery = GeneralCommon.DD.sCusCode;
                        GeneralCommon.DD.sWhere = "";
                    }
                    else if (!string.IsNullOrEmpty(GeneralCommon.DD.sPrcoCode))
                    {
                        string callSql = "{call " + GeneralCommon.DD.sPrcoCode + "(";// +iType + "',";
                        string Par     = "";
                        for (int i = 0; i < GeneralCommon.DD.sParameters.Count; i++)
                        {
                            Par += "'" + GeneralCommon.DD.sParameters[i].ToString().Replace("'", "''") + "',";
                        }
                        if (Par.Length > 0)
                        {
                            Par = Par.Substring(0, Par.Length - 1);
                        }
                        callSql = callSql + Par + ")}";

                        GeneralCommon.DD.sQuery = callSql;
                        GeneralCommon.DD.sWhere = "";
                    }
                    else
                    {
                        GeneralCommon.DD.sQuery = "            SELECT CD \"代码\"  ";
                        switch (GeneralCommon.DD.nameType)
                        {
                        case "1":
                        { GeneralCommon.DD.sQuery += "  ,CD_SHORT_NAME \"代码简称\""; break; }

                        case "2":
                        { GeneralCommon.DD.sQuery += "  ,  CD_NAME \"代码名称\""; break; }

                        case "3":
                        { GeneralCommon.DD.sQuery += " ,CD_SHORT_ENG \"代码英文简称\""; break; }

                        case "4":
                        { GeneralCommon.DD.sQuery += "  ,  CD_FULL_ENG \"代码英文名称\""; break; }
                        }
                        //  GeneralCommon.DD.sQuery = "            SELECT CD \"代码\"  ";//CD_SHORT_NAME \"代码简称\",     CD_NAME \"代码名称\", ";
                        GeneralCommon.DD.sQuery += "    FROM TZ_CD ";
                        GeneralCommon.DD.sQuery += "            WHERE CD_MANA_NO =   '" + GeneralCommon.DD.sKey.Trim() + "' ";
                        /* 选择查询条件, 公共代码. */
                        GeneralCommon.DD.sWhere += "              and CD         LIKE '" + ((System.Windows.Forms.TextBox)(GeneralCommon.rControl[0])).Text.Trim() + "%' ";

                        if (GeneralCommon.rControl.Count > 0)
                        {
                            /* 选择查询的内容 CD_NAME显示的内容. */
                            switch (GeneralCommon.DD.nameType)
                            {
                            case "1":
                            { GeneralCommon.DD.sWhere += "  and NVL(CD_SHORT_NAME,'%') LIKE '%" + ((System.Windows.Forms.TextBox)(GeneralCommon.rControl[1])).Text + "%'"; break; }

                            case "2":
                            { GeneralCommon.DD.sWhere += "  and NVL(CD_NAME,'%')       LIKE '%" + ((System.Windows.Forms.TextBox)(GeneralCommon.rControl[1])).Text + "%'"; break; }

                            case "3":
                            { GeneralCommon.DD.sWhere += "  and NVL(CD_SHORT_ENG,'%')  LIKE '%" + ((System.Windows.Forms.TextBox)(GeneralCommon.rControl[1])).Text + "%'"; break; }

                            case "4":
                            { GeneralCommon.DD.sWhere += "  and NVL(CD_FULL_ENG,'%')   LIKE '%" + ((System.Windows.Forms.TextBox)(GeneralCommon.rControl[1])).Text + "%'"; break; }
                            }
                        }

                        GeneralCommon.DD.sWhere += " and CD        <>  ' ' ";
                        GeneralCommon.DD.sWhere += " and APLY_STD  =   '1' ";

                        if (!string.IsNullOrEmpty(GeneralCommon.DD.sJoin))
                        {
                            GeneralCommon.DD.sWhere += " and " + GeneralCommon.DD.sJoin + "Order by CD";
                        }
                    }
                }
                else
                {
                    FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD.sPname;

                    /* 取出当前单元格编辑的内容. */
                    sOld_Code = "";//oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(GeneralCommon.rControl[0])].ToString();

                    GeneralCommon.DD.sQuery  = "            SELECT CD \"代码\", CD_SHORT_NAME \"代码简称\",    CD_NAME \"代码名称\", ";
                    GeneralCommon.DD.sQuery += "                               CD_SHORT_ENG \"代码英文简称\", CD_FULL_ENG \"代码英文名称\" FROM TZ_CD ";
                    GeneralCommon.DD.sQuery += "            WHERE CD_MANA_NO =    '" + GeneralCommon.DD.sKey.Trim() + "' ";
                    GeneralCommon.DD.sWhere += "              and  CD         LIKE '" + sOld_Code.Trim() + "%' ";

                    /* 判断当前传入查询参数的个数. */
                    if (GeneralCommon.rControl.Count > 0)
                    {
                        //sOld_Code = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(((System.Windows.Forms.TextBox)(GeneralCommon.rControl[2])).Text)].ToString();
                        sOld_Code = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32(GeneralCommon.rControl[0])].ToString();

                        switch (GeneralCommon.DD.nameType)
                        {
                        case "1":
                        {
                            GeneralCommon.DD.sWhere += "  and NVL(CD_SHORT_NAME,'%') LIKE '" + sOld_Name.Trim() + "%' ";
                            break;
                        }

                        case "2":
                        {
                            GeneralCommon.DD.sWhere += "  and NVL(CD_NAME,'%')       LIKE '" + sOld_Name.Trim() + "%' ";
                            break;
                        }

                        case "3":
                        {
                            GeneralCommon.DD.sWhere += "  and NVL(CD_SHORT_ENG,'%')  LIKE '" + sOld_Name.Trim() + "%' ";
                            break;
                        }

                        case "4":
                        {
                            GeneralCommon.DD.sWhere += "  and NVL(CD_FULL_ENG,'%')   LIKE '" + sOld_Name.Trim() + "%' ";
                            break;
                        }

                        /* 如果没有当前的附加条件. */
                        default:
                            break;
                        }

                        GeneralCommon.DD.sWhere += " AND CD !=  ' ' ";
                        GeneralCommon.DD.sWhere += " AND APLY_STD = '1' ";

                        if (!string.IsNullOrEmpty(GeneralCommon.DD.sJoin))
                        {
                            GeneralCommon.DD.sWhere += " and " + GeneralCommon.DD.sJoin + "Order by CD";
                        }
                    }
                }

                //Join
                //if (GeneralCommon.DD.sJoin != "")
                //{
                //    if (GeneralCommon.DD.sJoin != null)
                //    {

                //    }
                //}

                if (Gf_DD_Display(Conn, GeneralCommon.DD.sQuery + GeneralCommon.DD.sWhere, false))
                {
                    /* F4 窗口退出处理程序 [FlexGrid中的F4功能] */
                    if (GeneralCommon.DD.sWitch == "SP")
                    {
                        /* 如果当前为 Spread F4 控件. */
                        FlexGrid_User oFlexGrid = (FlexGrid_User)GeneralCommon.DD.sPname;
                        sNew_Code = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32((GeneralCommon.rControl[0]))].ToString();

                        if (GeneralCommon.rControl.Count > 0)
                        {
                            sNew_Name = oFlexGrid[oFlexGrid.RowSel, Convert.ToInt32((GeneralCommon.rControl[0]))].ToString();
                        }

                        switch (oFlexGrid.Rows[oFlexGrid.RowSel].Caption)
                        {
                        case "插入":
                            break;

                        case "删除":
                            break;

                        case "修改":
                            break;

                        default:
                        {
                            //ss.ActiveSheet.RowHeader.Cells[ss.ActiveSheet.ActiveRowIndex, 0].Text = "Update";
                            oFlexGrid.Rows[oFlexGrid.RowSel].Caption = "修改";
                            break;
                        }
                        }

                        if (GeneralCommon.DD.sSelect)
                        {
                            if (sOld_Code != sNew_Code)
                            {
                                SpreadCommon.Gp_Sp_UpdateMark(oFlexGrid, true);
                            }
                        }
                    }
                }

                #region /* 清空变量. */
                GeneralCommon.Gp_DD_Clear();
                // int rCount = GeneralCommon.rControl.Count;
                GeneralCommon.rControl.RemoveRange(0, GeneralCommon.rControl.Count);
                //for (iCollCnt = 1; iCollCnt <= rCount; iCollCnt++)
                //{
                //    GeneralCommon.rControl.Remove(1);
                //}

                GeneralCommon.DD.sPname = null;

                // GeneralCommon.DD.sWitch = "";
                // GeneralCommon.DD.sSelect = false;
                // GeneralCommon.DD.sPname = "";
                // GeneralCommon.DD.sWhere = "";
                #endregion

                //// int rCount1 = GeneralCommon.rControl.Count;
                // GeneralCommon.rControl.RemoveRange(0, GeneralCommon.rControl.Count);

                return(true);
            }
            catch (Exception ex)
            {
                GeneralCommon.Gp_DD_Clear();
                // int rCount = GeneralCommon.rControl.Count;
                GeneralCommon.rControl.RemoveRange(0, GeneralCommon.rControl.Count);
                //for (iCollCnt = 1; iCollCnt <= rCount; iCollCnt++)
                //{
                //    GeneralCommon.rControl.Remove(1);
                //}

                GeneralCommon.DD.sPname = null;

                //   GeneralCommon.rControl.RemoveRange(0, GeneralCommon.rControl.Count);
                //MessageBox.Show(ex.ToString());
                GeneralCommon.Gp_MsgBoxDisplay("DataDic 查询出错啦...!!!" + ex.Message, "I");
                return(false);
            }
        }