Esempio n. 1
0
        public override bool AddCUPE(string question, object clientObj, int questionNumber)
        {
            CLIENT client = clientObj as CLIENT;
            CUPEQUESTION cupeQuestionEnt;
            try
            {
                cupeQuestionEnt = (from ent in dbo.CUPEQUESTION
                                   where ent.NAME.TrimEnd() == question
                                   select ent).Single();
            }

            catch(Exception e)
            {
                MessageBox.Show("Error retrieving CUPEQuestion:\n\n" + e.Message, "Error");
                return false;
            }

            if ((from ent in client.CUPE
                 where ent.CUPEQUESTION == cupeQuestionEnt
                 select ent).Count() != 0)
            {
                MessageBox.Show("Error adding Cupe: Cupe already exists", "Error");
                return false;
            }

            CUPE cupe = new CUPE();
            cupe.CUPEQUESTION = cupeQuestionEnt;
            cupe.NAME = cupeQuestionEnt.NAME;
            cupe.COMMODITY = cupeQuestionEnt.COMMODITY;
            cupe.UTILITY = cupeQuestionEnt.UTILITY;
            cupe.PARTNER = cupeQuestionEnt.PARTNER;
            cupe.ENABLER = cupeQuestionEnt.ENABLER;
            cupe.QUESTIONNUMBER = questionNumber;
            client.CUPE.Add(cupe);

            dbo.AddToCUPE(cupe);

            return true;
        }
Esempio n. 2
0
        public bool GetCUPE(string name, CLIENT client, out CUPE cupe)
        {
            try
            {
                cupe = (from ent in client.CUPE
                        where ent.NAME.TrimEnd() == name
                        select ent).Single();

                return true;
            }

            catch
            {
                cupe = null;
                return false;
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the CUPE EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCUPE(CUPE cUPE)
 {
     base.AddObject("CUPE", cUPE);
 }
 /// <summary>
 /// Create a new CUPE object.
 /// </summary>
 /// <param name="cUPEID">Initial value of the CUPEID property.</param>
 public static CUPE CreateCUPE(global::System.Int32 cUPEID)
 {
     CUPE cUPE = new CUPE();
     cUPE.CUPEID = cUPEID;
     return cUPE;
 }
Esempio n. 5
0
 /// <summary>
 /// Create a new CUPE object.
 /// </summary>
 /// <param name="cUPEID">Initial value of the CUPEID property.</param>
 /// <param name="qUESTIONNUMBER">Initial value of the QUESTIONNUMBER property.</param>
 public static CUPE CreateCUPE(global::System.Int32 cUPEID, global::System.Int32 qUESTIONNUMBER)
 {
     CUPE cUPE = new CUPE();
     cUPE.CUPEID = cUPEID;
     cUPE.QUESTIONNUMBER = qUESTIONNUMBER;
     return cUPE;
 }