コード例 #1
0
ファイル: FormMain.cs プロジェクト: ewgeny911/FBA
		void ToolStripMenuItem1Click(object sender, EventArgs e)
		{
		 	ValueParam[] arrvp = new ValueParam[2];
			//arrvp[0].type = FBA.TextBoxFBA; 
			arrvp[0].value = "Номер договора"; 	
			//arrvp[1]
			arrvp[1].value = "Серия договора"; 
			var frm = new FormValue("Введите номер и серию договора", arrvp);
			if (frm.ShowDialog() != DialogResult.OK) return ;
	        string valueText1 = frm.GetValue(0);
	        string valueText2 = frm.GetValue(1);
		}
コード例 #2
0
        /*public ValueParam(bool hh)
         * {
         *      componentType = ComponentType.TextBox;
         *  valueType = ValueType.String;
         *  value = "";
         *  captionValue = "";
         *  values = null;
         * height = 100;
         *  width = 100;
         *  scrolls = System.Windows.Forms.ScrollBars.Both;
         *  wordwrap = false;
         *  msql = "";
         *  sql = "";
         *  defaultTextGray = "";
         *  defaultTextGrayColor = Color.LightGray;
         *  readOnly = false;
         *  enabled = true;
         *      this.enabled = true;
         * }*/


        /// <summary>
        /// Скопировать один параметр в другой. Копирование по значению, а не по ссылке.
        /// </summary>
        /// <param name="vp">Параметр кода копируем значения из данного.</param>
        public void CopyTo(ValueParam vp)
        {
            vp.componentType = this.componentType;                           //ComponentType
            vp.valueType     = this.valueType;                               //ValueType
            vp.value         = this.value;                                   //string
            vp.captionValue  = this.captionValue;                            //string
            if (this.values != null)
            {
                vp.values = new string[this.values.Length];
                this.values.CopyTo(vp.values, 0);                        //string[]
            }
            vp.height               = this.height;                       //int
            vp.width                = this.width;                        //int
            vp.scrolls              = this.scrolls;                      //System.Windows.Forms.ScrollBars
            vp.wordwrap             = this.wordwrap;                     //bool
            vp.msql                 = this.msql;                         //string
            vp.sql                  = this.sql;                          //string
            vp.defaultTextGray      = this.defaultTextGray;              //string
            vp.defaultTextGrayColor = this.defaultTextGrayColor;         //Color
            vp.readOnly             = this.readOnly;                     //bool
        }
