예제 #1
0
        protected override void PopulateControl()
        {
            base.PopulateControl();
            this.packSellingCompany.DataSource = Common.SellingCompany.FetchAll();
            this.packType.DataSource           = Packtype.FetchAll();
            this.packOutputMethod.DataSource   = OutputQueue.FetchAll();

            //Gets merge fields list
            var mergeFields  = new List <KeyValuePair <string, byte> >();
            var packTypeList = Packtype.FetchAll();

            foreach (var packTypeObject in packTypeList)
            {
                var mergeFieldListFromView = Query.Create()
                                             .Select("COLUMN_NAME")
                                             .From(QuerySources.PackMergeFields)
                                             .WhereRaw("(TABLE_NAME = '" + packTypeObject.StoredProc + "' and COLUMN_NAME not like 'PR_ID%')", null)
                                             .OrderBy("COLUMN_NAME", true)
                                             .Run();

                foreach (var field in mergeFieldListFromView)
                {
                    mergeFields.Add(new KeyValuePair <string, byte>(field.Values.First().ToString(), packTypeObject.Type));
                }
            }

            this.AllMergeFields.DataSource = mergeFields;

            if (this.Id.FieldValue == "")
            {
                this.packRetainAttachments.FieldValue = true;
                this.DataSource.ActPqKeep             = 1;
                this.packSellingCompany.FieldValue    = this.CurrentSession.User.SellingCompanyId;
            }
            else
            {
                this.packSellingCompany.FieldValue = this.DataSource.PackSellingCompanyIdId;
                Packtype objPackType = Packtype.FetchAll().Where(s => s.Type == this.DataSource.PackType).FirstOrDefault();
                if (objPackType != null)
                {
                    this.packType.FieldValue    = objPackType.Type.ToString();
                    this.packType.DisplayMember = objPackType.Desc;
                }
                this.packType.IsReadOnly = ConfigurableBoolean.True;
                //this.packDeliveryFailure.FieldValue = false;
                //this.packDeliveryDelay.FieldValue = false;
                //this.packDeliverySuccess.FieldValue = false;

                if (!string.IsNullOrEmpty(this.DataSource.DsnOptions))
                {
                    var dsnOptions = this.DataSource.DsnOptions.Split(',');
                    foreach (string val in dsnOptions)
                    {
                        getDSNOptionsVal(val);
                    }
                }
            }
        }