Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ctrl">The Control to find.</param>
        /// <param name="propertyName">The property name to store in settings.</param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        public static BindingProperty <object> GetBindingProperty(Control ctrl, string propertyName, object defaultValue = null)
        {
            if (ctrl == null)
            {
                ArgumentNullException ane = new ArgumentNullException(cNE);
                log.Error(ane.Output());
                throw ane;
            }

            if (propertyName.IsNullOrWhiteSpace())
            {
                ArgumentNullException ane = new ArgumentNullException(pNNE);
                log.Error(ane.Output());
                throw ane;
            }

            var setting = GetUiElement(ctrl);
            var binding = setting.FindBindingProperty(propertyName);

            if (binding == null)
            {
                binding = new BindingProperty <object>()
                {
                    Name = propertyName, Value = defaultValue
                };
                setting.Context.Add(binding);
            }

            return(binding);
        }
Пример #2
0
        /// <summary>
        /// Method to store a string Control property value.
        /// </summary>
        /// <param name="ctrl">The Control.</param>
        /// <param name="propertyName">The property name to store in settings.</param>
        /// <param name="propertyValue">The property value to store in settings.</param>
        /// <returns>The property value stored in settings.</returns>
        public static string SetString(Control ctrl, string propertyName, string propertyValue = default(string))
        {
            if (ctrl == null)
            {
                ArgumentNullException ane = new ArgumentNullException(cNE);
                log.Error(ane.Output());
                throw ane;
            }

            if (propertyName.IsNullOrWhiteSpace())
            {
                ArgumentNullException ane = new ArgumentNullException(pNNE);
                log.Error(ane.Output());
                throw ane;
            }

            BindingProperty <object> bp = GetBindingProperty(ctrl, propertyName, propertyValue);

            bp.Value = propertyValue;

            return((string)bp.Value);
        }
Пример #3
0
        /// <summary>
        /// Method to store an object Control property value.
        /// </summary>
        /// <typeparam name="V">The object Type to store.</typeparam>
        /// <param name="ctrl">The Control.</param>
        /// <param name="propertyName">The property name to store in settings.</param>
        /// <param name="propertyValue">The property value to store in settings.</param>
        /// <returns>The property value stored in settings.</returns>
        public static V SetValue <V>(Control ctrl, string propertyName, V propertyValue = default(V)) where V : class
        {
            if (ctrl == null)
            {
                ArgumentNullException ane = new ArgumentNullException(cNE);
                log.Error(ane.Output());
                throw ane;
            }

            if (propertyName.IsNullOrWhiteSpace())
            {
                ArgumentNullException ane = new ArgumentNullException(pNNE);
                log.Error(ane.Output());
                throw ane;
            }

            BindingProperty <object> bp = GetBindingProperty(ctrl, propertyName, propertyValue);

            bp.Value = propertyValue;

            return(bp.Value as V);
        }
