public ReportSubAllPeriods()
        {
            InitializeComponent();
            FirstControl = TextBoxSubScriptionId;
            ControlsArray.Add(TextBoxSubScriptionId, new ControlsTab {
                Prev = DataGridView, Next = TextBoxDateFrom, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxDateFrom, new ControlsTab {
                Prev = TextBoxSubScriptionId, Next = TextBoxDateTo, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxDateTo, new ControlsTab {
                Prev = TextBoxDateFrom, Next = ButtonBeginSearch, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(ButtonBeginSearch, new ControlsTab {
                Prev = TextBoxDateTo, Next = DataGridView, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(DataGridView, new ControlsTab {
                Prev = TextBoxDateTo, Next = null, Type = ControlsType.TextBoxText
            });

            ControlsArrayForValidation.Add(TextBoxSubScriptionId, new ControlsTab {
                Prev = null, Next = TextBoxDateFrom, Type = ControlsType.TextBoxText
            });
            ControlsArrayForValidation.Add(TextBoxDateFrom, new ControlsTab {
                Prev = TextBoxSubScriptionId, Next = TextBoxDateTo, Type = ControlsType.TextBoxText
            });
            ControlsArrayForValidation.Add(TextBoxDateTo, new ControlsTab {
                Prev = TextBoxDateFrom, Next = null, Type = ControlsType.TextBoxText
            });
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Toy doll = new Toy();
            doll.Make = "rubber";
            doll.Model = "barbie";
            doll.Name = "Elsa";

            Toy car = new Toy();
            car.Make = "plastic";
            car.Model = "BMW";
            car.Name = "SPUR";

            System.Collections.ArrayList myArrayList = new System.Collections.ArrayList();
            myArrayList.Add(doll);
            myArrayList.Add(car);

            System.Collections.Specialized.ListDictionary myDictionary
                = new System.Collections.Specialized.ListDictionary();

            myDictionary.Add(doll.Name, doll);
            myDictionary.Add(car.Name, car);
            foreach (object o in myArrayList)
            {
                Console.WriteLine(((Toy)o).Name);
            }

            Console.WriteLine(((Toy)myDictionary["Elsa"]).Model);
            Console.ReadLine();
        }
        public BillsReceivable()
        {
            InitializeComponent();
            FirstControl = TextBoxSubScriptionId;
            ControlsArraySubScriptionId.Add(TextBoxSubScriptionId, new ControlsTab {
                Prev = null, Next = null, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxSubScriptionId, new ControlsTab {
                Prev = TextBoxCurrentRead, Next = TextBoxCurrentReadDate, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxCurrentReadDate, new ControlsTab {
                Prev = TextBoxSubScriptionId, Next = TextBoxCurrentRead, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxCurrentRead, new ControlsTab {
                Prev = TextBoxCurrentReadDate, Next = null, Type = ControlsType.TextBoxNumber
            });

            FirstControlSearch = RadioSearchBySubCode;
            ControlsArraySearch.Add(RadioSearchBySubCode, new ControlsTab {
                Prev = TextBoxSearch, Next = RadioSearchByCode, Type = ControlsType.RadioButton
            });
            ControlsArraySearch.Add(RadioSearchByCode, new ControlsTab {
                Prev = RadioSearchBySubCode, Next = TextBoxSearch, Type = ControlsType.RadioButton
            });
            ControlsArraySearch.Add(TextBoxSearch, new ControlsTab {
                Prev = RadioSearchByCode, Next = null, Type = ControlsType.TextBoxText
            });
        }
Exemple #4
0
        public AccountTypes()
        {
            InitializeComponent();
            FirstControlNewAccountType = TextBoxName;
            ControlsArray.Add(TextBoxName, new ControlsTab {
                Prev = TextBoxComments, Next = TextBoxFormules, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxFormules, new ControlsTab {
                Prev = TextBoxName, Next = TextBoxComments, Type = ControlsType.TextBoxFormul
            });
            ControlsArray.Add(TextBoxComments, new ControlsTab {
                Prev = TextBoxFormules, Next = null, Type = ControlsType.TextBoxText
            });

            FirstControlSearch = RadioSearchByCode;
            ControlsArraySearch.Add(RadioSearchByCode, new ControlsTab {
                Prev = TextBoxSearch, Next = RadioSearchByProfile, Type = ControlsType.RadioButton
            });
            ControlsArraySearch.Add(RadioSearchByProfile, new ControlsTab {
                Prev = RadioSearchByCode, Next = TextBoxSearch, Type = ControlsType.RadioButton
            });
            ControlsArraySearch.Add(TextBoxSearch, new ControlsTab {
                Prev = RadioSearchByProfile, Next = null, Type = ControlsType.TextBoxText
            });
        }
Exemple #5
0
        /// <summary> Provides an object instance to the network. All objects will be omnipresent. </summary>
        public static void ServeOmnipresentObject(string NewUri, string NewIP, uint NewPort, MarshalByRefObject ObjectToServe)
        {
            ChannelManager.LocalUri  = NewUri;
            ChannelManager.LocalIP   = NewIP;
            ChannelManager.LocalPort = NewPort;

            //Create the channel if it doesn't exist
            if (ChannelManager.DoesChannelExist(NewUri) == false)
            {
                System.Collections.Specialized.ListDictionary ChannelProperties = new System.Collections.Specialized.ListDictionary();
                ChannelProperties.Add("port", (int)ChannelManager.LocalPort);
                ChannelProperties.Add("name", ChannelManager.LocalUri);
                ChannelProperties.Add("bindTo", ChannelManager.LocalIP);

                HttpChannel chnl = new HttpChannel(ChannelProperties, new SoapClientFormatterSinkProvider(), new SoapServerFormatterSinkProvider());
                ChannelServices.RegisterChannel(chnl);

                //Need a way to see if this object is already marshaled?
                RemotingServices.Marshal(ObjectToServe, ChannelManager.LocalUri);
            }

            //Throw a fatal exception if the channel was not created
            if (ChannelManager.DoesChannelExist(ChannelManager.LocalUri) == false)
            {
                throw new Exception(String.Format("Created the channel '{0}', but it didn't show up as a registered channel", ChannelManager.LocalUri));
            }
        }
Exemple #6
0
        public static void CreateLocalChannel(string NewUri, string NewIP, uint NewPort, System.Type ObjectToBeServed, WellKnownObjectMode ObjectMode)
        {
            ChannelManager.LocalUri  = NewUri;
            ChannelManager.LocalIP   = NewIP;
            ChannelManager.LocalPort = NewPort;

            //Create the channel if it doesn't exist
            if (ChannelManager.DoesChannelExist(NewUri) == false)
            {
                System.Collections.Specialized.ListDictionary ChannelProperties = new System.Collections.Specialized.ListDictionary();
                ChannelProperties.Add("port", (int)ChannelManager.LocalPort);
                ChannelProperties.Add("name", ChannelManager.LocalUri);
                ChannelProperties.Add("bindTo", ChannelManager.LocalIP);

                HttpChannel chnl = new HttpChannel(ChannelProperties, new SoapClientFormatterSinkProvider(), new SoapServerFormatterSinkProvider());
                ChannelServices.RegisterChannel(chnl);

                if (DoesWellKnowServiceExist(ObjectToBeServed.FullName) == false)
                {
                    RemotingConfiguration.RegisterWellKnownServiceType(
                        ObjectToBeServed,
                        ChannelManager.LocalUri,
                        ObjectMode);
                }
            }

            //Throw a fatal exception if the channel was not created
            if (ChannelManager.DoesChannelExist(ChannelManager.LocalUri) == false)
            {
                throw new Exception(String.Format("Created the channel '{0}', but it didn't show up as a registered channel", ChannelManager.LocalUri));
            }
        }
Exemple #7
0
        public Subscriptions()
        {
            InitializeComponent();
            FirstControl = TextBoxSubScriptionId;
            ControlsArray.Add(TextBoxSubScriptionId, new ControlsTab {
                Prev = TextBoxComments, Next = TextBoxCustomerId, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxCustomerId, new ControlsTab {
                Prev = TextBoxSubScriptionId, Next = ComboBoxAccountType, Type = ControlsType.TextBoxNumber
            });
            ControlsArray.Add(ComboBoxAccountType, new ControlsTab {
                Prev = TextBoxCustomerId, Next = ComboBoxPreventType, Type = ControlsType.ComboBox
            });
            ControlsArray.Add(ComboBoxPreventType, new ControlsTab {
                Prev = ComboBoxAccountType, Next = TextBoxWaterMeterSerial, Type = ControlsType.ComboBox
            });
            ControlsArray.Add(TextBoxWaterMeterSerial, new ControlsTab {
                Prev = ComboBoxPreventType, Next = TextBoxWaterMeterNumber, Type = ControlsType.TextBoxNumber
            });
            ControlsArray.Add(TextBoxWaterMeterNumber, new ControlsTab {
                Prev = TextBoxWaterMeterSerial, Next = TextBoxNumberReadDate, Type = ControlsType.TextBoxNumber
            });
            ControlsArray.Add(TextBoxNumberReadDate, new ControlsTab {
                Prev = TextBoxWaterMeterNumber, Next = TextBoxDeficit1000, Type = ControlsType.TextBoxNumber
            });
            ControlsArray.Add(TextBoxDeficit1000, new ControlsTab {
                Prev = TextBoxNumberReadDate, Next = TextBoxDebt, Type = ControlsType.TextBoxNumber
            });
            ControlsArray.Add(TextBoxDebt, new ControlsTab {
                Prev = TextBoxDeficit1000, Next = TextBoxPostalCode, Type = ControlsType.TextBoxNumber
            });
            ControlsArray.Add(TextBoxPostalCode, new ControlsTab {
                Prev = TextBoxDebt, Next = TextBoxAddress, Type = ControlsType.TextBoxNumber
            });
            ControlsArray.Add(TextBoxAddress, new ControlsTab {
                Prev = TextBoxPostalCode, Next = TextBoxComments, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxComments, new ControlsTab {
                Prev = TextBoxAddress, Next = null, Type = ControlsType.TextBoxText
            });

            FirstControlSearch = RadioSearchBySubCode;
            ControlsArraySearch.Add(RadioSearchBySubCode, new ControlsTab {
                Prev = TextBoxSearch, Next = RadioSearchByCode, Type = ControlsType.RadioButton
            });
            ControlsArraySearch.Add(RadioSearchByCode, new ControlsTab {
                Prev = RadioSearchBySubCode, Next = RadioSearchByProfile, Type = ControlsType.RadioButton
            });
            ControlsArraySearch.Add(RadioSearchByProfile, new ControlsTab {
                Prev = RadioSearchByCode, Next = TextBoxSearch, Type = ControlsType.RadioButton
            });
            ControlsArraySearch.Add(TextBoxSearch, new ControlsTab {
                Prev = RadioSearchByProfile, Next = null, Type = ControlsType.TextBoxText
            });
        }
Exemple #8
0
        static void Main(string[] args)
        {
            RMParser parser = new RMParser();

            if (!parser.Parse(args))
            {
                return;
            }

            GlobalState.Name = parser["n"].ToLower();
            string port_num = parser["p"];

            System.Console.WriteLine(string.Format("Starting resource manager for {0} on port {1}", GlobalState.Name, port_num));

            System.Collections.Specialized.ListDictionary channelProperties = new System.Collections.Specialized.ListDictionary();
            channelProperties.Add("port", port_num);
            channelProperties.Add("name", GlobalState.Name);

            HttpChannel channel = new HttpChannel(channelProperties, new SoapClientFormatterSinkProvider(), new SoapServerFormatterSinkProvider());

            System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel, false);
            System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType
                (Type.GetType("MyRM.MyRM")                                      // Assembly name
                , "RM.soap"                                                     // URI
                , System.Runtime.Remoting.WellKnownObjectMode.Singleton         // Instancing mode
                );

            // activate the object
            string[] urls = channel.GetUrlsForUri("RM.soap");
            if (1 != urls.Length)
            {
                throw new InvalidOperationException();
            }

            MyRM resourceManager = (MyRM)System.Activator.GetObject(typeof(TP.RM), urls[0]);

            if (null == resourceManager)
            {
                throw new InvalidProgramException();
            }

            // initialize and start RM
            Console.WriteLine("{0}: Initializing", GlobalState.Name);
            resourceManager.Init(parser["n"], urls[0], parser["tm"]);

            Console.WriteLine("{0}: Running", GlobalState.Name);
            resourceManager.Run();

            Console.WriteLine("{0}: Exitting", GlobalState.Name);
        }
        public ReadingListReport()
        {
            InitializeComponent();
            FirstControl = TextBoxSubScriptionIdFrom;
            ControlsArray.Add(TextBoxSubScriptionIdFrom, new ControlsTab {
                Prev = DataGridView, Next = TextBoxSubScriptionIdTo, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxSubScriptionIdTo, new ControlsTab {
                Prev = TextBoxSubScriptionIdFrom, Next = TextBoxMeliCode, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxMeliCode, new ControlsTab {
                Prev = TextBoxSubScriptionIdTo, Next = TextBoxName, Type = ControlsType.TextBoxNumber
            });

            ControlsArray.Add(TextBoxName, new ControlsTab {
                Prev = TextBoxMeliCode, Next = TextBoxFamily, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxFamily, new ControlsTab {
                Prev = TextBoxName, Next = TextBoxFather, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxFather, new ControlsTab {
                Prev = TextBoxFamily, Next = ButtonBeginSearch, Type = ControlsType.TextBoxText
            });

            ControlsArray.Add(ButtonBeginSearch, new ControlsTab {
                Prev = TextBoxFather, Next = DataGridView, Type = ControlsType.TextBoxText
            });

            ControlsArray.Add(DataGridView, new ControlsTab {
                Prev = TextBoxFather, Next = null, Type = ControlsType.TextBoxText
            });
        }
 public Settings()
 {
     InitializeComponent();
     FirstControl = ComboBoxCurrentYear;
     ControlsArray.Add(ComboBoxCurrentYear, new ControlsTab {
         Prev = TextBoxMessage, Next = TextBoxVat, Type = ControlsType.ComboBox
     });
     ControlsArray.Add(TextBoxVat, new ControlsTab {
         Prev = ComboBoxCurrentYear, Next = TextBoxSubscription, Type = ControlsType.TextBoxNumber
     });
     ControlsArray.Add(TextBoxSubscription, new ControlsTab {
         Prev = TextBoxVat, Next = TextBoxCompanyName, Type = ControlsType.TextBoxNumber
     });
     ControlsArray.Add(TextBoxCompanyName, new ControlsTab {
         Prev = TextBoxSubscription, Next = TextBoxAuthorityName, Type = ControlsType.TextBoxText
     });
     ControlsArray.Add(TextBoxAuthorityName, new ControlsTab {
         Prev = TextBoxCompanyName, Next = TextBoxTel, Type = ControlsType.TextBoxText
     });
     ControlsArray.Add(TextBoxTel, new ControlsTab {
         Prev = TextBoxAuthorityName, Next = TextBoxAddress, Type = ControlsType.TextBoxNumber
     });
     ControlsArray.Add(TextBoxAddress, new ControlsTab {
         Prev = TextBoxTel, Next = TextBoxMessage, Type = ControlsType.TextBoxText
     });
     ControlsArray.Add(TextBoxMessage, new ControlsTab {
         Prev = TextBoxAddress, Next = null, Type = ControlsType.TextBoxText
     });
 }
Exemple #11
0
        public Customers()
        {
            InitializeComponent();
            FirstControlNew = TextBoxName;
            ControlsArray.Add(TextBoxName, new ControlsTab {
                Prev = TextBoxComments, Next = TextBoxFamily, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxFamily, new ControlsTab {
                Prev = TextBoxName, Next = TextBoxFather, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxFather, new ControlsTab {
                Prev = TextBoxFamily, Next = TextBoxCityCard, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxCityCard, new ControlsTab {
                Prev = TextBoxFather, Next = TextBoxIdCard, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxIdCard, new ControlsTab {
                Prev = TextBoxCityCard, Next = TextBoxMeliCode, Type = ControlsType.TextBoxNumber
            });
            ControlsArray.Add(TextBoxMeliCode, new ControlsTab {
                Prev = TextBoxIdCard, Next = TextBoxPhone, Type = ControlsType.TextBoxNumber
            });
            ControlsArray.Add(TextBoxPhone, new ControlsTab {
                Prev = TextBoxMeliCode, Next = TextBoxCellPhone, Type = ControlsType.TextBoxNumber
            });
            ControlsArray.Add(TextBoxCellPhone, new ControlsTab {
                Prev = TextBoxPhone, Next = TextBoxPostalCode, Type = ControlsType.TextBoxNumber
            });
            ControlsArray.Add(TextBoxPostalCode, new ControlsTab {
                Prev = TextBoxCellPhone, Next = TextBoxAddress, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxAddress, new ControlsTab {
                Prev = TextBoxPostalCode, Next = TextBoxComments, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxComments, new ControlsTab {
                Prev = TextBoxAddress, Next = null, Type = ControlsType.TextBoxText
            });

            FirstControlSearch = RadioSearchByCode;
            ControlsArraySearch.Add(RadioSearchByCode, new ControlsTab {
                Prev = TextBoxSearch, Next = RadioSearchByProfile, Type = ControlsType.RadioButton
            });
            ControlsArraySearch.Add(RadioSearchByProfile, new ControlsTab {
                Prev = RadioSearchByCode, Next = TextBoxSearch, Type = ControlsType.RadioButton
            });
            ControlsArraySearch.Add(TextBoxSearch, new ControlsTab {
                Prev = RadioSearchByProfile, Next = null, Type = ControlsType.TextBoxText
            });
        }
Exemple #12
0
        /// <summary>
        /// Loads article template references into memory from XML file.
        /// </summary>
        /// <returns></returns>
        public static System.Collections.Specialized.ListDictionary LoadArticleTemplates()
        {
            string appKeyName = "sf_articleTemplates";

            System.Web.HttpContext context = System.Web.HttpContext.Current;

            if (context.Application[appKeyName] != null)
            {
                return((System.Collections.Specialized.ListDictionary)context.Application[appKeyName]);
            }
            else
            {
                System.Collections.Specialized.ListDictionary at = new System.Collections.Specialized.ListDictionary();
                System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
                try
                {
                    xd.Load(System.AppDomain.CurrentDomain.BaseDirectory + SFGlobal.NodeTemplateLocation + "\\" + System.Configuration.ConfigurationSettings.AppSettings["articleTemplateDefinitions"]);
                    foreach (XmlNode xn in xd["templates"])
                    {
                        at.Add(int.Parse(xn.Attributes["id"].Value), new ArticleTemplateInfo(xn.Attributes["id"].Value, xn.Attributes["name"].Value, xn.Attributes["src"].Value));
                    }
                    context.Application.Add(appKeyName, at);
                }
                catch (Exception e)
                {
                    throw new DuryTools.ErrorHandler("can't load articleTemplate XML...", e);
                }
                return(at);
            }
        }
        public static int GetNextSequenceNo(int documentTypeId, int accountId, int fiscalYearId)
        {
            int sequenceNo;

            System.Collections.Specialized.ListDictionary Parms = new System.Collections.Specialized.ListDictionary();
            Parms.Add("@DocumentTypeID", documentTypeId);
            Parms.Add("@AccountID", accountId);
            Parms.Add("@FiscalYearID", fiscalYearId);
            Parms.Add("@SequenceNo", 0);

            DocumentType documentType = new DocumentType();

            documentType.LoadFromSql("[sp_GetNextSequence]", Parms, CommandType.StoredProcedure);
            sequenceNo = documentType.Getint("SequenceNo");
            return(sequenceNo);
        }
Exemple #14
0
        public override void LoadData(XmlNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            if (node.Name != GroupName)
            {
                throw new FormatException(String.Format("Expecting <{0}>", GroupName));
            }

            keys = new System.Collections.Specialized.ListDictionary();
            foreach (XmlNode n in node.ChildNodes)
            {
                string name = n.Attributes ["name"].Value;
                if (CheckIfAdd(name, n))
                {
                    string key = GetNodeKey(name, n);
                    if (keys.Contains(key))
                    {
                        if ((string)keys[key] != name)
                        {
                            throw new NotImplementedException("Attribute with same name but diffent value");
                        }
                    }
                    else
                    {
                        keys.Add(key, name);
                    }

                    LoadExtraData(key, n);
                }
            }
        }
Exemple #15
0
 /// <summary>
 /// Returns the beginning balance of a certain item inside a certain store (Uses a stored proc on the backend)
 /// </summary>
 /// <param name="storeID"></param>
 /// <param name="itemID"></param>
 /// <returns></returns>
 public Int64 GetBeginningBalance(int storeID, int itemID)
 {
     this.FlushData();
     System.Collections.Specialized.ListDictionary ld = new System.Collections.Specialized.ListDictionary();
     ld.Add("@StoreID", storeID);
     ld.Add("@ItemID", itemID);
     this.LoadFromSql("rpt_BeginningBalance", ld, CommandType.StoredProcedure);
     if (this.RowCount > 0)
     {
         return(Convert.ToInt64(this.DataTable.Rows[0][0]));
     }
     else
     {
         return(0);
     }
 }
Exemple #16
0
        public void ResetPassword(ResetPasswordRequestModel model)
        {
            using (OrgCommEntities dbc = new OrgCommEntities(DBConfigs.OrgCommConnectionString))
            {
                OrgComm.Data.Models.Member member = dbc.Members.SingleOrDefault(r => (!r.DelFlag) && r.Email.Equals(model.Email));

                if (member == null)
                {
                    throw new OrgException(1, "Invalid profile");
                }

                string password = System.Web.Security.Membership.GeneratePassword(8, 0);

                member.Salt         = SecurityHelper.GenerateBase64SaltString();
                member.PasswordHash = this.GenerateHash(member.Salt, password);

                member.UpdatedDate = DateTime.Now;

                dbc.SaveChanges();

                if (AppConfigs.MailSendMail)
                {
                    System.Collections.Specialized.ListDictionary listReplacement = new System.Collections.Specialized.ListDictionary();

                    listReplacement.Add("{password}", password);

                    MailSender.Send(AppConfigs.MailFrom, member.Email, "Reset password", listReplacement, AppConfigs.MailTemplateResetPassword);
                }
            }
        }
Exemple #17
0
 /// <summary>
 /// Prepares properties for some of the loggers used in this system that aren't
 /// associated with a particular class but named with a <c>string</c> typed 
 /// name.
 /// </summary>
 /// <param name="loggerName"></param>
 /// <returns></returns>
 public IDictionary PrepareNamedLoggerProperties(string loggerName)
 {
     IDictionary dict = new System.Collections.Specialized.ListDictionary();
       ILog log = LogManager.GetLogger(loggerName);
       dict.Add("logger", log);
       return dict;
 }
        // GetParameters creates a list dictionary
        // consisting of a report parameter name and a value.
        private System.Collections.Specialized.ListDictionary GetParmeters(string parms)
        {
            System.Collections.Specialized.ListDictionary ld = new System.Collections.Specialized.ListDictionary();
            if (parms == null)
            {
                return(ld);  // dictionary will be empty in this case
            }

            // parms are separated by &

            char[]   breakChars = new char[] { '&' };
            string[] ps         = parms.Split(breakChars);

            foreach (string p in ps)
            {
                int iEq = p.IndexOf("=");
                if (iEq > 0)
                {
                    string name = p.Substring(0, iEq);
                    string val  = p.Substring(iEq + 1);
                    ld.Add(name, val);
                }
            }
            return(ld);
        }
Exemple #19
0
 public Billing()
 {
     InitializeComponent();
     FirstControl = TextBoxCurrentRead;
     ControlsArray.Add(TextBoxCurrentRead, new ControlsTab {
         Prev = TextBoxCurrentRead, Next = null, Type = ControlsType.TextBoxNumber
     });
 }
Exemple #20
0
        /// <summary>
        /// Prepares the logger properties.
        /// This method should be called by every class who wants to be logged to
        /// prepare the logging properties.
        /// </summary>
        /// <param name="objType">Type of the object.</param>
        /// <returns>A dictionary with the properties of the logger.</returns>
        public IDictionary PrepareLoggerProperties(Type objType)
        {
            IDictionary dict = new System.Collections.Specialized.ListDictionary();
            ILog        log  = LogManager.GetLogger(objType);

            dict.Add("logger", log);
            return(dict);
        }
Exemple #21
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            TextBox TextBox1 = (TextBox)GridView1.FooterRow.FindControl("TextBox1");
            TextBox TextBox2 = (TextBox)GridView1.FooterRow.FindControl("TextBox2");
            TextBox TextBox3 = (TextBox)GridView1.FooterRow.FindControl("TextBox3");

            System.Collections.Specialized.ListDictionary listDictionary = new System.Collections.Specialized.ListDictionary();
            listDictionary.Add("c_code", TextBox1.Text);
            listDictionary.Add("c_name", TextBox2.Text);
            listDictionary.Add("c_credit", TextBox3.Text);
            LinqDataSource1.Insert(listDictionary);

            TextBox1.Text = String.Empty;
            TextBox2.Text = String.Empty;
            TextBox3.Text = String.Empty;
            GridView1.DataBind();
        }
Exemple #22
0
            /// <summary>
            /// Emits an IDictionary form of the memento that can be, for example, dumped to
            /// Trace.
            /// </summary>
            /// <returns>An IDictionary form of the memento.</returns>
            public IDictionary GetDictionary()
            {
                IDictionary retval = new System.Collections.Specialized.ListDictionary();

                retval.Add("Name", m_materialType.Name);
                retval.Add("Mass", m_mass);
                retval.Add("Volume", m_mass / m_materialType.SpecificGravity);
                retval.Add("Temp", m_temperature);
                if (m_matlSpecs != null)
                {
                    int i = 0;
                    foreach (DictionaryEntry de in m_matlSpecs)
                    {
                        retval.Add("MatlSpec_" + (i++), "Guid:" + de.Key + ", Amt:" + de.Value);
                    }
                }
                return(retval);
            }
Exemple #23
0
        public async Task <bool> SendActivationEmail(string strTo, string username, string newPassword, string activationKey, string absoluteURL)
        {
            System.Collections.Specialized.ListDictionary replacements = new System.Collections.Specialized.ListDictionary();

            ActivationMailConfig config = MailConfigProvider.GetConfiguration <ActivationMailConfig>();
            string fromURL = string.IsNullOrEmpty(config.ActivationURL) ? absoluteURL : config.ActivationURL;

            replacements.Add("<%Username%>", username);
            replacements.Add("<%Password%>", newPassword);
            replacements.Add("<%ActivationKey%>", activationKey);
            replacements.Add("<%ActivationUrl%>", @fromURL);
            replacements.Add("<%ActivationPath%>", @config.ActivationPath);

            DisciturMailDef <ActivationMailConfig> md = new DisciturMailDef <ActivationMailConfig>(replacements);
            MailMessage mm = md.CreateMailMessage(strTo);

            return(await this.SendEmail(mm, config.From, null));
        }
        public async Task<bool> SendActivationEmail(string strTo, string username, string newPassword, string activationKey, string absoluteURL)
        {
            System.Collections.Specialized.ListDictionary replacements = new System.Collections.Specialized.ListDictionary();

            ActivationMailConfig config = MailConfigProvider.GetConfiguration<ActivationMailConfig>();
            string fromURL = string.IsNullOrEmpty(config.ActivationURL) ? absoluteURL : config.ActivationURL;

            replacements.Add("<%Username%>", username);
            replacements.Add("<%Password%>", newPassword);
            replacements.Add("<%ActivationKey%>", activationKey);
            replacements.Add("<%ActivationUrl%>", @fromURL);
            replacements.Add("<%ActivationPath%>", @config.ActivationPath);

            DisciturMailDef<ActivationMailConfig> md = new DisciturMailDef<ActivationMailConfig>(replacements);
            MailMessage mm = md.CreateMailMessage(strTo);

            return await this.SendEmail(mm, config.From, null);
        }
        public SendSmsToDebtors()
        {
            InitializeComponent();
            FirstControl = TextBoxSubScriptionIdFrom;
            ControlsArray.Add(TextBoxSubScriptionIdFrom, new ControlsTab {
                Prev = DataGridView, Next = TextBoxSubScriptionIdTo, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxSubScriptionIdTo, new ControlsTab {
                Prev = TextBoxSubScriptionIdFrom, Next = TextBoxMeliCode, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxMeliCode, new ControlsTab {
                Prev = TextBoxSubScriptionIdTo, Next = TextBoxName, Type = ControlsType.TextBoxNumber
            });

            ControlsArray.Add(TextBoxName, new ControlsTab {
                Prev = TextBoxMeliCode, Next = TextBoxFamily, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxFamily, new ControlsTab {
                Prev = TextBoxName, Next = TextBoxFather, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxFather, new ControlsTab {
                Prev = TextBoxFamily, Next = ButtonBeginSearch, Type = ControlsType.TextBoxText
            });

            ControlsArray.Add(ButtonBeginSearch, new ControlsTab {
                Prev = TextBoxFather, Next = DataGridView, Type = ControlsType.TextBoxText
            });

            ControlsArray.Add(TextBoxSmsMessage, new ControlsTab {
                Prev = ButtonBeginSearch, Next = DataGridView, Type = ControlsType.TextBoxText
            });

            ControlsArray.Add(DataGridView, new ControlsTab {
                Prev = TextBoxSmsMessage, Next = null, Type = ControlsType.TextBoxText
            });

            TextBoxSmsMessage.Text = Commons.WaterAndWastewaterAuthorityName.Trim() + "\n" +
                                     "نام مشترک:" + " " + "[Name] [Family]" + "\n" +
                                     "شماره اشتراک:" + " " + "[SubscriptionId]" + "\n" +
                                     //"شماره کنتور:" + " " + "[WaterMeterSerial]" + "\n" +
                                     //"تاریخ قرائت از:" + " " + "[PrevReadDate]" + " " + "تا:" + " " + "[CurrentReadDate]" + "\n" +
                                     "تاریخ آخرین قرائت:" + " " + "[CurrentReadDate]" + "\n" +
                                     //"میزان مصرف:" + " " + "[Consumption]" + "\n" +
                                     "مبلغ قابل پرداخت:" + " " + "[Debt]" + " " + "ریال";
            //"مهلت پرداخت:" + " " + "[PaymentDeadLine]" +  "\n"
            //"نحوه واریز:" + " " + "بانک صادرات" + " " + "0103076808008";
        }
Exemple #26
0
        private void Load(System.Xml.XmlDocument BrowserFile)
        {
            Lookup        = new System.Collections.Specialized.ListDictionary();
            DefaultLookup = new System.Collections.Specialized.ListDictionary();
            RefNodes      = new List <Node>();
            System.Xml.XmlNode node;
            //I know this might allocate more nodes then needed but never less.
            Nodes = new Node[BrowserFile.DocumentElement.ChildNodes.Count];
            for (int a = 0; a <= BrowserFile.DocumentElement.ChildNodes.Count - 1; a++)
            {
                node = BrowserFile.DocumentElement.ChildNodes[a];

                if (node.NodeType == System.Xml.XmlNodeType.Comment)
                {
                    continue;
                }
                Nodes[a]          = new Node(node);
                Nodes[a].FileName = FileName;
                if (Nodes[a].NameType != NodeType.DefaultBrowser)
                {
                    //fxcop sugguested this was faster then
                    //Nodes[a].refID != string.Empty
                    if (Nodes[a].RefId.Length > 0)
                    {
                        RefNodes.Add(Nodes[a]);
                    }
                    else if (Lookup.Contains(Nodes[a].Id) == false)
                    {
                        Lookup.Add(Nodes[a].Id, a);
                    }
                    else
                    {
                        throw new nBrowser.Exception("Duplicate ID found \"" + Nodes[a].Id + "\"");
                    }
                }
                else
                {
                    //fxcop sugguested this was faster then
                    //Nodes[a].refID != string.Empty
                    if (Nodes[a].RefId.Length > 0)
                    {
                        RefNodes.Add(Nodes[a]);
                    }
                    else if (DefaultLookup.Contains(Nodes[a].Id) == false)
                    {
                        DefaultLookup.Add(Nodes[a].Id, a);
                    }
                    else
                    {
                        throw new nBrowser.Exception("Duplicate ID found \"" + Nodes[a].Id + "\"");
                    }
                }
            }
        }
Exemple #27
0
 public BillPeriods()
 {
     InitializeComponent();
     FirstControl = TextBoxPeriodName;
     ControlsArray.Add(TextBoxPeriodName, new ControlsTab {
         Prev = TextBoxComments, Next = TextBoxCountOfMonth, Type = ControlsType.TextBoxText
     });
     ControlsArray.Add(TextBoxCountOfMonth, new ControlsTab {
         Prev = TextBoxPeriodName, Next = RadioYes, Type = ControlsType.TextBoxNumber
     });
     ControlsArray.Add(RadioYes, new ControlsTab {
         Prev = TextBoxCountOfMonth, Next = RadioNo, Type = ControlsType.RadioButton
     });
     ControlsArray.Add(RadioNo, new ControlsTab {
         Prev = RadioYes, Next = TextBoxComments, Type = ControlsType.RadioButton
     });
     ControlsArray.Add(TextBoxComments, new ControlsTab {
         Prev = RadioNo, Next = null, Type = ControlsType.RadioButton
     });
 }
        /// <summary>
        /// Changes the item ID.
        /// </summary>
        /// <param name="fromItemId">From item id.</param>
        /// <param name="fromUnitId">From unit id.</param>
        /// <param name="toItemId">To item id.</param>
        /// <param name="toUnitId">To unit id.</param>
        /// <returns></returns>
        public static String ChangeItemID(int fromItemId, int fromUnitId, int toItemId, int toUnitId)
        {
            System.Collections.Specialized.ListDictionary Parms = new System.Collections.Specialized.ListDictionary();
            Parms.Add("@toItemID", toItemId);
            Parms.Add("@fromitemID",fromItemId);
            Parms.Add("@fromUnitID",fromUnitId);
            Parms.Add("@toUnitID" ,toUnitId);

            try
            {
                Item items = new Item();
                items.LoadFromSql("procChangeItemID", Parms);
                //return items.DataRow.ItemArray[0].ToString();
                return "Successful";
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }
        public async Task<bool> SendForgottenPwdEmail(string strTo, string newPassword)
        {
            System.Collections.Specialized.ListDictionary replacements = new System.Collections.Specialized.ListDictionary();
            ForgottenPwdMailConfig config = MailConfigProvider.GetConfiguration<ForgottenPwdMailConfig>();
            replacements.Add("<%Password%>", newPassword);

            DisciturMailDef<ForgottenPwdMailConfig> md = new DisciturMailDef<ForgottenPwdMailConfig>(replacements);
            MailMessage mm = md.CreateMailMessage(strTo);

            return await this.SendEmail(mm, config.From, null);
        }
Exemple #30
0
        public async Task <bool> SendForgottenPwdEmail(string strTo, string newPassword)
        {
            System.Collections.Specialized.ListDictionary replacements = new System.Collections.Specialized.ListDictionary();
            ForgottenPwdMailConfig config = MailConfigProvider.GetConfiguration <ForgottenPwdMailConfig>();

            replacements.Add("<%Password%>", newPassword);

            DisciturMailDef <ForgottenPwdMailConfig> md = new DisciturMailDef <ForgottenPwdMailConfig>(replacements);
            MailMessage mm = md.CreateMailMessage(strTo);

            return(await this.SendEmail(mm, config.From, null));
        }
        static void Main(string[] args)
        {
            // Creates and initializes a new ListDictionary.
            System.Collections.Specialized.ListDictionary listDictionary = new System.Collections.Specialized.ListDictionary();
            listDictionary.Add("Test1", "Test@123");
            listDictionary.Add("Admin", "Admin@123");
            listDictionary.Add("Temp", "Temp@123");
            listDictionary.Add("Demo", "Demo@123");
            listDictionary.Add("Test2", "Test2@123");
            listDictionary.Remove("Admin");
            if (listDictionary.Contains("Admin"))
            {
                Console.WriteLine("UserName already Esists");
            }
            else
            {
                listDictionary.Add("Admin", "Admin@123");
                Console.WriteLine("User added succesfully.");
            }

            // Get a collection of the keys.
            Console.WriteLine("UserName" + ": " + "Password");
            foreach (DictionaryEntry entry in listDictionary)
            {
                Console.WriteLine(entry.Key + ": " + entry.Value);
            }
            Console.ReadKey();
        }
Exemple #32
0
        public DebtorsReport()
        {
            InitializeComponent();
            FirstControl = TextBoxSubScriptionIdFrom;
            ControlsArray.Add(TextBoxSubScriptionIdFrom, new ControlsTab {
                Prev = DataGridView, Next = TextBoxSubScriptionIdTo, Type = ControlsType.TextBoxText
            });
            ControlsArray.Add(TextBoxSubScriptionIdTo, new ControlsTab {
                Prev = TextBoxSubScriptionIdFrom, Next = TextBoxPayableFrom, Type = ControlsType.TextBoxText
            });

            ControlsArray.Add(TextBoxPayableFrom, new ControlsTab {
                Prev = TextBoxSubScriptionIdTo, Next = TextBoxPayableTo, Type = ControlsType.TextBoxNumber
            });
            ControlsArray.Add(TextBoxPayableTo, new ControlsTab {
                Prev = TextBoxPayableFrom, Next = ButtonBeginSearch, Type = ControlsType.TextBoxNumber
            });

            ControlsArray.Add(ButtonBeginSearch, new ControlsTab {
                Prev = TextBoxPayableTo, Next = DataGridView, Type = ControlsType.TextBoxText
            });

            ControlsArray.Add(DataGridView, new ControlsTab {
                Prev = TextBoxPayableTo, Next = null, Type = ControlsType.TextBoxText
            });
        }
Exemple #33
0
        public BillsCancelling()
        {
            InitializeComponent();
            FirstControl = TextBoxSubScriptionId;
            ControlsArraySubScriptionId.Add(TextBoxSubScriptionId, new ControlsTab {
                Prev = null, Next = null, Type = ControlsType.TextBoxText
            });

            ControlsArray.Add(TextBoxSubScriptionId, new ControlsTab {
                Prev = null, Next = null, Type = ControlsType.TextBoxText
            });

            FirstControlSearch = RadioSearchBySubCode;
            ControlsArraySearch.Add(RadioSearchBySubCode, new ControlsTab {
                Prev = TextBoxSearch, Next = RadioSearchByCode, Type = ControlsType.RadioButton
            });
            ControlsArraySearch.Add(RadioSearchByCode, new ControlsTab {
                Prev = RadioSearchBySubCode, Next = TextBoxSearch, Type = ControlsType.RadioButton
            });
            ControlsArraySearch.Add(TextBoxSearch, new ControlsTab {
                Prev = RadioSearchByCode, Next = null, Type = ControlsType.TextBoxText
            });
        }
Exemple #34
0
        public ListaMessaggiUC()
        {
            InitializeComponent();

            System.Collections.IDictionary args = new System.Collections.Specialized.ListDictionary();
            args.Add("currentUser", Login.Instance.CurrentLogin().LoginName);

            var prop = new CustomControlProperties
            {
                AllowUpdate = DefaultableBoolean.True,
                AllowDelete = DefaultableBoolean.True
            };
            lista.Tag = prop;

            var propVerifica = new CustomControlProperties { AlwaysEnable = true };
            btnElaboraInfoMessaggi.Tag = propVerifica;
        }
Exemple #35
0
        public static void CreateRemoteChannel(string NewChannelName)
        {
            ChannelManager.RemoteChannel = NewChannelName;

            //Create the channel if it doesn't exist
            if (ChannelManager.DoesChannelExist(ChannelManager.RemoteChannel) == false)
            {
                System.Collections.Specialized.ListDictionary ChannelProperties = new System.Collections.Specialized.ListDictionary();
                ChannelProperties.Add("name", ChannelManager.RemoteChannel);
                HttpChannel chnl = new HttpChannel(ChannelProperties, new SoapClientFormatterSinkProvider(), new SoapServerFormatterSinkProvider());
                ChannelServices.RegisterChannel(chnl);
            }

            //Throw a fatal exception if the channel was not created
            if (ChannelManager.DoesChannelExist(ChannelManager.RemoteChannel) == false)
            {
                throw new Exception(String.Format("Created the channel '{0}', but it didn't show up as a registered channel", ChannelManager.LocalUri));
            }
        }
        public static bool SendContactFormMail(USNContactFormViewModel model, string mailTo, string websiteName, string pageName, out string lsErrorMessage)
        {
            lsErrorMessage = String.Empty;

            try
            {
                //Create MailDefinition
                MailDefinition md       = new MailDefinition();
                string         lsSendTo = String.Empty;

                //specify the location of template
                md.BodyFileName = "/usn/emailtemplates/contactform.htm";
                md.IsBodyHtml   = true;

                //Build replacement collection to replace fields in template
                System.Collections.Specialized.ListDictionary replacements = new System.Collections.Specialized.ListDictionary();
                replacements.Add("<% formFirstName %>", model.FirstName == null ? "" : model.FirstName);
                replacements.Add("<% formLastName %>", model.LastName == null ? "" : model.LastName);
                replacements.Add("<% formEmail %>", model.Email == null ? "" : model.Email);
                replacements.Add("<% formPhone %>", model.Telephone == null ? "" : model.Telephone);
                replacements.Add("<% formMessage %>", model.Message == null ? "" : umbraco.library.ReplaceLineBreaks(model.Message));
                replacements.Add("<% WebsitePage %>", pageName);
                replacements.Add("<% WebsiteName %>", websiteName);

                lsSendTo = mailTo;

                //now create mail message using the mail definition object
                System.Net.Mail.MailMessage msg = md.CreateMailMessage(lsSendTo, replacements, new System.Web.UI.Control());
                msg.ReplyToList.Add(model.Email);
                msg.Subject = websiteName + " Website: " + pageName + " Page Enquiry";

                //this uses SmtpClient in 2.0 to send email, this can be configured in web.config file.
                System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
                smtp.Send(msg);

                return(true);
            }
            catch (Exception ex)
            {
                lsErrorMessage = ex.Message;
            }

            return(false);
        }
        /// <summary>
        /// Set things in motion so your service can do its work.
        /// </summary>
        protected override void OnStart(string[] args)
        {
            if (mediaServer != null) this.OnStop();
            mediaServer = new MediaServerCore("Intel's Media Server (" + System.Windows.Forms.SystemInformation.ComputerName + ")");

            System.Collections.Specialized.ListDictionary channelProperties = new System.Collections.Specialized.ListDictionary();
            channelProperties.Add("port", 12329);

            HttpChannel channel = new HttpChannel(channelProperties,
                new SoapClientFormatterSinkProvider(),
                new SoapServerFormatterSinkProvider());

            //channel = new TcpChannel(12329);
            ChannelServices.RegisterChannel(channel);

            RemotingConfiguration.ApplicationName = "IntelUPnPMediaServer";
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(UPnPMediaServer),
                "UPnPMediaServer.soap",
                WellKnownObjectMode.Singleton);
        }
Exemple #38
0
        static void Main(string[] args)
        {

            try
            {




                //http://www.microsoftvirtualacademy.com/Content/ViewContent.aspx?et=7684&m=7669&ct=27111

                Console.WriteLine("Hello World");



                //**********************************************************************************************************************


                // String code
                string myString = "This is a test strong for c:\\drive";
                // must use double \\ for \
                Console.WriteLine(myString);
                // What about double quotation marks?
                string myString3 = "This is a double quote \" ";
                Console.WriteLine(myString3);
                // New line: use \n
                // List of special characters http://is.gd/escape_sequence

                // Remember strings allow substituting in variables
                string myString4 = string.Format("Make :{0} ", "Cat");

                // Can also format output - Currency format
                string myString5 = string.Format("{0:C}", 123.456);
                Console.WriteLine(myString5);

                // Currency - C, Number of digits - N, Percentage - P
                // Can build your own format {0:(###) ###-####} where the # represent the numbers in the sequence
                // http://is.gd/string_format

                // Can also use + operator mystring  +=

                // Instead of using string use stringbuilder. Uses less memory and is faster

                StringBuilder myString6 = new StringBuilder();

                for (int i = 0; i < 100; i++)
                {
                    myString6.Append("--");
                    myString6.Append(i);

                }

                Console.WriteLine(myString6);

                //various strong functions
                myString5.Substring(2, 4);
                myString5.ToUpper();
                myString5.Replace(" ", "--");
                int test = myString5.Length;
                //trim off white
                myString5.Trim();
                //Can chain commands 
                int test2 = myString5.Trim().Length;
                // Strong class hsa lots of methods. Its worth learning them.

                // text reading code
                StreamReader myReader = new StreamReader("Values.txt");
                string line = "";

                while (line != null)
                {
                    line = myReader.ReadLine();
                    if (line != null)
                        Console.WriteLine(line);

                }

                myReader.Close();

                //**********************************************************************************************************************


                //Reference assembles
                //Right click project name
                //	Assembly
                //o	Framework
                //o	Browse, browse
                //o	Goto dll
                //	Recheck reference list in solution explorer
                //	Can now use its classes but might need to include the namespace



                //**********************************************************************************************************************


                //Dates and Times

                DateTime myValue = DateTime.Now;
                Console.WriteLine(myValue);
                Console.WriteLine(myValue.ToString()); //same as above
                Console.WriteLine(myValue.ToShortDateString());
                Console.WriteLine(myValue.ToShortTimeString());
                Console.WriteLine(myValue.ToLongDateString());

                // Date math
                DateTime myValue2 = myValue.AddDays(3);
                Console.WriteLine(myValue2);
                // add includes days months years hours minutes etc
                // Can chain link calls like with strings
                Console.WriteLine(myValue2.AddYears(5).ToShortDateString());
                // Just give me the month
                Console.WriteLine(myValue2.Month);
                //Give me day of the week
                Console.WriteLine(myValue2.DayOfWeek);

                //Date constructor
                DateTime myBirthday = new DateTime(1969, 12, 7);

                //Date differences
                TimeSpan MyAge = DateTime.Now.Subtract(myBirthday);
                Console.WriteLine(MyAge);



                //**********************************************************************************************************************

                //Classes
                // See outside this block to see car class




                //Class enhancements
                // Static
                //Only one instance. Does not need to be instantiated.

                //Virtual
                //Can be overwritten by child implementation. But doesn’t have to be.

                //Abstract
                //Must be overwritten by child implementation. Does not provide functionality but instead serves as a placeholder/template to guide child class design.

                //Public
                //MoM can be viewed by external users of the class

                //Private
                //A MoM describe as private can be used in this class but not is visible to outside users of the class. Used for helper functions.

                //Override
                //Overrides the method or member of the parent class with a method or member preferred in the child class.

                //Void
                //No return type expected.

                //Interface
                //Life an abstract class. But child can inherit multiple interfaces.

                //Sealed
                //No children are allowed





                Car myNewCar = new Car();

                //setting properties
                myNewCar.Make = "toyota";
                myNewCar.Model = "Corola";
                myNewCar.Year = 1971;
                myNewCar.Color = "White";

                //getting property
                Console.WriteLine(myNewCar.Make);

                Console.WriteLine(myNewCar.DetermineMarketValue());



                // Shorthand class set up and putting values into members
                // Object initaliser syntax:
                Car car1 = new Car() { Make = "fast", Model = "red", Color = "blue", Year = 1990 };



                //Static classes dont require instantiation
                MyStatic.Year = 7;

                Console.WriteLine(MyStatic.Year);

                //Here in bike that inherits from vehicle
                bike MyBike = new bike();
                MyBike.size = 7;

                //Can instantiate abstract classes
                //tool mytool = new tool();
                // but can instantiate an object of a class that inherits from the abstract class
                hammer myhammer = new hammer();
                myhammer.weight = 78;





                //**********************************************************************************************************************

                //Call in  procedure
                string myLine = superSecretFormula();




                // double tab for code snippet

                //**********************************************************************************************************************

                Superhero myHero = Superhero.batman;

                // can use tab tab to speed up switch statements and then enter enter after chossing my hero


                string uservalue = "robin";

                Superhero myvalue;



                //tryparse trys to conver uservalue to type superhero and if so puts that value into myvalue
                if (Enum.TryParse<Superhero>(uservalue, true, out myvalue))
                {
                    switch (myvalue)
                    {
                        case Superhero.batman:
                            Console.WriteLine("batman");
                            break;
                        case Superhero.robin:
                            Console.WriteLine("robin");
                            Console.WriteLine(myvalue);
                            break;
                        case Superhero.superman:
                            Console.WriteLine("superman");
                            break;
                        default:
                            break;
                    }
                }


                //**********************************************************************************************************************

                // Collections

                //Old school collections are not strongly typed. So you can dump any sort of class in them

                //old array definition
                string[] banes = { "bob", "jane" };


                //Arraylist
                System.Collections.ArrayList myArrayList = new System.Collections.ArrayList();

                myArrayList.Add(myhammer);
                myArrayList.Add(MyBike);
                myArrayList.Add(myNewCar);

                //Have to cast the output object o to type car. This works fine when it is a car but not when something else = crash
                //foreach (object o in myArrayList)
                //{
                //    Console.WriteLine(((Car)o).Make);

                //}

                //Dictionary is like a list but you put an index item at the front to make it easy to find

                System.Collections.Specialized.ListDictionary myDictionary = new System.Collections.Specialized.ListDictionary();


                myDictionary.Add(myNewCar.Make, myNewCar);




                //New school collections have strongly typed collection objects. This limits what you can put in the array
                // The type os the collection is between angle brackets
                // comes form using systems.collections.generic

                // Generic list

                List<Car> myList = new List<Car>();

                myList.Add(myNewCar);

                foreach (Car car in myList)
                {
                    Console.WriteLine(car.Model);
                }



                //Generic dictionary

                Dictionary<string, Car> myDictionary3 = new Dictionary<string, Car>();


                myDictionary3.Add(myNewCar.Make, myNewCar);
                Console.WriteLine(myDictionary3["toyota"].Model);
                

                // You can use initialiser syntax also in collections
                List<Car> myList2 = new List<Car>(){
                    new Car {Make = "fast", Model = "red"},
                    new Car {Make = "fast2", Model = "red3231"},
                    new Car {Make = "fast3", Model = "red2"}
                };



                //**********************************************************************************************************************

                // For loops
                for (int i = 0; i < 11; i++)
                {

                }


                for (int k = 0; k < 12; k++)
                {

                }


                // While loops
                int w = 0;
                while (w < 12)
                {
                    w++;
                }

                //**********************************************************************************************************************
                // Switch statement

                int answer = 6;

                switch (answer)
                {
                    case 1:
                        Console.WriteLine("answered 1");
                        break;
                    case 2:
                        Console.WriteLine("answered 2");
                        break;
                    case 6:
                        Console.WriteLine("answered 6");
                        break;
                    default:
                        break;
                }


             //**********************************************************************************************************************



                //Dont use cout, using console class
                Console.WriteLine(myLine);
                Console.WriteLine(superSecretFormula2("Jack"));
                Console.ReadLine();

                //**********************************************************************************************************************
                // Error handling
                
                // Look at the class at the far right of new creation. This lists common exception throws
                // Can put them below in your exception check list
                // need also a finally to tidy up erros anddata conections

                // error handling especially important in dealing with external resources
                // deal with most detailed exceptions first before defaulting to more general exception clauses
                // Dont bother the user if you dont have to



            }
            catch (DirectoryNotFoundException e)
            {
                Console.WriteLine("Coulnd find directory");
            }
            catch (FileNotFoundException e)
            {
                Console.WriteLine("Coulnd find file");
            }
            catch (Exception e)
            {
                Console.WriteLine(" error found {0} ", e.Message);
            }
            finally
            {
                Console.WriteLine(" clean up");
            
            }


        }
 public DataTable ConsumptionTrendByMonth(int storeId, int year, int programID, BackgroundWorker bw)
 {
     // Dont Iterate
     DataTable dtbl = new DataTable();
     System.Collections.Specialized.ListDictionary ld = new System.Collections.Specialized.ListDictionary();
     ld.Add("@storeid", storeId);
     ld.Add("@year", year);
     this.LoadFromSql("GetConsumptionTrendByMonth", ld, CommandType.StoredProcedure);
     return this.DataTable;
 }
        public DataTable ItemListToIssue(int storeId, DateTime dtCurrent, string selectedType, BackgroundWorker bw)
        {
            var pipline = new GeneralInfo();
            pipline.LoadAll();
            var ld = new System.Collections.Specialized.ListDictionary();
            ld.Add("@storeid", storeId);
            ld.Add("@month", dtCurrent.Month);
            ld.Add("@year", dtCurrent.Year);
            ld.Add("@days", DateTime.DaysInMonth(dtCurrent.Year, dtCurrent.Month));

            this.LoadFromSql("SOH", ld, CommandType.StoredProcedure);

            this.DataTable.Columns.Add("IsSelected", typeof(bool));
            return this.DataTable;
        }
        protected void AddNoActivityButton_Click(object sneder, EventArgs e)
        {
            ExtraActivity activity = new ExtraActivity();
            System.Collections.Specialized.ListDictionary l = new System.Collections.Specialized.ListDictionary();

            l.Add("p_persoon", p_persoon);
            l.Add("omschrijving", activity.description);
            l.Add("locatie", activity.address);

            if(AtpRadioButton.Checked){
                l.Add("type", "ATP");
            }
            else
            {
                l.Add("type", "OP");
            }

            l.Add("ambt", activity.function);
            l.Add("omvang", activity.amount);
            l.Add("startdatum", activity.startDate);
            l.Add("heeftNevenactiviteit", activity.heeftNevenactiviteit);
            l.Add("pa_goedgekeurd", activity.goedgekeurdPA);
            l.Add("dep_goedgekeurd", activity.goedgekeurdDep);
            l.Add("dep_goedkeuring_nodig", activity.heeftDepGoedkeuringNodig);
            LinqDataSource1.Insert(l);
            NoActivitiesPanel.Visible = true;
            for (int i = 0; i < OpNevenActiviteit.Items.Count; i++)
            {
                OpNevenActiviteit.Items[i].Enabled = false;
                AtpNevenActiviteiten.Items[i].Enabled = false;
            }
            _log.Debug("User heeft aangegeven dat er geen nevenactiviteit wordt uitgevoerd");
            AddNoActivityButton.Visible = false;
        }
        public DataTable GetBinCard2(int storeID, int itemID, int year, int unitID)
        {
            var ld = new System.Collections.Specialized.ListDictionary();
            ld.Add("@StoreID", storeID);
            ld.Add("@ItemID", itemID);
            ld.Add("@Year", year);
            ld.Add("@UnitID", unitID);

            LoadFromSql("rpt_BincardByUnit", ld, CommandType.StoredProcedure);
            //return this.DataTable;
            // Set the balance
            int balance = (int)GetBeginningBalance(year, itemID, storeID);
            while (!EOF)
            {
                balance += Convert.ToInt32(GetColumn("Balance"));
                SetColumn("Balance", balance);
                MoveNext();
            }

            return this.DataTable;
        }
        /* REIMPLIMENTATION OF getTableDescription using sp_MS procedures */
        public override FieldDescriptor[] getTableDescription(string table)
        {
            try
            {
                System.Collections.Specialized.ListDictionary al = new System.Collections.Specialized.ListDictionary();
                System.Data.Odbc.OdbcDataReader odr = this._dbObj.getNewConnection().GetDatabaseConnector().getResult(String.Format("sp_MShelpcolumns '{0}'", this._dbObj.GetDatabaseConnector().DoTopLevelSqlTranslations(ref table)));

                Database iterationWorker = this._dbObj.getNewConnection();
                while (odr.Read())
                {
                    string fieldname = Convert.ToString(odr["col_name"]);
                    string fieldTypeStr = Convert.ToString(odr["col_typename"]);
                    int fieldMaxLen = Convert.ToInt32(odr["col_len"]);
                    string fieldAllowNull = Convert.ToString(odr["col_null"]); //0 = no, 1 = nullable
                    string isIdentity = Convert.ToString(odr["col_identity"]);
                    string isPrimaryKey = (this.isPKCol(this._dbObj.GetDatabaseConnector().DoTopLevelSqlTranslations(ref table),fieldname) == true) ? "True" : "False";
                    FieldDescriptor fd = new FieldDescriptor();
                    fd.name = fieldname;
                    fd.type = this.typeStrToField(fieldTypeStr).type;

                    fd.maxlen = fieldMaxLen;
                    System.Collections.ArrayList modList = new System.Collections.ArrayList();
                    if (fieldAllowNull.ToLower().Equals("false"))
                        modList.Add(ABSTRACTFIELDMODIFIERS.NotNull);
                    if (isPrimaryKey.ToLower().Equals("true"))
                        modList.Add(ABSTRACTFIELDMODIFIERS.PrimaryKey);
                    if (isIdentity.ToLower().Equals("true"))
                        modList.Add(ABSTRACTFIELDMODIFIERS.AutoIncrement);

                    fd.modifiers = new ABSTRACTFIELDMODIFIERS[modList.Count];
                    Array.Copy(modList.ToArray(), fd.modifiers, modList.Count);
                    //fd.defaultval = fieldDefaultVal;
                    al.Add(fd.name, fd);
                }

                odr = null;

                //odr.Close();
                FieldDescriptor[] returnArray = new FieldDescriptor[al.Count];
                //Array.Copy(al.Values., returnArray, al.Count);

                al.Values.CopyTo(returnArray, 0);
                if (returnArray.Length == 0) return null;
                //Array.Reverse(returnArray);

                return returnArray;
            }
            catch(Exception e)
            {
                System.Diagnostics.Debug.Print(e.Message);
            }
            return null;
        }
        public DataTable GetSOHByPrograms(int storeId, int programid, int month, int year)
        {
            var days = DateTime.DaysInMonth(year, month);
            var ld = new System.Collections.Specialized.ListDictionary();
            ld.Add("@storeid", storeId);
            ld.Add("@progID", programid);
            ld.Add("@month", month);
            ld.Add("@year", year);
            ld.Add("@days", days);
            this.LoadFromSql("SOHByPrograms", ld, CommandType.StoredProcedure);
            //TODO: filter out by commodity type here.

            return this.DataTable;
        }
        protected void AddAtpActivityButton_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                DateTime start = AtpStartDate.SelectedDate.GetValueOrDefault();
                ExtraActivity activity = new ExtraActivity(AtpAardActiviteit.Text, AtpAdresActiviteit.Text, AtpOmvangActiviteit.Text, startDate: start);

                System.Collections.Specialized.ListDictionary l = new System.Collections.Specialized.ListDictionary();
                l.Add("p_persoon", p_persoon);
                l.Add("omschrijving", activity.description);
                l.Add("locatie", activity.address);
                if (OpRadioButton.Checked)
                {
                    l.Add("type", "OP");
                }
                else
                {
                    l.Add("type", "ATP");
                }

                l.Add("ambt", activity.function);
                l.Add("omvang", activity.amount);
                l.Add("startdatum", activity.startDate);
                l.Add("heeftNevenactiviteit", true);
                l.Add("pa_goedgekeurd", false);
                l.Add("dep_goedgekeurd", false);
                l.Add("dep_goedkeuring_nodig", false);

                LinqDataSource1.Insert(l);
                _log.Info("ATP Nevenactiviteit toegevoegd");
                AtpNevenActiviteiten.Items[0].Enabled = false;
            }
        }
        public DataTable GetSOHToDate(int storeId, DateTime dt)
        {
            GeneralInfo pipline = new GeneralInfo();
            pipline.LoadAll();

            System.Collections.Specialized.ListDictionary ld = new System.Collections.Specialized.ListDictionary();
            ld.Add("@storeid", storeId);
            ld.Add("@date1", dt);

            ld.Add("@amcrange", pipline.AMCRange);
            ld.Add("@min", pipline.Min);
            ld.Add("@max", pipline.Max);
            ld.Add("@eop", pipline.EOP);

            //this.LoadFromSqlNoExec("SOH", ld);
            this.LoadFromSql("SOHByDate", ld, CommandType.StoredProcedure);
            return this.DataTable;
        }
        public MainForm(string[] args)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            OpenSource.UPnP.DText p = new OpenSource.UPnP.DText();
            p.ATTRMARK = "=";
            string[] filePaths = new string[1];

            foreach(string arg in args)
            {
                p[0] = arg;
                switch(p[1].ToUpper())
                {
                    case "-UDN":
                        MediaServerCore.CustomUDN = p[2];
                        break;
                    case "-CACHETIME":
                        MediaServerCore.CacheTime = int.Parse(p[2]);
                        break;
                    case "-INMPR":
                        MediaServerCore.INMPR = !(p[2].ToUpper()=="NO");
                        break;
                }
            }

            // Setup the UI
            transfersSplitter.Visible = viewTransfersPanelMenuItem.Checked;
            transfersListView.Visible = viewTransfersPanelMenuItem.Checked;

            try
            {
                serviceController = new ServiceController("UPnP Media Server");
                serviceStatus = serviceController.Status;
                OpenSource.Utilities.EventLogger.Log(this,System.Diagnostics.EventLogEntryType.Information,"Service control mode...");
            }
            catch (System.InvalidOperationException)
            {
                serviceController = null;
                serviceStatus = ServiceControllerStatus.Stopped;
                OpenSource.Utilities.EventLogger.Log(this,System.Diagnostics.EventLogEntryType.Information,"Stand alone mode...");
            }

            if (serviceController != null)
            {
                // Service controller mode
                serviceMenuItem.Visible = true;

                // Pause State
                pauseServerMenuItem.Visible = false;

                System.Collections.Specialized.ListDictionary channelProperties = new System.Collections.Specialized.ListDictionary();
                channelProperties.Add("port", 12330);
                HttpChannel channel = new HttpChannel(channelProperties,
                    new SoapClientFormatterSinkProvider(),
                    new SoapServerFormatterSinkProvider());
                ChannelServices.RegisterChannel(channel, false);
                OpenSource.Utilities.EventLogger.Log(this,System.Diagnostics.EventLogEntryType.Information,"RegisterChannel");

                if (serviceStatus == ServiceControllerStatus.Running)
                {
                    OpenSource.Utilities.EventLogger.Log(this,System.Diagnostics.EventLogEntryType.Information,"RegisterWellKnownClientType");
                    RemotingConfiguration.RegisterWellKnownClientType(
                        typeof(UPnPMediaServer),
                        "http://localhost:12329/UPnPMediaServer/UPnPMediaServer.soap"
                        );
                    registeredServerType = true;
                }
            }
            else
            {
                // Stand alone mode
                if (registeredServerType == true || standAloneMode == true) return;

                standAloneMode = true;
                serviceMenuItem.Visible = false;

                // Stand alone mode
                mediaServerCore = new MediaServerCore("Media Server (" + System.Windows.Forms.SystemInformation.ComputerName + ")");
                this.mediaServerCore.OnDirectoriesChanged += new MediaServerCore.MediaServerCoreEventHandler(this.Sink_OnDirectoriesChanged);
                mediaServer = new UPnPMediaServer();

                // Pause State
                pauseServerMenuItem.Checked = this.mediaServerCore.IsPaused;
            }

            UpdateServiceUI();

            foreach(string arg in args)
            {
                p[0] = arg;
                switch(p[1].ToUpper())
                {
                    case "-P":
                        filePaths[0] = p[2];
                        try
                        {
                            this.AddDirs(filePaths);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                        break;
                }
            }
        }
 /// <summary>
 /// Returns the beginning balance of a certain item inside a certain store (Uses a stored proc on the backend)
 /// </summary>
 /// <param name="storeID"></param>
 /// <param name="itemID"></param>
 /// <returns></returns>
 public Int64 GetBeginningBalance(int storeID, int itemID)
 {
     this.FlushData();
     System.Collections.Specialized.ListDictionary ld = new System.Collections.Specialized.ListDictionary();
     ld.Add("@StoreID", storeID);
     ld.Add("@ItemID", itemID);
     this.LoadFromSql("rpt_BeginningBalance", ld, CommandType.StoredProcedure);
     if (this.RowCount > 0)
     {
         return Convert.ToInt64(this.DataTable.Rows[0][0]);
     }
     else
         return 0;
 }
        public DataTable ConsumptionByUnit(int storeId, int year, int programID, BackgroundWorker bw)
        {
            // Dont Iterate
            DataTable dtbl = new DataTable();
            //if (programID == 0) //We don't filter by program ID.
            //{
            System.Collections.Specialized.ListDictionary ld = new System.Collections.Specialized.ListDictionary();
            ld.Add("@storeid", storeId);
            ld.Add("@year", year);

            ////this.LoadFromSqlNoExec("SOH", ld);
            this.LoadFromSql("GetMonthlyConsumptionByUnits", ld, CommandType.StoredProcedure);
            return this.DataTable;
        }
Exemple #50
0
        /// <summary>
        /// ��Hashtable���ݽṹ����������ҵ��Ϣģ����Ϣ���������ѹر�ģ�飩
        /// </summary>
        /// <returns></returns>
        protected System.Collections.Specialized.ListDictionary GetAllInfoModules()
        {
            System.Collections.Specialized.ListDictionary list = new System.Collections.Specialized.ListDictionary();

            foreach (XYECOM.Configuration.ModuleInfo info in moduleConfig.ModuleItems)
            {
                if (info.State == false) continue;
                list.Add(info.EName, info.CName);
            }

            return list;
        }
 public DataTable TransactionReport(int storeId, DateTime dt1, DateTime dt2, string selectedType, BackgroundWorker bw)
 {
     System.Collections.Specialized.ListDictionary ld = new System.Collections.Specialized.ListDictionary();
     ld.Add("@storeid", storeId);
     ld.Add("@fromdate", dt1);
     ld.Add("@todate", dt2);
     this.LoadFromSql("GetTransactionDetails", ld, CommandType.StoredProcedure);
     return this.DataTable;
 }
        public override void LoadData(XmlNode node)
        {
            if (node == null)
                throw new ArgumentNullException ("node");

            if (node.Name != GroupName)
                throw new FormatException (String.Format ("Expecting <{0}>", GroupName));

            keys = new System.Collections.Specialized.ListDictionary ();
            foreach (XmlNode n in node.ChildNodes) {
                string name = n.Attributes ["name"].Value;
                if (CheckIfAdd (name, n)) {
                    string key = GetNodeKey (name, n);
                    if (keys.Contains (key)) {
                        if ((string) keys[key] != name)
                            throw new NotImplementedException ("Attribute with same name but diffent value");
                    } else {
                        keys.Add (key, name);
                    }

                    LoadExtraData (key, n);
                }
            }
        }
Exemple #53
0
		private void Load(System.Xml.XmlDocument BrowserFile)
		{
			Lookup = new System.Collections.Specialized.ListDictionary();
			DefaultLookup = new System.Collections.Specialized.ListDictionary();
			RefNodes = new List<Node>();
			System.Xml.XmlNode node;
			//I know this might allocate more nodes then needed but never less.
			Nodes = new Node[BrowserFile.DocumentElement.ChildNodes.Count];
			for (int a = 0;a <= BrowserFile.DocumentElement.ChildNodes.Count - 1;a++)
			{
				node = BrowserFile.DocumentElement.ChildNodes[a];

				if (node.NodeType == System.Xml.XmlNodeType.Comment)
				{
					continue;
				}
				Nodes[a] = new Node(node);
				Nodes[a].FileName = FileName;
				if (Nodes[a].NameType != NodeType.DefaultBrowser)
				{
					//fxcop sugguested this was faster then
					//Nodes[a].refID != string.Empty
					if (Nodes[a].RefId.Length > 0)
					{
						RefNodes.Add(Nodes[a]);
					}
					else if (Lookup.Contains(Nodes[a].Id) == false)
					{
						Lookup.Add(Nodes[a].Id, a);
					}
					else
					{
						throw new nBrowser.Exception("Duplicate ID found \"" + Nodes[a].Id + "\"");
					}
				}
				else
				{
					//fxcop sugguested this was faster then
					//Nodes[a].refID != string.Empty
					if (Nodes[a].RefId.Length > 0)
					{
						RefNodes.Add(Nodes[a]);
					}
					else if (DefaultLookup.Contains(Nodes[a].Id) == false)
					{
						DefaultLookup.Add(Nodes[a].Id, a);
					}
					else
					{
						throw new nBrowser.Exception("Duplicate ID found \"" + Nodes[a].Id + "\"");
					}
				}
			}
		}
Exemple #54
0
		public override void LoadData (XmlNode node)
		{
			if (node == null)
				throw new ArgumentNullException ("node");

			if (node.Name != GroupName)
				throw new FormatException (String.Format ("Expecting <{0}>", GroupName));

			keys = new System.Collections.Specialized.ListDictionary ();
			foreach (XmlNode n in node.ChildNodes) {
				string name = n.Attributes["name"].Value;
				string key = GetNodeKey (name, n);
				XMLParameter parm = new XMLParameter ();
				parm.LoadData (n);
				keys.Add (key, parm);
				LoadExtraData (key, n);
			}
		}
        public static int GetNextSequenceNo(int documentTypeId, int accountId, int fiscalYearId)
        {
            int sequenceNo;
            System.Collections.Specialized.ListDictionary Parms = new System.Collections.Specialized.ListDictionary();
            Parms.Add("@DocumentTypeID", documentTypeId);
            Parms.Add("@AccountID", accountId);
            Parms.Add("@FiscalYearID", fiscalYearId);
            Parms.Add("@SequenceNo", 0);

            DocumentType documentType = new DocumentType();
            documentType.LoadFromSql("[sp_GetNextSequence]", Parms, CommandType.StoredProcedure);
            sequenceNo = documentType.Getint("SequenceNo");
            return sequenceNo;
        }
        static void Main(string[] args)
        {
            Car car1 = new Car();
            car1.Make = "Oldsmobile";
            car1.Model = "Cutlas Supreme";

            Car car2 = new Car();
            car2.Make = "Geo";
            car2.Model = "Prism";

            Book book1 = new Book();
            book1.Author = "Robert Tabor";
            book1.Title = "Microsoft .NET XML Web Services";
            book1.ISBN = "0-000-00000-0";

            // ArrayLists are dynamically sized, and support other
            // cool features like sorting, removing items, etc.

            System.Collections.ArrayList myArrayList = new System.Collections.ArrayList();
            myArrayList.Add(car1);
            myArrayList.Add(car2);
            myArrayList.Add(book1);
            myArrayList.Remove(book1); // if not remove the book we get a error in foreach

            foreach (object o in myArrayList)
            {
                Console.WriteLine(((Car)o).Make);
            }

            Console.WriteLine("---------------------------------------------------------");

            // Dictionaries allow you to save a key along with
            // the value, and also support cool features.
            // There are different dictionaries to choose from ...

            System.Collections.Specialized.ListDictionary myDictionary
                = new System.Collections.Specialized.ListDictionary();
            myDictionary.Add(car1.Make, car1);
            myDictionary.Add(car2.Make, car2);
            myDictionary.Add(book1.Author, book1);

            // Easy access to an element using its key
            Console.WriteLine(((Car)myDictionary["Geo"]).Model);

            // But since its not strongly typed, we can easily break it
            // by adding a different type to the dictionary ...
            // Obviously, I'm trying to retrieve a book here, and then get its ... model?
            // Console.WriteLine(((Car)myDictionary["Robert Tabor"]).Model); <-- Error

            Console.WriteLine("---------------------------------------------------------");

            List<Car> myList = new List<Car>();
            myList.Add(car1);
            myList.Add(car2);
            // myList.Add(book1); <-- error

            foreach (Car car in myList)
            {
                Console.WriteLine(car.Model);
            }

            Console.WriteLine("---------------------------------------------------------");

            Dictionary<string, Car> myDictionary2 = new Dictionary<string, Car>();
            myDictionary2.Add(car1.Make, car1);
            myDictionary2.Add(car2.Make, car2);

            Console.WriteLine(myDictionary2["Geo"].Model);

            // instance values on initialization

            string[] names = { "Bob", "Steve", "Brian", "Chuck" };

            Car car3 = new Car() { Make = "Oldsmobile", Model = "Cutlas Supreme" };
            Car car4 = new Car() { Make = "Geo", Model = "Prism" };
            Car car5 = new Car() { Make = "Nissan", Model = "Altima" };

            List<Car> myList2 = new List<Car>() {
                new Car { Make = "Oldsmobile", Model = "Cutlas Supreme"},
                new Car { Make = "Geo", Model="Prism"},
                new Car { Make = "Nissan", Model = "Altima"}
            };

            Console.ReadLine();
        }
        public DataTable GetCurrentSOHAsOfDate(int itemId, int storeId, DateTime date)
        {
            this.FlushData();
            System.Collections.Specialized.ListDictionary ld = new System.Collections.Specialized.ListDictionary();
            ld.Add("@storeid", storeId);
            ld.Add("@month", date.Month);
            ld.Add("@year", date.Year);
            ld.Add("@days", DateTime.DaysInMonth(date.Year, date.Month));

            this.LoadFromSql("SOH", ld, CommandType.StoredProcedure);
            return this.DataTable;
        }
        protected void AddOpActivityButton_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                ExtraActivity activity;
                System.Collections.Specialized.ListDictionary l = new System.Collections.Specialized.ListDictionary();
                if (OpOnderwijsActiviteit.Checked)
                {
                    activity = new ExtraActivity(OpOndNaam.Text, OpOndAdres.Text, OpOndOmvang.Text, OpOndNiveau.SelectedText, OpOndAmbt.Text, OpOndStartDate.SelectedDate.GetValueOrDefault());
                    l.Add("motivatie", OpOndMotivatie.Text);
                    l.Add("type_activiteit_op", "Onderwijs");
                    _log.Debug("Onderwijs nevenactiviteit met motivatie {0}", OpOndMotivatie.Text);
                    EmptyTextBoxes(new List<RadTextBox>() { OpOndNaam, OpOndAdres, OpOndOmvang, OpOndAmbt,OpOndMotivatie});
                    OpOndStartDate.Clear();
                }
                else if (OpPolitiekActiviteit.Checked)
                {
                    activity = new ExtraActivity(OpPolOmschrijving.Text, OpPolAdres.Text, OpPolOmvang.Text, startDate: OpOndStartDate.SelectedDate.GetValueOrDefault() );
                    l.Add("motivatie", OpPolMotivatie.Text);
                    l.Add("type_activiteit_op", "Politiek");
                    _log.Debug("Politieke nevenactiviteit met motivatie {0}", OpPolMotivatie.Text);
                    EmptyTextBoxes(new List<RadTextBox>() { OpPolOmschrijving, OpPolAdres, OpPolOmvang,OpPolMotivatie});
                    OpPolStartDate.Clear();
                }
                else if (OpZelfstandigeActiviteit.Checked)
                {
                    activity = new ExtraActivity(OpZelfOmschrijving.Text, OpZelfAdres.Text, OpZelfOmvang.Text, startDate: OpZelfStartDate.SelectedDate.GetValueOrDefault());
                    l.Add("motivatie", OpZelfMotivatie.Text);
                    l.Add("type_activiteit_op", "Zelfstandig");
                    _log.Debug("Zelfstandige nevenactiviteit met motivatie {0}", OpZelfMotivatie);
                    EmptyTextBoxes(new List<RadTextBox>() { OpZelfOmschrijving, OpZelfAdres, OpZelfOmvang, OpZelfMotivatie });
                    OpZelfStartDate.Clear();
                }
                else
                {
                    activity = new ExtraActivity(OpAndOmschrijving.Text, OpAndAdres.Text, OpAndOmvang.Text, startDate: OpAndStartDate.SelectedDate.GetValueOrDefault());
                    l.Add("motivatie", OpMotivatie.Text);
                    l.Add("type_activiteit_op", "Anders");
                    _log.Debug("Andere nevenactiviteit met motivatie {0}", OpMotivatie.Text);
                    EmptyTextBoxes(new List<RadTextBox>() { OpAndOmschrijving, OpAndAdres, OpAndOmvang,OpMotivatie });
                    OpAndStartDate.Clear();
                }

                _log.Info("ExtraActivity created");
                if (Convert.ToDouble(assignementField.Text) > 70.00)
                {
                    _log.Info("Heeft goedkeuring van departementshoofd nodig");
                    activity.heeftDepGoedkeuringNodig = true;
                }

                l.Add("p_persoon", p_persoon);
                l.Add("omschrijving", activity.description);
                l.Add("locatie", activity.address);
                l.Add("type", "OP");
                l.Add("ambt", activity.function);
                l.Add("omvang", activity.amount);
                l.Add("startdatum", activity.startDate);
                l.Add("dep_goedkeuring_nodig", activity.heeftDepGoedkeuringNodig);
                l.Add("heeftNevenactiviteit", true);
                CumulatieDataContext cumul = new CumulatieDataContext();

                var code = cumul.KDGNEVENACTIVITEITEN_OpledingPerWogs.Where(p => p.OnderwijsGroepNaam.Equals(departmentField.Text)).First();

                l.Add("ow_groep", code.OnderwijsGroepCode);
                LinqDataSource1.Insert(l);
                _log.Debug("Nevenactiviteit voor OP toegevoegd");
                OpNevenActiviteit.Items[0].Enabled = false;
               }
        }
		//[Test]
		// User should uncomment if they want to see the Performance Comparison
		public void Performance() 
		{
			// set the hashtable and SequencedHashMap to be the 
			IDictionary hashtable;
			IDictionary sequenced;
			IDictionary list;

			int numOfRuns = 1;

			int numOfEntries = Int16.MaxValue;

			long hashStart;
			long[] hashPopulateTicks = new long[numOfRuns];
			long[] hashItemTicks = new long[numOfRuns];

			long seqStart;
			long[] seqPopulateTicks = new long[numOfRuns];
			long[] seqItemTicks = new long[numOfRuns];

			long listStart;
			long[] listPopulateTicks = new long[numOfRuns];
			long[] listItemTicks = new long[numOfRuns];

			for (int runIndex = 0; runIndex < numOfRuns; runIndex++) 
			{
				object key;
				object value;
				hashtable = new Hashtable();
				sequenced = new SequencedHashMap();
				list = new System.Collections.Specialized.ListDictionary();

				hashStart = DateTime.Now.Ticks;

				for(int i = 0; i < numOfEntries; i++) 
				{
					hashtable.Add("test" + i, new object());
				}

				hashPopulateTicks[runIndex] = DateTime.Now.Ticks - hashStart;

				hashStart = DateTime.Now.Ticks;
				for(int i = 0; i < numOfEntries; i++) 
				{
					key = "test" + i;
					value = hashtable[key];
				}

				hashItemTicks[runIndex] = DateTime.Now.Ticks - hashStart;

				hashtable.Clear();

				seqStart = DateTime.Now.Ticks;

				for(int i = 0; i < numOfEntries; i++) 
				{
					sequenced.Add("test" + i, new object());
				}

				seqPopulateTicks[runIndex] = DateTime.Now.Ticks - seqStart;

				seqStart = DateTime.Now.Ticks;
				for(int i = 0; i < numOfEntries; i++) 
				{
					key = "test" + i;
					value = sequenced[key];
				}

				seqItemTicks[runIndex] = DateTime.Now.Ticks - seqStart;

				sequenced.Clear();

				listStart = DateTime.Now.Ticks;

				for(int i = 0; i < numOfEntries; i++) 
				{
					list.Add("test" + i, new object());
				}

				listPopulateTicks[runIndex] = DateTime.Now.Ticks - listStart;

				listStart = DateTime.Now.Ticks;
				for(int i = 0; i < numOfEntries; i++) 
				{
					key = "test" + i;
					value = list[key];
				}

				listItemTicks[runIndex] = DateTime.Now.Ticks - listStart;


				list.Clear();

			}
			
			for (int runIndex = 0; runIndex < numOfRuns; runIndex++) 
			{
				decimal seqPopulateOverhead = ( (decimal)seqPopulateTicks[runIndex] /(decimal)hashPopulateTicks[runIndex] );
				decimal seqItemOverhead = ( (decimal)seqItemTicks[runIndex] / (decimal)hashItemTicks[runIndex] );

				string errMessage = "SequenceHashMap vs Hashtable:";
				errMessage += "\n POPULATE:";
				errMessage += "\n\t seqPopulateTicks[" + runIndex + "] took " + seqPopulateTicks[runIndex] + " ticks.";
				errMessage += "\n\t hashPopulateTicks[" + runIndex + "] took " + hashPopulateTicks[runIndex] + " ticks.";
				errMessage += "\n\t for an overhead of " + seqPopulateOverhead .ToString() ;
				errMessage += "\n ITEM:";
				errMessage += "\n\t seqItemTicks[" + runIndex + "] took " + seqItemTicks[runIndex] + " ticks.";
				errMessage += "\n\t hashItemTicks[" + runIndex + "] took " + hashItemTicks[runIndex] + " ticks.";
				errMessage += "\n\t for an overhead of " + seqItemOverhead .ToString() ;
				
				System.Console.Out.WriteLine(errMessage);
				
				decimal listPopulateOverhead = ( (decimal)listPopulateTicks[runIndex] / (decimal)seqPopulateTicks[runIndex] );
				decimal listItemOverhead = ( (decimal)listItemTicks[runIndex] / (decimal)seqItemTicks[runIndex] );

				errMessage = "ListDictionary vs SequenceHashMap:";
				errMessage += "\n POPULATE:";
				errMessage += "\n\t listPopulateTicks[" + runIndex + "] took " + listPopulateTicks[runIndex] + " ticks.";
				errMessage += "\n\t seqPopulateTicks[" + runIndex + "] took " + seqPopulateTicks[runIndex] + " ticks.";
				errMessage += "\n\t for an overhead of " + listPopulateOverhead.ToString();
				errMessage += "\n ITEM:";
				errMessage += "\n\t listItemTicks[" + runIndex + "] took " + listItemTicks[runIndex] + " ticks.";
				errMessage += "\n\t seqItemTicks[" + runIndex + "] took " + seqItemTicks[runIndex] + " ticks.";
				errMessage += "\n\t for an overhead of " + listItemOverhead .ToString() ;
				
				System.Console.Out.WriteLine(errMessage);

			}
		}
        // GetParameters creates a list dictionary
        // consisting of a report parameter name and a value.
        private System.Collections.Specialized.ListDictionary GetParmeters(string parms)
        {
            System.Collections.Specialized.ListDictionary ld = new System.Collections.Specialized.ListDictionary();
            if (parms == null)
            {
                  return ld; // dictionary will be empty in this case
            }

            // parms are separated by &

            char[] breakChars = new char[] {'&'};
            string[] ps = parms.Split(breakChars);

            foreach (string p in ps)
            {
                  int iEq = p.IndexOf("=");
                  if (iEq > 0)
                  {
                        string name = p.Substring(0, iEq);
                        string val = p.Substring(iEq+1);
                        ld.Add(name, val);
                  }
            }
            return ld;
        }