Beispiel #1
0
        /// <summary>
        /// 读取要显示的公告信息
        /// </summary>
        private void log_display()
        {
            try
            {
                fg1.Cols.Fixed = 0;
                DataSet ds = new CommonClass.ProcQuery("LOG_FIND", new ArrayList()).CreateDataSet(false);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    fg1.DataSource = ds.Tables[0];
                }

                fg1.Cols.Fixed = 0;
            }
            catch //(System.Exception e)
            {
            }
        }
Beispiel #2
0
        /// <summary>
        /// 检查权限
        /// </summary>
        private void Chk_Authority()
        {
            ArrayList TempParamAry = new ArrayList();

            TempParamAry.Add(GeneralCommon.sUserID);
            CommonClass.ProcQuery TempProcQuery = new CommonClass.ProcQuery("PKG_MAIN.P_AUTHORITY", TempParamAry);
            DataSet ds = TempProcQuery.CreateDataSet();

            try
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0].ItemArray[0].ToString() == "0")
                    {
                        cmd_f.Enabled     = false;
                        menuItem1.Enabled = false;
                    }
                    if (ds.Tables[0].Rows[0].ItemArray[1].ToString() == "0")
                    {
                        cmd_z.Enabled     = false;
                        menuItem9.Enabled = false;
                    }
                    if (ds.Tables[0].Rows[0].ItemArray[2].ToString() == "0")
                    {
                        cmd_a.Enabled      = false;
                        menuItem11.Enabled = false;
                    }
                    if (ds.Tables[0].Rows[0].ItemArray[3].ToString() == "0")
                    {
                        cmd_d.Enabled      = false;
                        menuItem10.Enabled = false;
                    }
                }
            }
            catch (Exception ex)
            {
                GeneralCommon.Gp_MsgBoxDisplay("获取权限错误!" + ex.ToString());
                return;
            }
        }
Beispiel #3
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);
        }