コード例 #3
0
ファイル: FormMethod.cs プロジェクト: ewgeny911/FBA
        ///Добавить метод.
        public bool MethodAddOrEdit(Operation operation, string MethodID)
        {
            string[] actionList = { "UPDATE", "INSERT", "DELETE", "SELECT" };
            string   sql        = "SELECT Brief FROM fbaEntity ";

            //sys.SelectComboBox(DirectionQuery.Remote, SQL, frm.tbText1);
            string[] entitlyList = sys.SQLToArray(DirectionQuery.Remote, sql);

            string entityBrief = dgvMethod.Value("Entity");
            string action      = dgvMethod.Value("Action");
            string methodBrief = dgvMethod.Value("Brief");
            string methodValue = dgvMethod.Value("Value");
            string comment     = dgvMethod.Value("Comment");
            string capForm     = operation.ToString() + "entity method";


            //var frm = new FormValue5(Cap,
            //                        "Entity", "Action", "Brief", "Value", "Comment",
            //                         EntityBrief, Action, MethodBrief, MethodValue, Comment,
            //                         entitlyList, action);
            //if (frm.ShowDialog() != DialogResult.OK) return false;


            var arrvp = new ValueParam[5];

            arrvp[0].captionValue  = "Entity";
            arrvp[0].componentType = ComponentType.ComboBox;
            arrvp[0].values        = entitlyList;
            arrvp[0].value         = entityBrief;

            arrvp[1].captionValue  = "Action";
            arrvp[1].componentType = ComponentType.ComboBox;
            arrvp[1].values        = actionList;
            arrvp[1].value         = action;

            arrvp[2].captionValue = "Brief";
            arrvp[2].value        = methodBrief;

            arrvp[3].captionValue = "Value";
            arrvp[3].value        = methodValue;

            arrvp[4].captionValue = "Comment";
            arrvp[4].value        = comment;

            var frm = new FormValue(capForm, arrvp);

            if (frm.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }
            entityBrief = frm.GetValue(0);
            action      = frm.GetValue(1);
            methodBrief = frm.GetValue(2);
            methodValue = frm.GetValue(3);
            comment     = frm.GetValue(4);

            //EntityBrief = frm.tbText1.Text;
            //Action      = frm.tbText2.Text;
            //MethodBrief = frm.tbText3.Text;
            //MethodValue = frm.tbText4.Text;
            //Comment     = frm.tbText5.Text;
            string EntityID = sys.GetEntityID(entityBrief);

            if (operation == Operation.Add)
            {
                sql = "INSERT INTO fbaMethod (" +
                      "UserCreateID, DateCreate, EntityRef, Action, Brief, Value, Comment) VALUES (" +
                      Var.UserID + ", " + sys.DateTimeCurrent() + "," + EntityID + ",'" + action + "', '" + methodBrief + "', '" + methodValue + "', '" + comment + "')";
                if (!sys.Exec(DirectionQuery.Remote, sql))
                {
                    return(false);
                }
                sys.SM("Метод добавлен!", MessageType.Information);
            }
            if (operation == Operation.Edit)
            {
                sql = "UPDATE fbaMethod SET " +
                      "UserCreateID = " + Var.UserID +
                      ",DateCreate  = " + sys.DateTimeCurrent() +
                      ",EntityRef   = " + EntityID +
                      ",Action      = '" + action + "'" +
                      ",Brief       = '" + methodBrief + "'" +
                      ",Value       = '" + methodValue + "'" +
                      ",Comment     = '" + comment + "'" +
                      " WHERE ID = " + MethodID;
                if (!sys.Exec(DirectionQuery.Remote, sql))
                {
                    return(false);
                }
                sys.SM("Метод изменён!", MessageType.Information);
            }
            MethodRefresh();
            return(true);
        }
コード例 #4
0
ファイル: FormMain.cs プロジェクト: ewgeny911/FBA
        private void MainMenu_N1_1_Click(object sender, EventArgs e)
        {                                                                      
            if (sender == MainMenu_N1_1) sys.ChangeUserPass();
            if (sender == MainMenu_N1_2) Environment.Exit(0);
            
            if (sender == MainMenu_N2_1) sys.ShowDirectorySimple("Договор", "FormContract", "FormContract", null, null, null, null);
            if (sender == MainMenu_N2_2) sys.ShowDirectorySimple("Face", null, null, null, null, null, null);
            if (sender == MainMenu_N2_3)
            { 
            	 
                //int FormNumberLocal = 0;
                //object[] ParamArray = null; //new object[1];
                //ParamArray[0] = 0;
                //ProjectService.FormShow("FormCallCenter", "FormCallCenter", out FormNumberLocal, ParamArray);
                
                 var arrvp = new ValueParam[5];
				 
                 //Вариант 1 установки DataSet для ComboBox. Запрос MSQL.	
                 arrvp[0].captionValue = "Выберите сущность"; 
				 arrvp[0].componentType = ComponentType.ComboBox;				
				 arrvp[0].value = "Сущности"; 				 							
				 arrvp[0].msql  = "SELECT Brief FROM fbaEntity";
				 				 
				 //Вариант 1 установки DataSet для ComboBox. Запрос MSQL.
				 arrvp[1].captionValue = "Выберите таблицу";
				 arrvp[1].componentType = ComponentType.ComboBox;					 
				 arrvp[1].value = ""; 				 				
				 arrvp[1].sql  = "SELECT Name FROM fbaTable";
				
				 
				 arrvp[2].captionValue = "Выберите атрибут";
				 arrvp[2].value = "Атрибуты";				 
				 arrvp[2].componentType = ComponentType.ComboBox;												
				 
				 arrvp[3].captionValue = "Проверка";
				 arrvp[3].value = "Атрибуты";				 
				 arrvp[3].componentType = ComponentType.CheckBox;					 
				 
				 //Это TextBox
				 arrvp[4].captionValue = "Комментарий"; 
				 arrvp[4].componentType = ComponentType.TextBox;				
				 arrvp[4].value = "";
				 arrvp[4].height = 100;
				 arrvp[4].scrolls = System.Windows.Forms.ScrollBars.Both;
				 arrvp[4].wordwrap = true;				 			
				 				 					
				 var frm = new FormValue("Введите номер и серию договора", arrvp);				 
				 //Все созданые ComboBox и TextBox доступны через массивы comboBoxArray и textBoxArray.
				 frm.comboBoxArray[2].SetDataSourceMSQL("SELECT Name FROM fbaAttribute");
				 				 
				 if (frm.ShowDialog() != DialogResult.OK) return;
		         string valueText1 = frm.GetValue(0);
		         string valueText2 = frm.GetValue(1);
		         string valueText3 = frm.GetValue(2);
		         string valueText4 = frm.GetValue(3);
		         sys.SM("valueText1=" + valueText1 + Var.CR + 
		                "valueText2=" + valueText2 + Var.CR + 
		                "valueText3=" + valueText3 + Var.CR + 
		                "valueText4=" + valueText4 + Var.CR
		               );
                
            }

            //Report XLSX Sample .
            if (sender == MainMenu_N2_4)
            {
                int FormNumberLocal = 0;
                object[] ParamArray = null; //new object[1];
                ProjectService.FormShow("FormReport", "FormReport", out FormNumberLocal, ParamArray);
            }

            //Открыть документы по ссылке.
            if (sender == MainMenu_N2_6)
            {
                string ValueText = "";
                                 
                if (!sys.InputValue("List of values", "Input links:", SizeMode.Large, ValueType.String, ref ValueText)) return;
                string[] ListObjectID = ValueText.Split('\n');
                sys.ShowDirectorySimple("Contract", "FormContract", "FormContract", null, ListObjectID, null, null);
            }
            
            //Открыть справку
            if (sender == MainMenu_N3_1) sys.ShowHelp();
            
            if (sender == MainMenu_N3_2) new FormAbout().Show();
             
            //Открыть документы по ссылке.
            if (sender == MainMenu_N3_3) sys.ShowDocumentation();
                      
        }
