Beispiel #1
0
        [HttpPost] // Muokataan tietuetta
        public ActionResult AddSijainti(FormCollection form)
        {
            string sijainti = form[String.Format("Sijainti")];

            if (!SQLFilter.checkInput(sijainti))
            {
                ExceptionController.WriteException(this, "Sijainti ei läpäissyt SQLFilteriä.");
                return(RedirectToAction("Index"));
            }
            string kaappi = form[String.Format("Kaappi")];

            if (!SQLFilter.checkInput(kaappi))
            {
                ExceptionController.WriteException(this, "Kaappi ei läpäissyt SQLFilteriä.");
                return(RedirectToAction("Index"));
            }
            cnn = dbMan.OpenConnection();
            DatabaseSijainti dmSij = new DatabaseSijainti(cnn);

            int    id         = 1;
            string hylly      = "nolla";
            string lisatiedot = "ei tietoja";

            dmSij.InsertInto(Sijainti.Create(id, sijainti, kaappi, hylly, lisatiedot));

            dbMan.CloseConnection(); //suljetaan yhteys
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public ActionResult Login(FormCollection form)   //Kirjautuminen
        {
            string kayttajanimi = form[string.Format("kayttajanimi")];
            string salasana     = form[string.Format("salasana")];

            if (ModelState.IsValid)                                                       //En ole varma mitä tekee
            {
                if (SQLFilter.checkInput(kayttajanimi) && SQLFilter.checkInput(salasana)) //Tarkistetaan käyttäjän syöte SQL varten
                {
                    dbMan = new DatabaseManager();
                    cnn   = dbMan.OpenConnection();
                    dbKay = new DatabaseKayttaja(cnn);
                    //string hash = PBKDF2Hash.HashPasswordUsingPBKDF2(salasana);
                    string   hash = salasana;
                    Kayttaja k    = dbKay.SelectKayttaja(kayttajanimi, hash);
                    dbMan.CloseConnection();
                    if (k != null)
                    {
                        //Session["UserID"] = k.UserId.ToString();         --Tarvitseeko? ehkä, ehkä ei
                        Session["Kayttajanimi"] = k.Kayttajanimi;
                        Session["Valtuus"]      = k.Valtuus.ToString(); //Tällä voinee lukita sisältöä
                        return(RedirectToAction("Index", "Home"));
                    }
                }
            }
            return(RedirectToAction("Login"));
        }
Beispiel #3
0
        public ActionResult Register(FormCollection form)
        { //Kirjautuminen
            string kayttajanimi = form[string.Format("kayttajanimi")];
            string salasana     = form[string.Format("salasana")];
            int    valtuus;

            if (!int.TryParse(form[string.Format("valtuus")], out valtuus))
            {
                return(View("Kayttajat"));
            }
            if (SQLFilter.checkInput(kayttajanimi) && SQLFilter.checkInput(salasana))
            { //Tarkistetaan käyttäjän syöte SQL varten
                dbMan = new DatabaseManager();
                cnn   = dbMan.OpenConnection();
                dbKay = new DatabaseKayttaja(cnn);
                //string hash = PBKDF2Hash.HashPasswordUsingPBKDF2(salasana);
                string   hash = salasana;
                Kayttaja k    = Kayttaja.Create(kayttajanimi, valtuus);
                dbKay.InsertInto(k, hash);
            }
            return(RedirectToAction("Kayttajat"));
        }
Beispiel #4
0
        public string  DoFilters(object obj, string currentDb, int mode = 0)
        {
            string filterstring = "";

            CurrentDb = currentDb;
            Button Filters = new Button();

            // Make sure this window has it's pointer "Registered" cos we can
            // Click the button before the window has had focus set
            if (Flags.CurrentSqlViewer != null)
            {
                Flags.CurrentSqlViewer = obj as SqlDbViewer;
                Filters         = Flags.CurrentSqlViewer.Filters;
                Filters.Content = "Filtering";
            }
            else
            {
                if (mode == 0)
                {
                    Filters.Content = "Reset";
                }
                else
                {
                    Filters.Content = "";
                }
            }
            // Call up the Filtering Window to select
            // the filtering conditions required
            //			Window_GotFocus ( sender , null );

            //if ( CurrentDb == "" )
            //{
            //	MessageBox . Show ( "You need to have loaded one of the data tables\r\nbefore you can access the filtering system" );
            //	return;
            //}
            //if ( Filters . Content == "Reset" )
            //{
            //	Filters . Content = "Filter";
            //	// clear any previous filter command line data
            //	Flags . FilterCommand = "";
            //	if ( Flags . CurrentSqlViewer != null )
            //	{
            //		if ( CurrentDb == "BANKACCOUNT" )
            //			Flags . CurrentSqlViewer . ShowBank_Click ( null , null );
            //		else if ( CurrentDb == "CUSTOMER" )
            //			Flags . CurrentSqlViewer . ShowCust_Click ( null , null );
            //		else if ( CurrentDb == "DETAILS" )
            //			Flags . CurrentSqlViewer . ShowDetails_Click ( null , null );
            //		ControlTemplate tmp = Utils . GetDictionaryControlTemplate ( "HorizontalGradientTemplateGray" );
            //		Filters . Template = tmp;
            //		Brush br = Utils . GetDictionaryBrush ( "HeaderBrushGray" );
            //		Filters . Background = br;
            //		Filters . Content = "Filtering";
            //		//Tidy up general flags
            //		Flags . IsFiltered = false;
            //		Flags . FilterCommand = "";
            //		Flags . CurrentSqlViewer . ParseButtonText ( true );
            //	}
            //	Mouse . OverrideCursor = Cursors . Arrow;

            //	return;
            //}
            SQLFilter sf = new SQLFilter(null);

            //// filter any table
            if (CurrentDb == "BANKACCOUNT")
            {
                sf.FilterList.Items.Clear( );
                sf.FilterList.Items.Add("ID");
                sf.FilterList.Items.Add("BANKNO");
                sf.FilterList.Items.Add("CUSTNO");
                sf.FilterList.Items.Add("ACTYPE");
                sf.FilterList.Items.Add("BALANCE");
                sf.FilterList.Items.Add("INTRATE");
                sf.FilterList.Items.Add("ODATE");
                sf.FilterList.Items.Add("CDATE");
            }
            else if (CurrentDb == "CUSTOMER")
            {
                sf.FilterList.Items.Clear( );
                sf.FilterList.Items.Add("Id");
                sf.FilterList.Items.Add("ID");
                sf.FilterList.Items.Add("BANKNO");
                sf.FilterList.Items.Add("CUSTNO");
                sf.FilterList.Items.Add("ACTYPE");
                sf.FilterList.Items.Add("FNAME");
                sf.FilterList.Items.Add("LNAME");
                sf.FilterList.Items.Add("ADDR1");
                sf.FilterList.Items.Add("ADDR2");
                sf.FilterList.Items.Add("TOWN");
                sf.FilterList.Items.Add("COUNTY");
                sf.FilterList.Items.Add("PCODE");
                sf.FilterList.Items.Add("PHONE");
                sf.FilterList.Items.Add("MOBILE");
                sf.FilterList.Items.Add("DOB");
                sf.FilterList.Items.Add("ODATE");
                sf.FilterList.Items.Add("CDATE");
            }
            else if (CurrentDb == "DETAILS")
            {
                sf.FilterList.Items.Clear( );
                sf.FilterList.Items.Add("ID");
                sf.FilterList.Items.Add("BANKNO");
                sf.FilterList.Items.Add("CUSTNO");
                sf.FilterList.Items.Add("ACTYPE");
                sf.FilterList.Items.Add("BALANCE");
                sf.FilterList.Items.Add("INTRATE");
                sf.FilterList.Items.Add("ODATE");
                sf.FilterList.Items.Add("CDATE");
            }
            sf.Operand.Items.Add("Equal to");
            sf.Operand.Items.Add("Not Equal to");
            sf.Operand.Items.Add("Greater than or Equal to");
            sf.Operand.Items.Add("Less than or Equal to");
            sf.Operand.Items.Add(">= value1 AND <= value2");
            sf.Operand.Items.Add("> value1 AND < value2");
            sf.Operand.Items.Add("< value1 OR > value2");
            sf.Operand.SelectedIndex = 0;
            //			}
            sf.currentDb    = CurrentDb;
            sf.FilterResult = false;
            sf.ShowDialog( );
            if (sf.FilterResult)
            {
                columnToFilterOn    = sf.ColumnToFilterOn;
                filtervalue1        = sf.FilterValue.Text;
                filtervalue2        = sf.FilterValue2.Text;
                operand             = sf.operand;
                filterstring        = DoFilter(obj, null);
                Flags.FilterCommand = filterstring;
                //if ( Flags . CurrentSqlViewer != null )
                //{
                //	Flags . CurrentSqlViewer . StatusBar . Text = $"Filtered Results are shown above. Column = {columnToFilterOn}, Condition = {operand}, Value(s) = {filtervalue1}, {filtervalue2} ";
                //	Flags . CurrentSqlViewer . Filters . IsEnabled = false;
                //	Flags . CurrentSqlViewer . Filters . Content = "Reset";
                //	Flags . CurrentSqlViewer . Filters . IsEnabled = true;
                //	ControlTemplate ctmp = Utils . GetDictionaryControlTemplate ( "HorizontalGradientTemplateGreen" );
                //	Flags . CurrentSqlViewer . Filters . Template = ctmp;
                //	Brush brs = Utils . GetDictionaryBrush ( "HeaderBrushGreen" );
                //	Flags . CurrentSqlViewer . Filters . Background = brs;
                //}
            }
            else
            {
                ControlTemplate tmp = Utils.GetDictionaryControlTemplate("HorizontalGradientTemplateGray");
                if (Flags.CurrentSqlViewer != null)
                {
                    Flags.CurrentSqlViewer.Filters.Template = tmp;
                    Brush br = Utils.GetDictionaryBrush("HeaderBrushGray");
                    Flags.CurrentSqlViewer.Filters.Background = br;
                    Flags.CurrentSqlViewer.Filters.Content    = "Filtering";
                }
            }
            return(filterstring);
        }
        private void ProcessMainObjects(ReadOnlyCollection <BusinessObject> oBOCObjects, FilterBase oUniqueCheckFilter)
        {
            foreach (var oObj in oBOCObjects)
            {
                foreach (var MainObject in _oSetting.InfoForReferenceObjectRules.MainObjectsInterface.Split('|').Select(x => x.Trim())) //Mainobject in XML
                {
                    if (!oObj.SupportsInterface(MainObject.ToString()))                                                                 //If not contains, Interface of Mainobject (Stair or Slab)
                    {
                        continue;
                    }
                    if (oObj is Stair && oObj.GetPropertyValue("IJNamedItem", "Name").ToString().Contains("Stair")) //Stair
                    {
                        var           oStair              = oObj as Stair;                                          //Stair Object
                        Matrix4X4     oMat                = new Matrix4X4(oStair.Matrix);                           // StairMatrix (Global Axis -> Local Axis)
                        Vector        rotateVec           = oMat.XAxis;                                             //X Axis of StairMatrix : Rotate base on X Axis
                        IMathServices oMathService        = new Math3d();
                        Collection <BusinessObject> oColl = new Collection <BusinessObject>()
                        {
                            oStair
                        };

                        var      oRange = (oStair as IRange).Range;
                        double   dRadian = (oStair.GetPropertyValue("IJSPSCommonStairLadderProps", "Angle") as PropertyValueDouble).PropValue.Value; //Stair Angle
                        double   height = MiddleServiceProvider.UOMMgr.ParseUnit(UnitType.Distance, _oSetting.Clearance.Value);                      //Height of user set
                        Position posSrc, posSrc2;
                        double   dMinDist;

                        oMat.Rotate(dRadian, rotateVec);                                                                      //Based on X Axis of Stair, Matrix will rotate by Angle
                        OrientedRangeBox oOrientedRangeBox = oMathService.GetOrientedRangeBox(oColl, oMat.XAxis, oMat.YAxis); //Oriented Range Box of Stair

                        //OriginXYZ <-> Y Axis Near surface minDistance and Position on surface
                        oRange.GetFaceInGivenDirection(oMat.YAxis, true).DistanceBetween(new Point3d(oOrientedRangeBox.Origin.X,
                                                                                                     oOrientedRangeBox.Origin.Y,
                                                                                                     oOrientedRangeBox.Origin.Z), out dMinDist, out posSrc);
                        //OriginXYZ <-> Y Axis Far surface minDIstance and Position on surface
                        oRange.GetFaceInGivenDirection(oMat.YAxis, false).DistanceBetween(new Point3d(oOrientedRangeBox.Origin.X,
                                                                                                      oOrientedRangeBox.Origin.Y,
                                                                                                      oOrientedRangeBox.Origin.Z), out dMinDist, out posSrc2);

                        double dJustMinDist = posSrc.DistanceToPoint(posSrc2);        //posSrc <-> posSrc2 Distance
                        double c            = dJustMinDist / Math.Cos(dRadian);       //Distance / cos  = length of sloped stair
                        Vector oTanVector   = new Vector(oOrientedRangeBox.Sides[1]); //Tangent Vector of Oriented Range Box (Y Axis)
                        oTanVector.Length = c;
                        Position corner1 = new Position(posSrc);
                        Position corner2 = new Position(posSrc).Offset(oOrientedRangeBox.Sides[0]);
                        Position corner3 = new Position(posSrc).Offset(oOrientedRangeBox.Sides[0]).Offset(oTanVector);
                        Position corner4 = new Position(posSrc.Offset(oTanVector));
                        //Corners of stair

                        double dPostHeight = MiddleServiceProvider.UOMMgr.ParseUnit(UnitType.Distance, oStair.GetPropertyValue("IJUAStairTypeA", "PostHeight").ToString());
                        double dTopElev    = Math.Max(Math.Max(corner1.Z, corner2.Z),
                                                      Math.Max(corner3.Z, corner4.Z));                                              //Maximum elevation of bottom of stair
                        double dHeight = (oRange.High.Z - dTopElev);                                                                // Top point of Handrail - bottom Elevation of Stair = Stair Height
                        corner1.Z += dHeight; corner2.Z += dHeight; corner3.Z += dHeight; corner4.Z += dHeight;                     // + Stair Height

                        Vector uVec = corner2.Subtract(corner1);                                                                    //UVector of Symbol
                        Vector vVec = corner3.Subtract(corner2);                                                                    //Vvector of Symbol
                        //uVec.Length=1.0; vVec.Length=1.0;
                        OrientedRangeBox oOrientedRBHC = new OrientedRangeBox(new Position(corner1),                                // Creates Oritented RangeBox of Head Clearance
                                                                              uVec, vVec, new Vector(0, 0, height - dHeight));      //2.0m - Stair height = RBHC RangeBox
                        RangeBox oExtendedRange = new RangeBox(new Position(oRange.Low),
                                                               new Position(oRange.High.X, oRange.High.Y, oRange.High.Z + height)); // 2.0m is height value adjustable

                        string    subSelectQueryCriteria = GenericUtils.GetSQLQueryBasedOnObjectTypeViewCriteria("JDObject");
                        string    sqlQuery = GenericUtils.GetSQLQueryForObjectsOverlappingRangeBox(oExtendedRange, subSelectQueryCriteria);
                        SQLFilter oFilter  = new SQLFilter();
                        oFilter.SetSQLFilterString(sqlQuery);
                        ReadOnlyCollection <BusinessObject> oReadOnlyColl = oFilter.Apply(MiddleServiceProvider.SiteMgr.ActiveSite.ActivePlant.PlantModel);
                        //SQLFilter for Searching Overlapping Object

                        //Highlight object
                        GraphicViewHiliter oHiliter = new GraphicViewHiliter();
                        oHiliter.Weight      = 5;
                        oHiliter.Color       = ColorConstants.RGBYellow;
                        oHiliter.LinePattern = HiliterBase.HiliterLinePattern.Dotted;
                        Hiliter oHiliter2 = new Hiliter();
                        oHiliter2.Weight = 10;
                        oHiliter2.Color  = ColorConstants.RGBBlue;
                        Hiliter oHiliter3 = new Hiliter();
                        oHiliter3.Weight = 3;
                        oHiliter3.Color  = ColorConstants.RGBWhite;
                        Dictionary <string, List <BusinessObject> > oDic = new Dictionary <string, List <BusinessObject> >();
                        oDic["Overlap"] = new List <BusinessObject>();
                        oDic["Inside"]  = new List <BusinessObject>();
                        ClientServiceProvider.SelectSet.SelectedObjects.Clear();

                        List <BusinessObject> refObjList = new List <BusinessObject>(); //BusinessObject List
                        List <String>         stringList = new List <String>();         //oid LIst

                        foreach (var oObject in oReadOnlyColl)
                        {
                            if (!IsSupportInerface(oObject))
                            {
                                refObjList.Add(oObject);
                                stringList.Add(oObject.ObjectID);
                            }
                            else
                            {
                                continue;
                            }

                            OrientedRangeBox oObjectOrientedBox = oMathService.GetOrientedRangeBox(new Collection <BusinessObject>(
                                                                                                       new List <BusinessObject>()
                            {
                                oObject
                            }));                                                                                        //OrientedRangeBox of the Object
                            RangeBoxIntersectionType intersectionType = oOrientedRBHC.Intersects(oObjectOrientedBox);   //Find Intersects b/w them
                            if (intersectionType == RangeBoxIntersectionType.Overlap)
                            {
                                //ClientServiceProvider.SelectSet.SelectedObjects.Add(oObject);
                                oDic["Overlap"].Add(oObject);
                                //foreach (var oPlaTest in MakePlane3D6ByOrientedRangeBox(oPipeOrientedBox))
                                //{
                                //    oHiliter3.HilitedObjects.Add(oPlaTest);
                                //}
                            }
                            else if (intersectionType == RangeBoxIntersectionType.Inside)
                            {
                                //ClientServiceProvider.SelectSet.SelectedObjects.Add(oObject);
                                oDic["Inside"].Add(oObject);
                                //foreach (var oPlaTest in MakePlane3D6ByOrientedRangeBox(oPipeOrientedBox))
                                //{
                                //    oHiliter2.HilitedObjects.Add(oPlaTest);
                                //}
                            }
                            else
                            {
                                refObjList.Remove(oObject);
                            }
                            foreach (KeyValuePair <string, List <BusinessObject> > item in oDic)
                            {
                                if (item.Key.Equals("Overlap"))
                                {
                                    foreach (var oBO in oDic[item.Key])
                                    {
                                        oHiliter3.HilitedObjects.Add(oBO);
                                    }
                                }
                                else if (item.Key.Equals("Inside"))
                                {
                                    foreach (var oBO in oDic[item.Key])
                                    {
                                        oHiliter2.HilitedObjects.Add(oBO);
                                    }
                                }
                            }
                            //Debug.Print(oObj.ObjectIDForQuery);
                        }
                        var oPlaColl  = MakePlane3D6ByOrientedRangeBox(oOrientedRangeBox);
                        var oPlaColl2 = MakePlane3D6ByOrientedRangeBox(oOrientedRBHC);

                        foreach (var oPlane in oPlaColl2)
                        {
                            oHiliter.HilitedObjects.Add(oPlane);
                        }

                        if (refObjList.Count == 0)
                        {
                            CreateOrUpdateDefect(oObj, 1, false, "", null, null);
                        }
                        else
                        {
                            Dictionary <string, string> DefectDic = new Dictionary <string, string>()
                            {
                                { "distance", _oSetting.Clearance.Value }
                            };
                            CreateOrUpdateDefect(oObj, 1, true, _oRuleDescriptionHelper.GetFullErrorDescription(1, DefectDic), refObjList, null);
                        }
                    }
                    else if (oObj is Slab && oObj.GetPropertyValue("IJNamedItem", "Name").ToString().Contains("Stair"))
                    {
                        IMathServices oMathService = new Math3d();
                        var           oSlab        = oObj as Slab;
                        //Matrix4X4 oMat = new Matrix4X4(oSlab.Matrix);
                        Collection <BusinessObject> oCollection = new Collection <BusinessObject>()
                        {
                            oSlab
                        };

                        // RangeBox 를 가져온다.
                        RangeBox oRange = (oSlab as IRange).Range;
                        // Calculate the distance value based on the unit recored on the configuration file
                        double height = MiddleServiceProvider.UOMMgr.ParseUnit(UnitType.Distance, _oSetting.Clearance.Value);
                        // 면적을 줄여준다. (20 mm)
                        RangeBox nRange = new RangeBox(new Position(oRange.Low.X + allowanceXY, oRange.Low.Y + allowanceXY, oRange.High.Z + allowanceZ),
                                                       new Position(oRange.High.X - allowanceXY, oRange.High.Y - allowanceXY, oRange.High.Z + height));
                        RangeBox         testRange         = new RangeBox();
                        OrientedRangeBox oOrientedRangeBox = oMathService.GetOrientedRangeBox(oCollection);
                        oOrientedRangeBox.GetExtendedOrientedRangeBoxInGivenDirection(new Vector(0, 0, 1), height, out oOrientedRangeBox, out testRange);

                        //JDObject(모든오브젝트)에 대한 Query 생성
                        string subQuery  = GenericUtils.GetSQLQueryBasedOnObjectTypeViewCriteria("JDObject");
                        string fullQuery = GenericUtils.GetSQLQueryForObjectsOverlappingRangeBox(nRange, subQuery);
                        //Excutes Query
                        SQLFilter oFilter = new SQLFilter();
                        oFilter.SetSQLFilterString(fullQuery);
                        var oColl = oFilter.Apply();                                    //Query에 걸리는 Object Collection
                        List <BusinessObject> refObjList = new List <BusinessObject>(); //BusinessObject List
                        List <String>         stringList = new List <String>();

                        //Highlight object
                        GraphicViewHiliter oHiliter = new GraphicViewHiliter();
                        oHiliter.Weight      = 5;
                        oHiliter.Color       = ColorConstants.RGBYellow;
                        oHiliter.LinePattern = HiliterBase.HiliterLinePattern.Dotted;
                        Hiliter oHiliter2 = new Hiliter();
                        oHiliter2.Weight = 10;
                        oHiliter2.Color  = ColorConstants.RGBBlue;
                        Hiliter oHiliter3 = new Hiliter();
                        oHiliter3.Weight = 3;
                        oHiliter3.Color  = ColorConstants.RGBWhite;
                        Dictionary <string, List <BusinessObject> > oDic = new Dictionary <string, List <BusinessObject> >();
                        oDic["Overlap"] = new List <BusinessObject>();
                        oDic["Inside"]  = new List <BusinessObject>();
                        ClientServiceProvider.SelectSet.SelectedObjects.Clear();

                        foreach (var oObject in oColl)
                        {
                            if (!IsSupportInerface(oObject))
                            {
                                refObjList.Add(oObject);
                                stringList.Add(oObject.ObjectID);
                            }
                            else
                            {
                                continue;
                            }

                            OrientedRangeBox oObjectOrientedBox = oMathService.GetOrientedRangeBox(new Collection <BusinessObject>(
                                                                                                       new List <BusinessObject>()
                            {
                                oObject
                            }));                                                                                          //OrientedRangeBox of the Object
                            RangeBoxIntersectionType intersectionType = oOrientedRangeBox.Intersects(oObjectOrientedBox); //Find Intersect b/w them
                            if (intersectionType == RangeBoxIntersectionType.Overlap)
                            {
                                //ClientServiceProvider.SelectSet.SelectedObjects.Add(oObject);
                                oDic["Overlap"].Add(oObject);
                                //foreach (var oPlaTest in MakePlane3D6ByOrientedRangeBox(oPipeOrientedBox))
                                //{
                                //    oHiliter3.HilitedObjects.Add(oPlaTest);
                                //}
                            }
                            else if (intersectionType == RangeBoxIntersectionType.Inside)
                            {
                                //ClientServiceProvider.SelectSet.SelectedObjects.Add(oObject);
                                oDic["Inside"].Add(oObject);
                                //foreach (var oPlaTest in MakePlane3D6ByOrientedRangeBox(oPipeOrientedBox))
                                //{
                                //    oHiliter2.HilitedObjects.Add(oPlaTest);
                                //}
                            }
                            foreach (KeyValuePair <string, List <BusinessObject> > item in oDic)
                            {
                                if (item.Key.Equals("Overlap"))
                                {
                                    foreach (var oBO in oDic[item.Key])
                                    {
                                        oHiliter3.HilitedObjects.Add(oBO);
                                    }
                                }
                                else if (item.Key.Equals("Inside"))
                                {
                                    foreach (var oBO in oDic[item.Key])
                                    {
                                        oHiliter2.HilitedObjects.Add(oBO);
                                    }
                                }
                            }
                            //Debug.Print(oObj.ObjectIDForQuery);
                        }
                        //var oPlaColl = MakePlane3D6ByOrientedRangeBox(oOrientedRangeBox);
                        var oPlaColl2 = MakePlane3D6ByOrientedRangeBox(oOrientedRangeBox);

                        foreach (var oPlane in oPlaColl2)
                        {
                            oHiliter.HilitedObjects.Add(oPlane);
                        }

                        if (refObjList.Count == 0)
                        {
                            CreateOrUpdateDefect(oObj, 1, false, "", null, null);
                        }
                        else
                        {
                            Dictionary <string, string> DefectDic = new Dictionary <string, string>()
                            {
                                { "distance", _oSetting.Clearance.Value }
                            };
                            CreateOrUpdateDefect(oObj, 1, true, _oRuleDescriptionHelper.GetFullErrorDescription(1, DefectDic), refObjList, null);
                        }
                    }
                }
            }
        }
Beispiel #6
0
        [HttpPost] // Muokataan tietuetta
        public ActionResult AddNew(FormCollection form)
        {
            if ((string)Session["Valtuus"] == "2")
            {
                //Haetaan tyyppi id. eli ensimmäinen numero joka määrittää mikä materiaali kyseessä
                int.TryParse(form[String.Format("tyyppi")], out int id);
                //Käydään läpi kaikki tiedot ja kirjoitetaan exception jos ongelmia
                string Koko = form[String.Format("koko")];
                if (!SQLFilter.checkInput(Koko))
                {
                    ExceptionController.WriteException(this, "VaneriKoko ei läpäissyt SQLFilteriä.");
                    return(RedirectToAction("Index"));
                }
                if (!float.TryParse(form[String.Format("hinta")], out float Hinta))
                {
                    ExceptionController.WriteException(this, "VaneriHinta muunnossa floatiksi virhe.");
                    return(RedirectToAction("Index"));
                }
                string Kauppa = form[String.Format("kauppa")];
                if (!SQLFilter.checkInput(Kauppa))
                {
                    ExceptionController.WriteException(this, "VaneriKauppa ei läpäissyt SQLFilteriä.");
                    return(RedirectToAction("Index"));
                }
                string Lisatiedot = form[String.Format("komm")];
                if (!SQLFilter.checkInput(Lisatiedot))
                {
                    ExceptionController.WriteException(this, "VaneriLisatiedot ei läpäissyt SQLFilteriä.");
                    return(RedirectToAction("Index"));
                }
                if (!int.TryParse(form[String.Format("sijainti")], out int Sijainti))
                {
                    ExceptionController.WriteException(this, "VaneriSijainti muunnossa integeriksi virhe.");
                    return(RedirectToAction("Index"));
                }
                string kaappi = form[String.Format("kaappi")];
                if (!SQLFilter.checkInput(kaappi))
                {
                    ExceptionController.WriteException(this, "VaneriKaappi ei läpäissyt SQLFilteriä.");
                    return(RedirectToAction("Index"));
                }
                string Yksikko = Request.Form["yksikko"].ToString();
                if (!SQLFilter.checkInput(Yksikko))
                {
                    ExceptionController.WriteException(this, "VaneriYksikko ei läpäissyt SQLFilteriä.");
                    return(RedirectToAction("Index"));
                }

                if (!int.TryParse(form[String.Format("maara")], out int Maara))
                {
                    ExceptionController.WriteException(this, "VaneriMaara muunnossa integeriksi virhe.");
                    return(RedirectToAction("Index"));
                }

                //Kertoo switchille mikä kutsu on kyseessä
                string kutsu = "uusi";
                switchi(kutsu, id, Koko, Hinta, Maara, Yksikko, Sijainti, Kauppa, Lisatiedot); //Kutsutaan switchiä joka tekee loput hommasta
                dbMan.CloseConnection();                                                       //suljetaan yhteys
                return(RedirectToAction("Index"));                                             // palataan
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Beispiel #7
0
        [HttpPost]                                        // Muokataan tietuetta
        public ActionResult EditInfo(FormCollection form) //Tuodaan formin tiedot
        {
            //Haetaan id formista
            string sid = form[String.Format("Tid")];

            if (form["Tid"] != null)
            { //Mikäli ei null niin jatketaan
                if (!int.TryParse(form[String.Format("Tid")], out int id))
                {
                    ExceptionController.WriteException(this, "VaneriID muunnossa integeriksi virhe.");
                    return(RedirectToAction("Index"));
                }
                string Koko = form[String.Format("TKoko")];
                if (!SQLFilter.checkInput(Koko))
                {
                    ExceptionController.WriteException(this, "VaneriKoko ei läpäissyt SQLFilteriä.");
                    return(RedirectToAction("Index"));
                }
                if (!float.TryParse(form[String.Format("THinta")], out float Hinta))
                {
                    ExceptionController.WriteException(this, "VaneriHinta muunnossa floatiksi virhe.");
                    return(RedirectToAction("Index"));
                }
                string Kauppa = form[String.Format("TKauppa")];
                if (!SQLFilter.checkInput(Kauppa))
                {
                    ExceptionController.WriteException(this, "VaneriKauppa ei läpäissyt SQLFilteriä.");
                    return(RedirectToAction("Index"));
                }
                string Lisatiedot = form[String.Format("TLisatiedot")];
                if (!SQLFilter.checkInput(Lisatiedot))
                {
                    ExceptionController.WriteException(this, "VaneriKauppa ei läpäissyt SQLFilteriä.");
                    return(RedirectToAction("Index"));
                }
                if (!int.TryParse(form[String.Format("TSijainti")], out int sijainti))
                {
                    ExceptionController.WriteException(this, "VaneriSijainti muunnossa integeriksi virhe.");
                    return(RedirectToAction("Index"));
                }
                string valittu = Request.Form["TYksikko"].ToString();
                if (!SQLFilter.checkInput(valittu))
                {
                    ExceptionController.WriteException(this, "VaneriYksikko ei läpäissyt SQLFilteriä.");
                    return(RedirectToAction("Index"));
                }
                if (!int.TryParse(form[String.Format("TMaara")], out int Maara))
                {
                    ExceptionController.WriteException(this, "VaneriMaara muunnossa integeriksi virhe.");
                    return(RedirectToAction("Index"));
                }

                string kutsu = "muokkaus";                                                     //Muokkaus kutsu switchille
                switchi(kutsu, id, Koko, Hinta, Maara, valittu, sijainti, Kauppa, Lisatiedot); //Kutsutaan switchia ja viedään tiedot sinne.
                dbMan.CloseConnection();
            }
            ;

            //Palataan Indexiin
            return(RedirectToAction("Index"));
        }
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="loginID">登录名(手机号)</param>
        /// <param name="PWD">密码</param>
        /// <param name="B_Name">沙龙名称</param>
        /// <param name="B_Phone">沙龙电话</param>
        /// <param name="B_LinkRealName">沙龙联系人</param>
        /// <param name="add">沙龙地址</param>
        /// <param name="B_Summary">沙龙简介</param>
        /// <param name="B_Image1">营业执照</param>
        /// <param name="B_Image2">Logo</param>
        /// <param name="B_Image3">环境照</param>
        /// <param name="B_Image4">环境照</param>
        /// <param name="B_Image5">环境照</param>
        /// <returns></returns>
        public string CHKregister(string loginID, string PWD, string B_Name, string B_Phone, string B_LinkRealName, string add, string B_Summary, string B_Image1, string B_Image2, string B_Image3, string B_Image4, string B_Image5, string B_Wxname, string Lng, string Lat, int istemporary, string recommend)
        {
            SalonService salon = new SalonService();
            SalonSimple  ss    = new SalonSimple();

            if (Session["W_B_UID"] != null && Session["W_B_UID"].ToString() != "")
            {
                ss = salon.GetSalonSimpleInfo(new Guid(Session["W_B_UID"].ToString()));
            }
            if (string.IsNullOrEmpty(loginID))
            {
                return("登录名不能为空");
            }
            if (string.IsNullOrEmpty(PWD))
            {
                return("密码不能为空");
            }
            if (string.IsNullOrEmpty(B_Phone))
            {
                return("电话号码不能为空");
            }
            if (string.IsNullOrEmpty(add))
            {
                return("地址不能为空");
            }
            if (string.IsNullOrEmpty(B_LinkRealName))
            {
                return("联系人不能为空");
            }
            if (string.IsNullOrEmpty(B_Image1))
            {
                return("营业执照不能为空");
            }
            if (string.IsNullOrEmpty(B_Image2))
            {
                return("LOGO不能为空");
            }
            try
            {
                //解密参数值
                loginID = WeiSalonV2.Models.AESHelper.DecryptString(loginID);
                PWD     = WeiSalonV2.Models.AESHelper.DecryptString(PWD);
                //去掉参数中的转移字符
                loginID = new string((from c in loginID.ToCharArray() where !char.IsControl(c) select c).ToArray());
                PWD     = new string((from c in PWD.ToCharArray() where !char.IsControl(c) select c).ToArray());
                if (string.IsNullOrEmpty(loginID))
                {
                    return("登录名验证失败");
                }
                if (string.IsNullOrEmpty(PWD))
                {
                    return("密码验证失败");
                }
            }
            catch
            {
                return("验证帐号/密码失败");
            }
            SalonSimple sal = new SalonSimple();

            sal.Status       = 1;
            sal.Cell         = B_Phone.Trim();
            sal.Date         = DateTime.Now;
            sal.Email        = loginID;
            sal.Pwd          = MD5.MDString(PWD);
            sal.Kind         = istemporary == 1 ? 0 : 1;
            sal.Logo         = B_Image2.Replace("http://bobosquad.qiniudn.com", "");
            sal.Nickname     = B_Name;
            sal.Address      = add;
            sal.LinkName     = B_LinkRealName;
            sal.Summary      = SQLFilter.checkStr(SQLFilter.ReplaceUnStr(SQLFilter.ReplaceStr(Server.UrlDecode(B_Summary.Trim()))));
            sal.Lat          = Lat;
            sal.Lon          = Lng;
            sal.Price        = "";
            sal.Businessdate = "10:00~22:00";
            sal.Opendate     = null;
            sal.Wxname       = string.IsNullOrEmpty(B_Wxname) ? "" : B_Wxname;
            sal.Recommend    = string.IsNullOrEmpty(recommend) ? "" : recommend;
            int         ADDCou = 0;
            SalonSimple salc   = salon.CHKInfo(loginID);

            if (salc == null)
            {
                //不是修改
                //未注册过
                AllSalon alls = new AllSalon();
                try
                {
                    sal.Uid = Guid.NewGuid();
                    ADDCou  = salon.AddSalon(sal);
                    if (ADDCou > 0)
                    {
                        ADDCou = 0;
                        //注册成功 添加环境图等
                        //添加营业执照图片
                        alls.SiKind   = 1;
                        alls.Suid     = sal.Uid;
                        alls.Sistatus = 1;
                        alls.Photo    = B_Image1.Replace("http://bobosquad.qiniudn.com", "");
                        salon.AddAllSalon(alls);

                        //添加环境图
                        alls          = new AllSalon();
                        alls.SiKind   = 3;
                        alls.Suid     = sal.Uid;
                        alls.Sistatus = 1;
                        alls.Photo    = B_Image3.Replace("http://bobosquad.qiniudn.com", "");
                        salon.AddAllSalon(alls);
                        alls.Photo = B_Image4.Replace("http://bobosquad.qiniudn.com", "");
                        salon.AddAllSalon(alls);
                        alls.Photo = B_Image5.Replace("http://bobosquad.qiniudn.com", "");
                        ADDCou     = salon.AddAllSalon(alls);
                        if (ADDCou > 0)
                        {
                            Session["W_B_UID"] = sal.Uid.ToString();
                            //所有信息添加成功
                            return("1");
                        }
                        else
                        {
                            return("基本信息添加成功 图片可能添加失败");
                            //基本信息添加成功 图片可能添加失败
                        }
                    }
                    else
                    {
                        return("信息添加失败");
                    }
                }
                catch (Exception ex)
                {
                    return("异常:信息添加失败");
                }
            }
            else
            {
                //防恶意修改
                if (ss.Uid != salc.Uid)
                {
                    return("帐号信息和提交信息不符");
                }
                //修改
                //如果是重新提交
                sal.Uid   = ss.Uid;
                sal.Email = salc.Email;
                ADDCou    = salon.UpdateRegSalon(sal);
                if (ADDCou > 0)
                {
                    try
                    {
                        ADDCou = 0;
                        List <AllSalon> lis = new List <AllSalon>();
                        lis = salon.GetSalonInfo(ss.Uid, 1); //营业执照
                        salon.UpdateImageInfo(lis[0].Id.ToString(), B_Image1, 1);
                        lis = salon.GetSalonInfo(ss.Uid, 3); //营业执照
                        salon.UpdateImageInfo(lis[0].Id.ToString(), B_Image3, 1);
                        salon.UpdateImageInfo(lis[1].Id.ToString(), B_Image4, 1);
                        ADDCou = salon.UpdateImageInfo(lis[2].Id.ToString(), B_Image5, 1);
                        return(ADDCou.ToString());
                    }
                    catch
                    { }
                }
                else
                {
                    return("信息修改失败");
                }
            }
            return("未知错误");
        }