protected void loadData()
        {
            string currentFilter ;
            if (IsPostBack == false)
            {
                Session["ord_filter"] = "";
                currentFilter = "";
            }
            else
                currentFilter = (string)Session["ord_filter"];
            //this.scriptLb.Text = currentFilter;
            OrderParser newParser = new OrderParser();
            this._dataModel = new OrderModel (this.gvOrders, @".\SQL2008",
                 1433, "TSQLFundamentals2008","sa", "123456", "Sales.Orders", "Sales.OrderDetails", newParser);
            newParser.DataModel = this._dataModel;
            try
            {
                this._dataModel.resetControl(currentFilter);
                //if (this.IsPostBack == false)
                  //  this.loadEmpIDS();
            }
            catch(Exception ex)
            {
                Session["current_error"] = ex.Message;
                Response.Redirect("serverError.aspx");
            }
            custList = new List<object>();
            empList = new List<object>();
            shipperList = new List<object>();
            custList.Add("");
            empList.Add("");
            shipperList.Add("");
            custList.AddRange(_dataModel.getIDItemList("Sales.Customers", 0, 1, "").ToArray());
            empList.AddRange(_dataModel.getIDItemList("HR.Employees", 0, 1, " jobStatus=1").ToArray());
            shipperList.AddRange(_dataModel.getIDItemList("Sales.Shippers", 0, 1, " deactive=0").ToArray());
            if (IsPostBack == false)
            {
                this.cbCustID.DataSource = custList;
                this.cbEmpID.DataSource = empList;
                this.cbShipper.DataSource = shipperList;

                cbCustID.DataBind();
                cbEmpID.DataBind();
                cbShipper.DataBind();

            }
        }
Beispiel #2
0
 public List<SheetAndSheetField> GetSheets(string RegistrationKey)
 {
     List<SheetAndSheetField> sAndsfList=new List<SheetAndSheetField>();
     long DentalOfficeID=util.GetDentalOfficeID(RegistrationKey);
     try {
         if(DentalOfficeID==0) {
             return sAndsfList;
         }
         ODWebServiceEntities db=new ODWebServiceEntities();
         var wsRes=from wsf in db.webforms_sheet
                   where wsf.webforms_preference.DentalOfficeID==DentalOfficeID
                   select wsf;
         for(int i=0;i<wsRes.Count();i++) {
             var wsobj=wsRes.ToList()[i];
             wsobj.webforms_sheetfield.Load();
             var sheetfieldList=wsobj.webforms_sheetfield;
             SheetAndSheetField sAnds=new SheetAndSheetField(wsobj,sheetfieldList.ToList());
             sAndsfList.Add(sAnds);
         }
         Logger.Information("In GetSheetData IpAddress="+HttpContext.Current.Request.UserHostAddress+" DentalOfficeID="+DentalOfficeID+" Sheets sent to Client="+wsRes.Count());
         return sAndsfList;
     }
     catch(Exception ex) {
         Logger.LogError("IpAddress="+HttpContext.Current.Request.UserHostAddress+" DentalOfficeID="+DentalOfficeID,ex);
         return sAndsfList;
     }
 }
        protected void loadData()
        {
            ProductParser newParser = new ProductParser();
            this.dataModel = new ProductModel(@".\SQL2008",
                 1433, "TSQLFundamentals2008", "sa", "123456", "Production.Products", newParser);
            newParser.DataModel = this.dataModel;

            try
            {
                this.dataModel.resetModel("");
            }
            catch (Exception ex)
            {
                Session["current_error"] = ex.Message;
                Response.Redirect("serverError.aspx");
            }

            /*if (this.IsPostBack == false)
                this.loadEmpIDS();*/
            catList = new List<object>();
            suppList = new List<object>();
            catList.Add("");
            suppList.Add("");
            catList.AddRange(dataModel.getIDItemList("Production.Categories", 0, 1, " deactive=0").ToArray());
            suppList.AddRange(dataModel.getIDItemList("Production.Suppliers", 0, 1, " deactive=0").ToArray());
            if (IsPostBack == false)
            {
                this.cbCatID.DataSource = catList;
                this.cbCatID.DataBind();
                this.cbSupplierID.DataSource = suppList;
                this.cbSupplierID.DataBind();

            }

            if ((Request.Params.Get("proid") != null))
            {
                this.proID = int.Parse(Request.Params.Get("proid").Trim());
                this.newEmpMode = false;
                if (this.IsPostBack == true)
                    return;

                this.loadSuppData();

            }
        }