コード例 #5
0
ファイル: FormModel.cs プロジェクト: ewgeny911/FBA
        /// <summary>
        /// Контекстное меню.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddClick(object sender, EventArgs e)
        {
            Operation operation = Operation.NotAssigned;

            if (sender == cmModel_N1)
            {
                operation = Operation.Add;
            }
            if (sender == cmModel_N2)
            {
                operation = Operation.Edit;
            }
            if (sender == cmModel_N3)
            {
                operation = Operation.Del;
            }
            if (sender == cmModel_N4)
            {
                operation = Operation.Refresh;
            }
            //Обновить таблицы парсера.
            if (sender == cmModel_N5)
            {
                sys.CreateParserLocalTables();
                return;
            }

            if (operation == Operation.NotAssigned)
            {
                return;
            }

            //Компонент на котором повешено контекстное меню.
            string componentStrip = sys.GetControlNameByMenuStripItem(sender);
            string objID;
            string entityID    = CompEntityTreeFBA1.EntityID;
            string entityBrief = sys.GetEntityBrief(entityID);

            if (operation == Operation.Refresh)
            {
                if (componentStrip == "dgvAttr")
                {
                    LoadAttrList(CompEntityTreeFBA1.EntityID);
                }
                if (componentStrip == "dgvTable")
                {
                    LoadTableList(CompEntityTreeFBA1.EntityID);
                }
                if (componentStrip == "dgvMethod")
                {
                    LoadMethodList(CompEntityTreeFBA1.EntityID);
                }
                return;
            }

            //Атрибут.
            if (componentStrip == "dgvAttr")
            {
                objID = dgvAttr.Value("ID");
                string AttrBrief = dgvAttr.Value("Brief");
                string AttrName  = dgvAttr.Value("Name");
                if (sender == cmModel_N4)
                {
                    LoadAttrList(entityID);
                }
                var f1 = new FormAttr(operation, entityID, objID, AttrBrief, AttrName);
                f1.Icon = this.Icon;
                if (f1.ShowDialog() == DialogResult.OK)
                {
                    LoadAttrList(entityID);
                }
            }

            //Таблица.
            if (componentStrip == "dgvTable")
            {
                objID = dgvTable.Value("ID");
                string objName = dgvTable.Value("Name");
                if (sender == cmModel_N4)
                {
                    LoadTableList(entityID);
                }
                var f1 = new FormTable(operation, objID, objName, entityID);
                f1.Icon = this.Icon;
                if (f1.ShowDialog() == DialogResult.OK)
                {
                    LoadTableList(entityID);
                }
            }

            //Метод.
            if (componentStrip == "dgvMethod")
            {
                string methodID    = dgvMethod.Value("ID");
                string action      = dgvMethod.Value("Action");
                string methodBrief = dgvMethod.Value("Brief");
                string methodValue = dgvMethod.Value("Value");
                string comment     = dgvMethod.Value("Comment");
                string sql         = "";
                if (operation == Operation.Del)
                {
                    if (methodID == "")
                    {
                        return;
                    }
                    sql = "DELETE FROM fbaMethod WHERE ID = " + methodID;
                    if (!sys.Exec(DirectionQuery.Remote, sql))
                    {
                        return;
                    }
                    LoadMethodList(entityID);
                    sys.SM("Метод удален!", MessageType.Information);
                    return;
                }

                string capForm = "";
                if (operation == Operation.Add)
                {
                    capForm = "Add Entity Method";
                }
                if (operation == Operation.Edit)
                {
                    capForm = "Edit Entity Method";
                }
                if (operation == Operation.Del)
                {
                    capForm = "Delete Entity Method";
                }

                string[] actionArr = { "INSERT", "DELETE", "UPDATE" };

                /*var frm = new FormValue5(cap,
                 *                       "Entity", "Action", "Brief", "Value", "Comment",
                 *                       entityBrief, action, methodBrief, methodValue, comment,
                 *                       null, actionArr);
                 * frm.tbText1.ReadOnly = true;
                 * frm.tbText2.ReadOnly = true;
                 * if (frm.ShowDialog() != DialogResult.OK) return;
                 *
                 * entityBrief = frm.tbText1.Text;
                 * action      = frm.tbText2.Text;
                 * methodBrief = frm.tbText3.Text;
                 * methodValue = frm.tbText4.Text;
                 * comment     = frm.tbText5.Text;
                 */

                var arrvp = new ValueParam[5];
                arrvp[0].captionValue  = "Entity";
                arrvp[0].componentType = ComponentType.ComboBox;
                arrvp[0].values        = null;
                arrvp[0].value         = entityBrief;
                arrvp[0].readOnly      = true;

                arrvp[1].captionValue  = "Action";
                arrvp[1].componentType = ComponentType.ComboBox;
                arrvp[1].values        = actionArr;
                arrvp[1].value         = action;
                arrvp[1].readOnly      = true;

                arrvp[2].captionValue = "Brief";
                arrvp[2].value        = methodBrief;

                arrvp[3].captionValue = "Value";
                arrvp[3].value        = methodValue;

                arrvp[4].captionValue = "Comment";
                arrvp[4].value        = comment;

                var frm = new FormValue(capForm, arrvp);
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                entityBrief = frm.GetValue(0);
                action      = frm.GetValue(1);
                methodBrief = frm.GetValue(2);
                methodValue = frm.GetValue(3);
                comment     = frm.GetValue(4);


                if (operation == Operation.Add)
                {
                    sql = "INSERT INTO fbaMethod (" +
                          "UserCreateID, DateCreate, EntityRef, Action, Brief, Value, Comment) VALUES (" +
                          Var.UserID + ", " + sys.DateTimeCurrent() + "," + entityID + ",'" + action + "', '" + methodBrief + "', '" + methodValue + "', '" + comment + "')";
                    if (!sys.Exec(DirectionQuery.Remote, sql))
                    {
                        return;
                    }
                    sys.SM("Метод добавлен!", MessageType.Information);
                }
                if (operation == Operation.Edit)
                {
                    sql = "UPDATE fbaMethod SET " +
                          "UserChangeID = " + Var.UserID +
                          ",DateChange  = " + sys.DateTimeCurrent() +
                          ",EntityRef   = " + entityID +
                          ",Action      = '" + action + "'" +
                          ",Brief       = '" + methodBrief + "'" +
                          ",Value       = '" + methodValue + "'" +
                          ",Comment     = '" + comment + "'" +
                          " WHERE ID = " + methodID;
                    if (!sys.Exec(DirectionQuery.Remote, sql))
                    {
                        return;
                    }
                    sys.SM("Метод изменён!", MessageType.Information);
                }
                LoadMethodList(entityID);
            }
        }