Esempio n. 1
0
        /// <summary>
        /// Create a control channel string
        /// </summary>
        private static DataRow CreateCtrlCnlRow(DataTable tblCtrlCnl, SortedList <string, int> cmdValList,
                                                KPView.CtrlCnlPrototype ctrlCnl, object objNum, int kpNum, string kpNameToInsert, StreamWriter writer)
        {
            var newCtrlCnlRow = tblCtrlCnl.NewRow();

            newCtrlCnlRow["CtrlCnlNum"] = ctrlCnl.CtrlCnlNum;
            newCtrlCnlRow["Active"]     = true;

            int    maxCtrlCnlNameLen = tblCtrlCnl.Columns["Name"].MaxLength;
            string ctrlCnlName       = kpNameToInsert + ctrlCnl.CtrlCnlName;

            if (ctrlCnlName.Length > maxCtrlCnlNameLen)
            {
                ctrlCnlName = ctrlCnlName.Substring(0, maxCtrlCnlNameLen);
                writer.WriteLine(string.Format(AppPhrases.CtrlCnlNameTrancated, ctrlCnl.CtrlCnlNum));
            }

            newCtrlCnlRow["Name"] = ctrlCnlName;

            newCtrlCnlRow["CmdTypeID"] = ctrlCnl.CmdTypeID;
            newCtrlCnlRow["ObjNum"]    = objNum;
            newCtrlCnlRow["KPNum"]     = kpNum;
            newCtrlCnlRow["CmdNum"]    = ctrlCnl.CmdNum;
            newCtrlCnlRow["CmdValID"]  = string.IsNullOrEmpty(ctrlCnl.CmdValName)
                ? DBNull.Value
                : (object)cmdValList[ctrlCnl.CmdValName];
            newCtrlCnlRow["FormulaUsed"] = ctrlCnl.FormulaUsed;
            newCtrlCnlRow["Formula"]     = ctrlCnl.Formula;
            newCtrlCnlRow["EvEnabled"]   = ctrlCnl.EvEnabled;
            newCtrlCnlRow["ModifiedDT"]  = DateTime.Now;

            return(newCtrlCnlRow);
        }
Esempio n. 2
0
        /// <summary>
        /// Создать строку канала управления
        /// </summary>
        private static DataRow CreateCtrlCnlRow(DataTable tblCtrlCnl, SortedList <string, int> cmdValList,
                                                KPView.CtrlCnlPrototype ctrlCnl, object objNum, int kpNum, string kpNameToInsert)
        {
            DataRow newCtrlCnlRow = tblCtrlCnl.NewRow();

            newCtrlCnlRow["CtrlCnlNum"] = ctrlCnl.CtrlCnlNum;
            newCtrlCnlRow["Active"]     = true;
            newCtrlCnlRow["Name"]       = kpNameToInsert + ctrlCnl.CtrlCnlName;
            newCtrlCnlRow["CmdTypeID"]  = ctrlCnl.CmdTypeID;
            newCtrlCnlRow["ObjNum"]     = objNum;
            newCtrlCnlRow["KPNum"]      = kpNum;
            newCtrlCnlRow["CmdNum"]     = ctrlCnl.CmdNum;
            newCtrlCnlRow["CmdValID"]   = string.IsNullOrEmpty(ctrlCnl.CmdValName) ?
                                          DBNull.Value : (object)cmdValList[ctrlCnl.CmdValName];
            newCtrlCnlRow["FormulaUsed"] = ctrlCnl.FormulaUsed;
            newCtrlCnlRow["Formula"]     = ctrlCnl.Formula;
            newCtrlCnlRow["EvEnabled"]   = ctrlCnl.EvEnabled;
            newCtrlCnlRow["ModifiedDT"]  = DateTime.Now;

            return(newCtrlCnlRow);
        }