예제 #1
0
파일: FormParam.cs 프로젝트: ewgeny911/FBA
        ///Редактировать параметр текущего пользователя.
        private bool ParamEdit(string UserID, string ParamID)
        {
            if (UserID == "")
            {
                return(false);
            }
            if (ParamID == "")
            {
                return(false);
            }

            string[] Values = new string[13];
            string[] Params = new string[10];
            string   SQL    = "SELECT  " +
                              "Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10, ID, Name, Comment FROM fbaParam WHERE ID = " + ParamID;

            if (!sys.GetValueArr(DirectionQuery.Remote, SQL, ref Values))
            {
                return(false);
            }
            for (int i = 0; i < 9; i++)
            {
                Params[i] = Values[i];
            }
            string ParamName    = Values[11];
            string ParamComment = Values[12];
            var    frm          = new FormParamValue(ParamID, ParamName, ParamComment, Params);

            if (frm.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }
            ParamName    = frm.ParamName;
            ParamComment = frm.ParamComment;
            Params       = frm.values;
            SQL          = "UPDATE fbaParam SET " +
                           " Name    = '" + ParamName + "'" +
                           ",Comment = '" + ParamComment + "'" +
                           ",Value1   = '" + Params[0] + "'" +
                           ",Value2   = '" + Params[1] + "'" +
                           ",Value3   = '" + Params[2] + "'" +
                           ",Value4   = '" + Params[3] + "'" +
                           ",Value5   = '" + Params[4] + "'" +
                           ",Value6   = '" + Params[5] + "'" +
                           ",Value7   = '" + Params[6] + "'" +
                           ",Value8   = '" + Params[7] + "'" +
                           ",Value9   = '" + Params[8] + "'" +
                           ",Value10  = '" + Params[9] + "'" +
                           ",DateChange   = " + sys.DateTimeCurrent() +
                           ",UserChangeID = " + Var.UserID +
                           " WHERE ID = " + ParamID;
            if (!sys.Exec(DirectionQuery.Remote, SQL))
            {
                return(false);
            }
            RefreshParam(UserID);
            return(true);
        }
예제 #2
0
파일: FormParam.cs 프로젝트: ewgeny911/FBA
        ///Добавить параметр пользователя.
        private bool ParamAdd(string UserID)
        {
            if (UserID == "")
            {
                return(false);
            }
            string ParamName    = "";
            string ParamComment = "";

            string[] values = new string[10];
            var      frm    = new FormParamValue("0", ParamName, ParamComment, values);

            if (frm.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }
            ParamName    = frm.ParamName;
            ParamComment = frm.ParamComment;
            values       = frm.values;

            string globalstr = "1";
            string userIDStr = "NULL";

            if (UserID != "0")
            {
                globalstr = "0";
                userIDStr = "'" + UserID + "'";
            }
            string SQL = "";

            SQL = "INSERT INTO fbaParam (EntityID, Global, UserID, Type, Name, Comment, DateCreate, " +
                  "Value1, Value2, Value3, Value4, Value5, Value6, Value7, Value8, Value9, Value10) " +
                  "VALUES (235, " + globalstr + ", " + userIDStr + ", 'User', '" + ParamName + "','" + ParamComment + "'," + sys.DateTimeCurrent()
                  + ",'" + values[0] + "'"
                  + ",'" + values[1] + "'"
                  + ",'" + values[2] + "'"
                  + ",'" + values[3] + "'"
                  + ",'" + values[4] + "'"
                  + ",'" + values[5] + "'"
                  + ",'" + values[6] + "'"
                  + ",'" + values[7] + "'"
                  + ",'" + values[8] + "'"
                  + ",'" + values[9] + "'"
                  + ")";
            if (!sys.Exec(DirectionQuery.Remote, SQL))
            {
                return(false);
            }
            RefreshParam(UserID);
            return(true);
        }