Пример #4
0
 set => SetValue(BindingProperty, value);
        public ItemsChangeObservableCollection <Manager> LoadData()
        {
            BindingProperty = new BindingProperty();
            //Create list of employees and add them under the assigned managers
            Manager manager1 = new Manager()
            {
                ManagerId   = 1,
                ManagerName = "Binod Sharma",
                Address     = "Dadar",
                Email       = "*****@*****.**",
                Gender      = "Male",
                ProfilePic  = profilePics,
                Designation = "Manager",
                Project     = "FinanceDomain",
                Employees   = new ItemsChangeObservableCollection <Employee>()
            };

            manager1.Employees.Add(new Employee {
                EmployeeId   = 5,
                EmployeeName = "Ashwani Kumar",
                Address      = "Dadar",
                Email        = "*****@*****.**",
                Gender       = "Male",
                ProfilePic   = profilePics,
                Designation  = "TechnicalLead",
                Project      = "FinanceDomain"
            });
            manager1.Employees.Add(new Employee
            {
                EmployeeId   = 6,
                EmployeeName = "Akash Yada",
                Address      = "Bandra",
                Gender       = "Male",
                Email        = "*****@*****.**",
                ProfilePic   = profilePics,
                Designation  = "AssociateConsultant",
                Project      = "HealthDomain"
            });
            Manager manager2 = new Manager()
            {
                ManagerId   = 2,
                ManagerName = "Naveen Chhabra",
                Address     = "Faridabad",
                Gender      = "Male",
                Email       = "*****@*****.**",
                ProfilePic  = profilePics,
                Designation = "Manager",
                Project     = "MedicalDomain",
                Employees   = new ItemsChangeObservableCollection <Employee>()
            };

            manager2.Employees.Add(new Employee
            {
                EmployeeId   = 7,
                EmployeeName = "Neeraj Gupta",
                Address      = "Faridabad",
                Gender       = "Male",
                Email        = "*****@*****.**",
                ProfilePic   = profilePics,
                Designation  = "SoftwareDev",
                Project      = "MedicalDomain"
            });
            manager2.Employees.Add(new Employee
            {
                EmployeeId   = 8,
                EmployeeName = "Varun Kumar",
                Address      = "Worli",
                Gender       = "Male",
                Email        = "*****@*****.**",
                ProfilePic   = profilePics,
                Designation  = "SoftwareDev",
                Project      = "MedicalDomain"
            });
            Manager manager3 = new Manager()
            {
                ManagerId   = 3,
                ManagerName = "Umesh kaushal",
                Address     = "Noida",
                Gender      = "Male",
                Email       = "*****@*****.**",
                ProfilePic  = profilePics,
                Designation = "Manager",
                Project     = "HealthDomain",
                Employees   = new ItemsChangeObservableCollection <Employee>()
            };

            manager3.Employees.Add(new Employee
            {
                EmployeeId   = 9,
                EmployeeName = "Arun Yadav",
                Address      = "Dadar",
                Email        = "*****@*****.**",
                Gender       = "Female",
                ProfilePic   = profilePics,
                Designation  = "TechnicalLead",
                Project      = "FinanceDomain"
            });
            manager3.Employees.Add(new Employee
            {
                EmployeeId   = 10,
                EmployeeName = "Ashish Bohra",
                Address      = "Noida",
                Gender       = "Male",
                Email        = "*****@*****.**",
                ProfilePic   = profilePics,
                Designation  = "AssociateConsultant",
                Project      = "HealthDomain"
            });
            manager3.Employees.Add(new Employee
            {
                EmployeeId   = 11,
                EmployeeName = "Amrinder Singh",
                Address      = "Faridabad",
                Gender       = "Male",
                Email        = "*****@*****.**",
                ProfilePic   = profilePics,
                Designation  = "TechnicalLead",
                Project      = "MedicalDomain"
            });

            Manager manager4 = new Manager()
            {
                ManagerId   = 3,
                ManagerName = "Vivek Gupta",
                Address     = "Faridabad",
                Gender      = "Male",
                Email       = "*****@*****.**",
                ProfilePic  = profilePics,
                Designation = "Manager",
                Project     = "MedicalDomain",
                Employees   = new ItemsChangeObservableCollection <Employee>()
            };

            manager4.Employees.Add(new Employee
            {
                EmployeeId   = 12,
                EmployeeName = "Sumeet Singh",
                Address      = "Faridabad",
                Gender       = "Male",
                Email        = "*****@*****.**",
                ProfilePic   = profilePics,
                Designation  = "SoftwareDev",
                Project      = "MedicalDomain"
            });
            manager4.Employees.Add(new Employee
            {
                EmployeeId   = 13,
                EmployeeName = "Sumit Dahiya",
                Address      = "Dadar",
                Email        = "*****@*****.**",
                Gender       = "Female",
                ProfilePic   = profilePics,
                Designation  = "AssociateConsultant",
                Project      = "FinanceDomain"
            });
            manager4.Employees.Add(new Employee
            {
                EmployeeId   = 14,
                EmployeeName = "Shariq Iqbal",
                Address      = "Andheri",
                Gender       = "Male",
                Email        = "*****@*****.**",
                ProfilePic   = profilePics,
                Designation  = "SoftwareDev",
                Project      = "HealthDomain"
            });

            Managers.Add(manager1);
            Managers.Add(manager2);
            Managers.Add(manager3);
            Managers.Add(manager4);
            return(Managers);
        }
