Exemplo n.º 1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the OptionInfoes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOptionInfoes(OptionInfo optionInfo)
 {
     base.AddObject("OptionInfoes", optionInfo);
 }
Exemplo n.º 2
0
        public string UpdateOptionInfo()
        {
            string op1Name = request.Params["opt1Name"];
            string op1Required = request.Params["opt1Required"];
            string op1Enabled = request.Params["opt1Enabled"];

            string op2Name = request.Params["opt2Name"];
            string op2Required = request.Params["opt2Required"];
            string op2Enabled = request.Params["opt2Enabled"];

            using (DB db = new DB(DBHelper.GetConnectionString(_currentClient)))
            {
                OptionInfo opt1 = (from o in db.OptionInfoes
                                   where o.Number == 1
                                   && o.Client == _currentClient
                                   select o).FirstOrDefault();

                OptionInfo opt2 = (from o in db.OptionInfoes
                                   where o.Number == 2
                                   && o.Client == _currentClient
                                   select o).FirstOrDefault();

                if (opt1 == null)
                {
                    opt1 = new OptionInfo()
                    {
                        Client = _currentClient,
                        Number = 1
                    };

                    db.AddToOptionInfoes(opt1);
                }

                if (opt2 == null)
                {
                    opt2 = new OptionInfo()
                    {
                        Client = _currentClient,
                        Number = 2
                    };

                    db.AddToOptionInfoes(opt2);
                }

                opt1.IsRequired = Convert.ToBoolean(op1Required);
                opt1.Enabled = Convert.ToBoolean(op1Enabled);
                opt1.Name = op1Name;

                opt2.IsRequired = Convert.ToBoolean(op2Required);
                opt2.Enabled = Convert.ToBoolean(op2Enabled);
                opt2.Name = op2Name;

                return (db.SaveChanges() > 0).ToString();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Create a new OptionInfo object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="number">Initial value of the Number property.</param>
 /// <param name="isRequired">Initial value of the IsRequired property.</param>
 /// <param name="client">Initial value of the Client property.</param>
 /// <param name="enabled">Initial value of the Enabled property.</param>
 public static OptionInfo CreateOptionInfo(global::System.Int32 id, global::System.Int32 number, global::System.Boolean isRequired, global::System.String client, global::System.Boolean enabled)
 {
     OptionInfo optionInfo = new OptionInfo();
     optionInfo.Id = id;
     optionInfo.Number = number;
     optionInfo.IsRequired = isRequired;
     optionInfo.Client = client;
     optionInfo.Enabled = enabled;
     return optionInfo;
 }