Beispiel #4
0
        protected override void OnLoad(EventArgs e)
        {
            String setOptionFormat = "\t\t\t\tJuiceHelpers.GetMemberInfo(() => {0})";
            String paramdocFormat = "\t\t/// <param name=\"{0}\">{1}</param>";
            String optionsMapFormat = "\t\t\t\t{{ \"{0}\", \"{1}\" }}";
            String paramFormat = "{0} {1} = {2}";

            List<String> widgets = new List<string>(){
                "Anchor",
                "Button",
                "Checkbox",
                "Collapsible",
                "CollapsibleSet",
                "Content",
                "ControlGroup",
                "Dialog",
                "FieldContainer",
                "FlipToggle",
                "Footer",
                "Header",
                "Listview",
                "Navbar",
                "Page",
                "Popup",
                "PopupAnchor",
                "RadioButton",
                "Select",
                "Slider",
                "Textbox"
            };

            foreach(var widgetName in widgets) {

                List<String> setOptionList = new List<string>();
                List<String> paramdocList = new List<string>();
                List<String> optionMapList = new List<string>();
                List<String> paramShortList = new List<string>();
                List<String> paramList = new List<String>();

                //String widgetName = "Button";
                String typeFormat = "Juice.Mobile.{0}, JuiceUI";
                Type widgetType = Type.GetType(String.Format(typeFormat, widgetName), false, true);
                String classTemplate = "";
                TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;

                List<Option> widgetOptions =
                    (from property in TypeDescriptor.GetProperties(widgetType).OfType<PropertyDescriptor>()
                     let attribute = property.Attributes.OfType<WidgetOptionAttribute>().SingleOrDefault()
                     let docAttribute = property.Attributes.OfType<WidgetDocumentAttribute>().SingleOrDefault()
                     let hideAttribute = property.Attributes.OfType<EditorBrowsableAttribute>().SingleOrDefault()
                     where (attribute != null || docAttribute != null) && (hideAttribute == null || hideAttribute.State != EditorBrowsableState.Never)
                     select new Option() {
                         Property = property,
                         WidgetOption = attribute
                     }).ToList();

                foreach(var o in widgetOptions) {

                    var descAttr = o.Property.Attributes.OfType<DescriptionAttribute>().SingleOrDefault();
                    String optionName = o.WidgetOption.Name;
                    String[] parts = optionName.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
                    String paramName = parts[0];

                    for(var i = 1; i < parts.Length; i++) {
                        paramName += textInfo.ToTitleCase(parts[i]);
                    }

                    if(descAttr != null) {
                        paramdocList.Add(String.Format(paramdocFormat, paramName, descAttr.Description));
                    }
                    optionMapList.Add(String.Format(optionsMapFormat, paramName, optionName));
                    setOptionList.Add(String.Format(setOptionFormat, paramName));
                    paramShortList.Add(paramName);

                    Type type = o.Property.PropertyType;
                    object def = o.WidgetOption.DefaultValue;
                    String defaultValue = def == null ? "null" : def.ToString();
                    String typeName = type.Name;

                    if((type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))) {
                        Type[] args = type.GetGenericArguments();
                        if(args.Length > 0) {
                            typeName = args[0].Name + "?";
                        }
                    }

                    if(type == typeof(bool) || type == typeof(Boolean)) {
                        defaultValue = defaultValue.ToLower();
                    }

                    if(type == typeof(string) || type == typeof(String)) {
                        defaultValue = "\"" + defaultValue + "\"";
                    }

                    paramList.Add(String.Format(paramFormat, typeName, paramName, String.IsNullOrEmpty(defaultValue) ? "\"\"" : defaultValue));
                }

                using(var sr = new StreamReader(Server.MapPath("MobileMvcTemplate.txt"))) {
                    classTemplate = sr.ReadToEnd();
                }

                String setOptions = String.Join(",\n", setOptionList.ToArray());
                String paramdocs = String.Join(",\n", paramdocList.ToArray());
                String optionMap = String.Join(",\n", optionMapList.ToArray());
                String paramsShort = String.Join(", ", paramShortList.ToArray());
                String @params = String.Join(", ", paramList.ToArray());

                DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/") + "/../output");

                String result = classTemplate
                    .Replace("{typeName}", widgetName)
                    .Replace("{setOptions}", setOptions)
                    .Replace("{paramdocs}", paramdocs)
                    .Replace("{optionMap}", optionMap)
                    .Replace("{paramsShort}", paramsShort)
                    .Replace("{parameters}", @params);

                using(var sw = new StreamWriter(Path.Combine(dir.FullName, widgetName + ".cs"))) {
                    sw.Write(result);
                }

            }
        }
        protected void loadData()
        {
            string currentFilter ;
            if (IsPostBack == false)
            {
                Session["pro_filter"] = "";
                currentFilter = "";

            }
            else
                currentFilter = (string)Session["pro_filter"];
            //this.scriptLb.Text = currentFilter;
            ProductParser newParser = new ProductParser();
            this._dataModel = new ProductModel(this.gvProducts, @".\SQL2008",
                 1433, "TSQLFundamentals2008","sa", "123456", "Production.Products", newParser);
            newParser.DataModel = this._dataModel;
            try
            {
                this._dataModel.resetControl(currentFilter);
                //if (this.IsPostBack == false)
                  //  this.loadEmpIDS();
            }
            catch(Exception ex)
            {
                Session["current_error"] = ex.Message;
                Response.Redirect("serverError.aspx");
            }

            catList = new List<object>();
            suppList = new List<object>();
            catList.Add("");
            suppList.Add("");
            catList.AddRange(_dataModel.getIDItemList("Production.Categories", 0, 1, " deactive=0").ToArray());
            suppList.AddRange(_dataModel.getIDItemList("Production.Suppliers", 0, 1, " deactive=0").ToArray());
            if (IsPostBack == false)
            {
                this.cbCatID.DataSource = catList;
                this.cbCatID.DataBind();
                this.cbSupplierID.DataSource = suppList;
                this.cbSupplierID.DataBind();

            }
        }