Пример #6
0
 set => this.SetValue(BindingProperty, value);
Пример #7
0
        /// <summary>
        /// Processes a message
        /// </summary>
        /// <param name="stream">The message being processed.</param>
        /// <param name="ctx">The context associated with the message.</param>
        /// <returns>The handling status for this operation.</returns>
        protected override ChainResult OnProcessInputMessage(ref WsMessage msg, BindingContext ctx)
        {
            if (msg == null)
            {
                return(ChainResult.Abort);
            }

            ArrayList props = ctx.BindingProperties;

            if (props != null)
            {
                int len = props.Count;

                for (int j = 0; j < len; j++)
                {
                    BindingProperty prop = (BindingProperty)props[j];

                    if (prop.Name == HttpKnownHeaderNames.ContentType)
                    {
                        string strContentType = ((string)prop.Value).ToLower();

                        if (strContentType.IndexOf("multipart/related;") == 0)
                        {
                            // Create the mtom header class
                            msg.MtomPropeties = new WsMtomParams();

                            // Parse Mtom Content-Type parameters
                            string[] fields    = strContentType.Substring(18).Split(';');
                            int      fieldsLen = fields.Length;
                            for (int i = 0; i < fieldsLen; ++i)
                            {
                                string type = fields[i];
                                int    idx  = type.IndexOf('=');

                                if (idx != -1)
                                {
                                    string param = type.Substring(0, idx).Trim();
                                    string value = type.Substring(idx + 1).Trim('\"');
                                    switch (param.ToUpper())
                                    {
                                    case "BOUNDARY":
                                        if (param.Length > 72)
                                        {
                                            throw new ArgumentException("Mime boundary element length exceeded.", "boundary");
                                        }
                                        msg.MtomPropeties.boundary = value;
                                        break;

                                    case "TYPE":
                                        msg.MtomPropeties.type = value;
                                        break;

                                    case "START":
                                        msg.MtomPropeties.start = value;
                                        break;

                                    case "START-INFO":
                                        msg.MtomPropeties.startInfo = value;
                                        break;

                                    default:
                                        break;
                                    }
                                }
                            }

                            // Check required Mtom fields
                            if (msg.MtomPropeties.boundary == null || msg.MtomPropeties.type == null || msg.MtomPropeties.start == null)
                            {
                                throw new WsFaultException(msg.Header, WsFaultType.WseInvalidMessage);
                            }

                            WsMtom mtom = new WsMtom((byte[])msg.Body);

                            msg.Body      = mtom.ParseMessage(msg.MtomPropeties.boundary);
                            msg.BodyParts = mtom.BodyParts;
                        }
                        else if (strContentType.IndexOf("application/soap+xml") != 0)
                        {
                            throw new WsFaultException(msg.Header, WsFaultType.WseInvalidMessage);
                        }
                    }
                }
            }

            if (msg.Body == null)
            {
                return(ChainResult.Continue);
            }

            MemoryStream requestStream = new MemoryStream((byte[])msg.Body);

            XmlReader   reader = XmlReader.Create(requestStream);
            WsWsaHeader hdr    = new WsWsaHeader();

            reader.ReadStartElement("Envelope", WsWellKnownUri.SoapNamespaceUri);

            reader.MoveToContent();
            if (ctx.Version.IncludeSoapHeaders || reader.LocalName == "Header")
            {
                hdr.ParseHeader(reader, ctx.Version);
            }

            msg.Header = hdr;

            reader.ReadStartElement("Body", WsWellKnownUri.SoapNamespaceUri);


            if (msg.Deserializer != null)
            {
                msg.Body = ((DataContractSerializer)msg.Deserializer).ReadObject(reader);
                reader.Dispose();
            }
            else
            {
                msg.Reader = reader;
            }

            return(ChainResult.Continue);
        }