Esempio n. 1
0
 public static bool AddNewInputModelColumn(string InputModelID, string GroupID, string ColumnName)
 {
     try
     {
         using (SqlConnection cn = SqlHelper.OpenConnection())
         {
             SqlCommand _cmd = new SqlCommand(SQL_AddNewInputModelColumn, cn);
             _cmd.Parameters.Add("@IVC_ID", decimal.Parse(SequenceAccessor.GetNewId()));
             _cmd.Parameters.Add("@IV_ID", decimal.Parse(InputModelID));
             _cmd.Parameters.Add("@COLUMNNAME", ColumnName);
             _cmd.Parameters.Add("@DISPLAYNAME", ColumnName);
             _cmd.Parameters.Add("@IVG_ID", decimal.Parse(GroupID));
             _cmd.ExecuteNonQuery();
         }
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Esempio n. 2
0
        public static bool SaveNewInputModel(string _namespace, MD_InputModel SaveModel)
        {
            try
            {
                using (SqlConnection cn = SqlHelper.OpenConnection())
                {
                    SqlCommand _cmd = new SqlCommand(SQL_SaveNewInputModel, cn);
                    _cmd.Parameters.Add("@IV_ID", SequenceAccessor.GetNewId());
                    _cmd.Parameters.Add("@NAMESPACE", _namespace);
                    _cmd.Parameters.Add("@IV_NAME", SaveModel.ModelName);
                    _cmd.Parameters.Add("@DESCRIPTION", SaveModel.Descript);

                    _cmd.Parameters.Add("@DISPLAYNAME", SaveModel.DisplayName);
                    _cmd.Parameters.Add("@DISPLAYORDER", Convert.ToDecimal(SaveModel.DisplayOrder));

                    StringBuilder _cs = new StringBuilder();
                    _cs.Append(string.Format("<TABLE>{0}</TABLE>", SaveModel.TableName));
                    _cs.Append(string.Format("<ORDER>{0}</ORDER>", SaveModel.OrderField));
                    _cs.Append(string.Format("<TYPE>{0}</TYPE>", SaveModel.ModelType));
                    _cs.Append(string.Format("<PARAMTYPE>{0}</PARAMTYPE>", SaveModel.ParamterType));
                    _cs.Append(string.Format("<INITZB>{0}</INITZB>", SaveModel.InitGuideLine));
                    _cs.Append(string.Format("<GETZB>{0}</GETZB>", SaveModel.GetDataGuideLine));
                    _cs.Append(string.Format("<NEWZB>{0}</NEWZB>", SaveModel.GetNewRecordGuideLine));

                    _cmd.Parameters.Add("@IV_CS", _cs.ToString());
                    _cmd.Parameters.Add("@DELRULE", SaveModel.DeleteRule);
                    _cmd.Parameters.Add("@DWDM", SaveModel.DWDM);
                    _cmd.ExecuteNonQuery();
                }
                return(true);
            }
            catch (Exception e)
            {
                LogWriter.WriteSystemLog(e.Message, "ERROR");
                return(false);
            }
        }
Esempio n. 3
0
        public static bool AddNewInputModelSavedTable(string InputModelID, string TableName)
        {
            using (SqlConnection cn = SqlHelper.OpenConnection())
            {
                SqlTransaction _txn = cn.BeginTransaction();
                try
                {
                    SqlCommand _cmd = new SqlCommand(SQL_AddNewInputModelSavedTable, cn, _txn);
                    _cmd.Parameters.Add("@ID", decimal.Parse(SequenceAccessor.GetNewId()));
                    _cmd.Parameters.Add("@TABLENAME", TableName);
                    _cmd.Parameters.Add("@IV_ID", decimal.Parse(InputModelID));
                    _cmd.Parameters.Add("@TABLETITLE", TableName);

                    _cmd.ExecuteNonQuery();
                    _txn.Commit();
                    return(true);
                }
                catch (Exception e)
                {
                    _txn.Rollback();
                    return(false);
                }
            }
        }