예제 #1
0
		public override IEncodable Decode(General.Encoding.BinaryInput stream) {
			base.Decode(stream);

			Data.Decode(stream);

			return this;
		}
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        gui = GUIVariables.Instance;
        log = Logger.Instance;
        general = General.Instance;
        engine = ProcessingEngine.Instance;

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.
        string UID = string.Empty;
        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (!string.IsNullOrEmpty(UID))
        {
            Response.Redirect(links.FrontPageLink, false);
        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        if (!IsPostBack)
        {
            Control MasterPageLoginTable = this.Master.FindControl("LoginTable");
            MasterPageLoginTable.Visible = false;
        }

        UsernameTB.Focus();
        Page.Form.DefaultButton = SLoginButton.UniqueID;
    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        links = Links.Instance;
        gui = GUIVariables.Instance;
        dbOps = DBOperations.Instance;
        categories = Categories.Instance;
        log = Logger.Instance;
        engine = ProcessingEngine.Instance;
        general = General.Instance;
        imageEngine = ImageEngine.Instance;

        seperator = gui.Seperator;

        if (string.IsNullOrEmpty(Request.QueryString["UID"]))
        {

        }
        else
        {
            queryStringUID = Request.QueryString["UID"].Trim().ToLower();
        }

        if (string.IsNullOrEmpty(queryStringUID))
        {

        }
        else
        {
            LoadComments(queryStringUID);
        }
    }
예제 #4
0
        public frmPlanes(General.TipoOperacion tipoOperacion, frmPrincipal fp)
        {
            InitializeComponent();
            Negocio.Especialidades oEspecialidades = new Negocio.Especialidades();
            Entidades.Especialidades listaEspecialidades = oEspecialidades.RecuperarTodos();
            this.cbxEspecialidad.DataSource = listaEspecialidades;
            this.cbxEspecialidad.DisplayMember = "Nombre";
            this.cbxEspecialidad.ValueMember = "IdEspecialidad";

            this.tipoOperacion = tipoOperacion;
            this.fp = fp;
            switch (tipoOperacion)
            {
                case General.TipoOperacion.Alta:
                    {
                        this.btnBuscar.Hide();
                        this.btnBaja.Hide();
                        break;
                    }

                case General.TipoOperacion.Baja:
                    {
                        this.btnGuardar.Hide();
                        this.txtIdPlan.ReadOnly = false;
                        break;
                    }

                case General.TipoOperacion.Modificacion:
                    {
                        this.btnBaja.Hide();
                        this.txtIdPlan.ReadOnly = false;
                        break;
                    }
            }
        }
예제 #5
0
		public IEncodable Decode(General.Encoding.BinaryInput stream) {
			int count = stream.ReadInt32();
			for (int i = 0; i < count; i++) {
				Templates.Add(stream.ReadObject<EntityTemplate>());
			}
			return this;
		}
예제 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        tagger = Tagger.Instance;
        log = Logger.Instance;

        seperator = gui.Seperator;

        //  QueryString Param Names.
        //  ratingID
        //  value

        string iid = string.Empty;
        string value = string.Empty;

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        if (Request.QueryString != null && Request.QueryString.Count > 0)
        {
            //  ratingID is the Item IID.
            if (!string.IsNullOrEmpty(Request.QueryString["ratingID"]))
            {
                iid = Request.QueryString["ratingID"];
            }
            //  Value is the Rating given by the user. Value: [0, 1, 2, 3, 4]. So add +1 so as to convert Value: [1, 2, 3, 4, 5]
            if (!string.IsNullOrEmpty(Request.QueryString["value"]))
            {
                int intValue = -1;
                value = int.TryParse(Request.QueryString["value"], out intValue) ? (intValue + 1).ToString() : "-1";
            }
        }

        if (!string.IsNullOrEmpty(UID) && !string.IsNullOrEmpty(iid) && !string.IsNullOrEmpty(value))
        {
            UpdateRatings(UID, iid, value);
        }
    }
예제 #7
0
        public void UpdatePercentage()
        {
            int percentage;
            General maths = new General();

            do
            {
                Thread.Sleep(2);
            } while (comparison.numberOfShapes == 0);

            do
            {
                Thread.Sleep(7);

                percentage = maths.CalcualtePercentage(comparison.indexOfList, comparison.numberOfShapes);

                lblCompleted.Text = String.Format("Completed: {0}%", percentage);
                lblShapes.Text = String.Format("Shapes Processed: {0} / {1}", comparison.indexOfList, comparison.numberOfShapes);
                progressBar1.Value = percentage;
                lblCompleted.Refresh();
                lblShapes.Refresh();
            } while (progressBar1.Value != 100);

            Thread.Sleep(1500);

            comparison.numberOfShapes = 0;
            this.Close();
        }
예제 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (string.IsNullOrWhiteSpace(Request.QueryString["Exhibition"])) return;

            string strExhibitionId = Request.QueryString["Exhibition"];

            DBHelper objHelper = new DBHelper();
            General objGen = new General();

            string strSQL = @"SELECT EXHIBITION_NAME,
                                     EXHIBITION_DETAILS,
                                     EXHIBITON_TEXT,
                                     EXHIBITION_IMAGE
                              FROM   INSTA_MST_EXHIBITION
                              WHERE  EXHIBITION_ID =" + objGen.gReplaceQuotes(strExhibitionId);
            IDataReader reader = objHelper.gExecuteReader(CommandType.Text, strSQL);
            while (reader.Read())
            {

                img.Src = "../../upload/images/Exhibition/" + Convert.ToString(reader["EXHIBITION_IMAGE"]);
                ltHeading.Text = Convert.ToString(reader["EXHIBITION_NAME"]) + Convert.ToString(reader["EXHIBITION_DETAILS"]);
                ltDetail.Text = Convert.ToString(reader["EXHIBITON_TEXT"]);
            }
            reader.Close();
            reader.Dispose();

        }
    }
        public frmEspecialidades(General.TipoOperacion tipoOperacion, frmPrincipal fp)
        {
            InitializeComponent();
            this.tipoOperacion = tipoOperacion;
            this.fp = fp;

            switch (tipoOperacion)
            {
                case General.TipoOperacion.Alta:
                    {
                        this.btnBuscar.Hide();
                        this.btnBaja.Hide();
                        break;
                    }

                case General.TipoOperacion.Baja:
                    {
                        this.btnGuardar.Hide();
                        this.txtIdEspecialidad.ReadOnly = false;
                        break;
                    }

                case General.TipoOperacion.Modificacion:
                    {
                        this.btnBaja.Hide();
                        this.txtIdEspecialidad.ReadOnly = false;
                        break;
                    }
            }
        }
    protected void ButtonSubmit_Click(object sender, EventArgs e)
    {
        string CustId = Request.QueryString["CustId"];

        Connection con = new Connection();
        string strConnString = con.GetConnString();
        using (SqlConnection SqlCon = new SqlConnection(strConnString))
        {
            SqlCommand SqlComm = new SqlCommand("", SqlCon);
            SqlCon.Open();

            int ac_HolderId = Convert.ToInt32(CustId);
            decimal ac_Blnc = Convert.ToDecimal(TextBoxBlnc.Text);
            string ac_AltDate = DateTime.Now.ToString();

            string query = string.Format("INSERT INTO account(ac_cid, ac_type, ac_blnc, ac_date) VALUES('" + ac_HolderId + "', '" + DropDownListAcType.SelectedValue + "', '" + ac_Blnc + "', '" + ac_AltDate + "')");
            SqlComm.CommandText = query;
            SqlComm.ExecuteNonQuery();

            string SetStatus = string.Format("UPDATE cust_details SET c_status='1' WHERE c_id='" + ac_HolderId + "'");
            SqlComm.CommandText = SetStatus;
            SqlComm.ExecuteNonQuery();

            General GetNewCode = new General();
            string ChqRefNo = GetNewCode.GenerateCode();
            string Nartion = "Cash";
            string NowDate = DateTime.Now.ToString();

            string queryFrTrns = string.Format("INSERT INTO transactions(t_cid, t_nartion, t_refNo, t_deposit, t_blnc, t_date) VALUES('" + ac_HolderId + "', '" + Nartion + "', '" + ChqRefNo + "', '" + ac_Blnc + "', '" + ac_Blnc + "', '" + NowDate + "')");
            SqlComm.CommandText = queryFrTrns;
            SqlComm.ExecuteNonQuery();

            Response.Redirect("~/Admin/customer.aspx?CustId="+ CustId + "");
        }
    }
예제 #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     dbOps = (DBOperations)Application["dbOps"];
     log = (Logger)Application["log"];
     links = (Links)Application["links"];
     general = (General)Application["general"];
 }
예제 #12
0
파일: Entity.cs 프로젝트: Hakua/PokeSharp
		public virtual IEncodable Decode(General.Encoding.BinaryInput stream) {
			this.id = stream.ReadInt32();
			this.Position = stream.ReadVector2();
			this.Width = stream.ReadInt32();
			this.Height = stream.ReadInt32();

			return this;
		}
예제 #13
0
 protected virtual void InitializeGeneralLinkGenerator(RouteValuesPreparer routeValuesPreparer, HttpRequestProviderFake httpRequestProviderFake)
 {
     General = new General
     {
         RouteValuesPreparer = routeValuesPreparer,
         HttpRequestProvider = httpRequestProviderFake
     };
 }
예제 #14
0
		public void Encode(General.Encoding.BinaryOutput stream) {
			stream.Write(position);
			stream.Write(model.Name);
			stream.Write(entityIndex);

			EntityIO writer = new EntityIO(stream, null, true);
			writer.Write(worldEntity);
		}
예제 #15
0
		public void Encode(General.Encoding.BinaryOutput stream) {
			stream.Write(Name);
			stream.Write(Actions.Count);
			ActionIO writer = new ActionIO(stream);
			foreach (IAction i in Actions) {
				writer.Write(i);
			}
		}
예제 #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        general = (General)Application["general"];
        log = (Logger)Application["log"];
        gui = (GUIVariables)Application["gui"];

        MessageLabel.Text = "Your Feedback is so very important that " + gui.StoocksFont + " had to dedicate an entire page for it!";
    }
예제 #17
0
		public override General.Common.IEncodable Decode(General.Encoding.BinaryInput stream) {
			base.Decode(stream);
			this.MovementBehavior = stream.ReadObject<MovementBehavior>();
			this.MovementBehavior.Entity = this;
			this.elapsed = stream.ReadSingle();
			this.nextMovement = stream.ReadSingle();

			return this;
		}
예제 #18
0
파일: Sommet.cs 프로젝트: LRBH10/my-Project
 /**
  * @return bool
  * @param aret
  */
 public bool insererAret(General.Aret aret)
 {
     if (this.compatibleAret(aret) && aret.compatibleSommet(this)
         && graphe == aret.getGraphe()) {
     this.arets.Add(aret);
     return true;
     }
     return false;
 }
예제 #19
0
    public GameObject loadingMenu; //loading menu

    #endregion Fields

    #region Methods

    // Use this for initialization
    void Start()
    {
        if (instance == null) {
                        instance = this;
                        audioManagerComp = GetComponent<AudioManager> ();
                        DontDestroyOnLoad (gameObject);
                } else {
                        Destroy (gameObject);
                }
    }
예제 #20
0
파일: Weapon.cs 프로젝트: darkcheg/RikiTest
    public void FireBullet(General owner)
    {
        if (CurrentCooldown <= 0)
        {
            var bullet = LoadAssets.Instance.Load<Bullet>(_bulletAssetBundleName, _bulletAssetName);
            bullet.Instantiate(_firePoint.transform.position, _firePoint.transform.rotation, owner, _damage);

            Reload();
        }
    }
예제 #21
0
파일: Sommet.cs 프로젝트: LRBH10/my-Project
 /**
  * @return bool
  * @param graphe
  */
 public String setGraphe(General.Graphe graphe)
 {
     if (this.compatibleGraphe(graphe) && graphe.compatibleSommet(this)
         && this.IsGrapheNull()) {
     this.graphe = graphe;
     graphe.sommets.Add(this);
     return "OK \n " + this + "\n----------\n";
     }
     return "Non OK \n " + this +"\n"+ graphe + "\n----------\n";
 }
예제 #22
0
 // --- objects (loading) ---
 /// <summary>Loads an object from a file, suitable for post-processing.</summary>
 /// <param name="origin">The origin of the object which includes a valid path.</param>
 /// <param name="obj">Receives the object.</param>
 /// <returns>The success of the operation.</returns>
 public General.Result LoadObject(General.Origin origin, out Geometry.GenericObject obj)
 {
     if (origin.Path == null) {
         obj = null;
         return General.Result.InvalidArgument;
     } else {
         int skipIndex = -1;
         object data;
         // use specific plugin if available
         if (origin.Plugin != null) {
             data = origin.Plugin.Data;
             for (int i = 0; i < Plugins.ObjectLoadingPlugins.Length; i++) {
                 if (string.Equals(Plugins.ObjectLoadingPlugins[i].File == origin.Plugin.File, StringComparison.OrdinalIgnoreCase)) {
                     General.Priority priority = Plugins.ObjectLoadingPlugins[i].Api.CanLoadObject(origin.Path, origin.Encoding, data);
                     if (priority != General.Priority.NotCapable) {
                         General.Result result = Plugins.ObjectLoadingPlugins[i].Api.LoadObject(origin.Path, origin.Encoding, data, out obj);
                         return result;
                     } else {
                         skipIndex = i;
                         break;
                     }
                 }
             }
         } else {
             data = null;
         }
         // find all compatible plugins
         General.Priority[] pluginPriorities = new General.Priority[Plugins.ObjectLoadingPlugins.Length];
         int[] pluginIndices = new int[Plugins.ObjectLoadingPlugins.Length];
         int pluginCount = 0;
         for (int i = 0; i < Plugins.ObjectLoadingPlugins.Length; i++) {
             if (i != skipIndex) {
                 General.Priority priority = Plugins.ObjectLoadingPlugins[i].Api.CanLoadObject(origin.Path, origin.Encoding, data);
                 if (priority != General.Priority.NotCapable) {
                     pluginPriorities[pluginCount] = priority;
                     pluginIndices[pluginCount] = i;
                     pluginCount++;
                 }
             }
         }
         // use plugin with highest priority if available
         if (pluginCount == 1) {
             General.Result result = Plugins.ObjectLoadingPlugins[pluginIndices[0]].Api.LoadObject(origin.Path, origin.Encoding, data, out obj);
             return result;
         } else if (pluginCount != 0) {
             Array.Sort<General.Priority, int>(pluginPriorities, pluginIndices, 0, pluginCount);
             int i = pluginIndices[pluginCount - 1];
             General.Result result = Plugins.ObjectLoadingPlugins[pluginIndices[i]].Api.LoadObject(origin.Path, origin.Encoding, data, out obj);
             return result;
         } else {
             obj = null;
             return General.Result.PluginNotFound;
         }
     }
 }
예제 #23
0
		public IEncodable Decode(General.Encoding.BinaryInput stream) {
			name = stream.ReadString();
			int c = stream.ReadInt32();
			ActionIO reader = new ActionIO(stream);

			for (int i = 0; i < c; i++) {
				Actions.Add(reader.Read());
			}

			return this;
		}
예제 #24
0
		public void Encode(General.Encoding.BinaryOutput stream) {
			stream.Write(X);
			stream.Write(Y);
			stream.Write(Z);

			stream.Write(TilesetIndex);
			stream.Write(TileIndex);

			stream.Write(oldtilesetIndex);
			stream.Write(oldtileIndex);
		}
예제 #25
0
파일: Bullet.cs 프로젝트: darkcheg/RikiTest
    public Bullet Instantiate(Vector3 position, Quaternion rotation, General owner, float damage)
    {
        var element = SceneResources.Pop(gameObject, position, rotation);
        element.SetActive(true);

        var mount = element.GetComponent<Bullet>();
        mount.SetDamage(damage);
        mount.SetOwner(owner);

        return mount;
    }
        public void Coder(ref PreparedData data, General.Point[] selectedPoints, General.Point[] NotSelectedPoints, int xSize, int ySize)
        {
            int colContainers = (data.img.Width / xSize); // получаю количество контейнеров по оси Х
            int rowContainers = (data.img.Height / ySize); // получаю количество контейнеров по оси Y
            int numberOfContainers = rowContainers * colContainers; // Получаю общее количество контейнеров

            if (numberOfContainers < data.msgBits.Length) // проверяю возможность внедрении информации относительно размеров контейнеров и длины сообщения
            {
                throw new Exception("Не достаточно места для хранения информации. Измените размер контейнера или длину сообщения");
            }

            Methods.Block_Different_Shape.Container[] containers = new Methods.Block_Different_Shape.Container[data.msgBits.Length]; // формирую массив контейнеров (по одномерному должно работать быстрее) Длинной в сообщение

            getContainers(ref data, ref containers, selectedPoints, NotSelectedPoints, xSize, ySize, rowContainers, colContainers, containers.Length);

            // начинаем заполнять блоки информацией
            int index = 0;
            while (index < containers.Length)
            {
                if (containers[index].points_NotChecked == null || containers[index].points_Checked == null)
                {
                    if (containers[index].points_NotChecked == null)
                    {
                        if (containers[index].sumBits_Checked != data.msgBits[index])
                        {
                            containers[index].updateValue(data.msgBits[index], false, ref data);
                        }
                    }
                    else
                    {
                        if (containers[index].sumBits_NotChecked != data.msgBits[index])
                        {
                            containers[index].updateValue(data.msgBits[index], true, ref data);
                        }
                    }
                }
                else
                {
                    if(index % 2 == 0 && containers[index].sumBits_Checked != data.msgBits[index])
                    {
                        containers[index].updateValue(data.msgBits[index], Convert.ToBoolean(index % 2), ref data);
                    }

                    else if(index % 2 == 1 && containers[index].sumBits_NotChecked != data.msgBits[index])
                    {
                        containers[index].updateValue(data.msgBits[index], Convert.ToBoolean(index % 2), ref data);
                    }
                }
                index++;
            }

            data.imgCoded = Utils.setColorChanel(ref data);
        }
예제 #27
0
		public IEncodable Decode(General.Encoding.BinaryInput stream) {
			this.X = stream.ReadInt32();
			this.Y = stream.ReadInt32();
			this.Z = stream.ReadInt32();

			this.TilesetIndex = stream.ReadInt32();
			this.TileIndex = stream.ReadInt32();

			this.oldtilesetIndex = stream.ReadInt32();
			this.oldtileIndex = stream.ReadInt32();

			return this;
		}
예제 #28
0
파일: Aret.cs 프로젝트: LRBH10/my-Project
 /**
  * @return bool
  * @param sommet1
  * @param sommet2
  */
 public String insererSommets(General.Sommet sommet1, General.Sommet sommet2)
 {
     if (VerifyinsererSommet(sommet1) && VerifyinsererSommet(sommet2)
         && sommet1 != sommet2 && sommet1.graphe==sommet2.graphe) {
     this.sommet1 = sommet1;
     this.sommet2 = sommet2;
     sommet1.insererAret(this);
     sommet2.insererAret(this);
     setGraphe(sommet1.graphe);
     return "OK \n " + this + "\n----------\n";
     }
     return "Non OK \n" + this + "\n" + sommet1 + "\n" + sommet2
         + "\n----------\n";
 }
예제 #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        engine = ProcessingEngine.Instance;

        //  If not using ReCaptcha Project, but using the other Captcha Library.
        //if (!IsPostBack)
        //{
        //    HttpContext.Current.Session["CaptchaImageText"] = general.GenerateRandomCode();
        //}
    }
        public frmDesignaciones(General.TipoOperacion tipoOperacion, frmPrincipal fp)
        {
            InitializeComponent();
            this.tipoOperacion = tipoOperacion;
            this.fp = fp;

            Negocio.Cargos oCargos = new Negocio.Cargos();
            Entidades.Cargos listaCargos = oCargos.RecuperarTodos();
            Negocio.Materias oMaterias = new Negocio.Materias();
            Entidades.Materias listaMaterias = oMaterias.RecuperarTodos();
            Negocio.Profesores oProfesores = new Negocio.Profesores();
            Entidades.Profesores listaProfesores = oProfesores.RecuperarTodos();

            this.cbxCargo.DataSource = listaCargos;
            this.cbxCargo.DisplayMember = "DescripcionCargo";
            this.cbxCargo.ValueMember = "IdCargo";

            this.cbxMateria.DataSource = listaMaterias;
            this.cbxMateria.DisplayMember = "NomMateria";
            this.cbxMateria.ValueMember = "IdMateria";

            this.cbxProfesor.DataSource = listaProfesores;
            this.cbxProfesor.DisplayMember = "NombreCompleto";
            this.cbxProfesor.ValueMember = "Legajo";

            switch (tipoOperacion)
            {
                case General.TipoOperacion.Alta:
                    {
                        this.btnBuscar.Hide();
                        this.btnBaja.Hide();
                        break;
                    }

                case General.TipoOperacion.Baja:
                    {
                        this.btnGuardar.Hide();
                        this.txtIdDesignacion.ReadOnly = false;
                        break;
                    }

                case General.TipoOperacion.Modificacion:
                    {
                        this.btnBaja.Hide();
                        this.txtIdDesignacion.ReadOnly = false;
                        break;
                    }
            }
        }
예제 #31
0
        /// <summary>
        /// The handle request.
        /// </summary>
        /// <param name="permission">
        /// The permission.
        /// </param>
        public void HandleRequest(ViewPermissions permission)
        {
            bool noAccess = true;

            if (!this.Check(permission))
            {
                if (permission == ViewPermissions.RegisteredUsers)
                {
                    if (!Config.AllowLoginAndLogoff && YafContext.Current.BoardSettings.CustomLoginRedirectUrl.IsSet())
                    {
                        string loginRedirectUrl = YafContext.Current.BoardSettings.CustomLoginRedirectUrl;

                        if (loginRedirectUrl.Contains("{0}"))
                        {
                            // process for return url..
                            loginRedirectUrl =
                                loginRedirectUrl.FormatWith(
                                    HttpUtility.UrlEncode(General.GetSafeRawUrl(YafContext.Current.Get <HttpRequestBase>().Url.ToString())));
                        }

                        // allow custom redirect...
                        YafContext.Current.Get <HttpResponseBase>().Redirect(loginRedirectUrl);
                        noAccess = false;
                    }
                    else if (!Config.AllowLoginAndLogoff && Config.IsDotNetNuke)
                    {
                        // automatic DNN redirect...
                        string appPath = HostingEnvironment.ApplicationVirtualPath;
                        if (!appPath.EndsWith("/"))
                        {
                            appPath += "/";
                        }

                        // redirect to DNN login...
                        YafContext.Current.Get <HttpResponseBase>().Redirect(
                            appPath + "Login.aspx?ReturnUrl=" + HttpUtility.UrlEncode(General.GetSafeRawUrl()));
                        noAccess = false;
                    }
                    else if (Config.AllowLoginAndLogoff)
                    {
                        YafBuildLink.Redirect(ForumPages.login, "ReturnUrl={0}", HttpUtility.UrlEncode(General.GetSafeRawUrl()));
                        noAccess = false;
                    }
                }

                // fall-through with no access...
                if (noAccess)
                {
                    YafBuildLink.AccessDenied();
                }
            }
        }
예제 #32
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //   --------------------Common Code ----------------------------------------------------------------- //
            string Type = (Request.QueryString["Type"] != null) ? Request.QueryString["Type"] : "";
            if (Type == "PCard" || Type == "TCard" || Type == "PStck" || Type == "TStck")
            {
                FormSession.FillSession("Card", pageDiv);
            }
            if (Type == "PVCrd" || Type == "TVCrd")
            {
                FormSession.FillSession("Visitor", pageDiv);
            }

            //   --------------------Common Code ----------------------------------------------------------------- //
            if (!IsPostBack)
            {
                string CardType = "";
                if (Type == "PCard")
                {
                    CardType = "CardPrint"; /**/ CardsSideMenu1.Visible = true; /**/ MainMasterPage.ShowTitel(General.Msg("Print Card", "طباعة البطاقات"));
                }
                if (Type == "TCard")
                {
                    CardType = "CardTemplate"; /**/ CardsSideMenu1.Visible = true; /**/ MainMasterPage.ShowTitel(General.Msg("Templates Card", "نماذج البطاقات"));
                }

                if (Type == "PStck")
                {
                    CardType = "SCardPrint"; /**/ CardsSideMenu1.Visible = true; /**/ MainMasterPage.ShowTitel(General.Msg("Print Sticker Cars", "طباعة ملصقات السيارات"));
                }
                if (Type == "TStck")
                {
                    CardType = "SCardTemplate"; /**/ CardsSideMenu1.Visible = true; /**/ MainMasterPage.ShowTitel(General.Msg("Templates Sticker Cars", "نماذج ملصقات السيارات"));
                }

                if (Type == "PVCrd")
                {
                    CardType = "VCardPrint"; /**/ VisitorsSideMenu1.Visible = true; /**/ MainMasterPage.ShowTitel(General.Msg("Print Events Cards", "طباعة بطاقات المناسبات"));
                }
                if (Type == "TVCrd")
                {
                    CardType = "VCardTemplate"; /**/ VisitorsSideMenu1.Visible = true; /**/ MainMasterPage.ShowTitel(General.Msg("Templates Events Cards", "نماذج بطاقات المناسبات"));
                }

                //if (Type == "ViCard") { CardType = "CardView";/**/ CardsSideMenu1.Visible = true;  /**/ MainMasterPage.ShowTitel(General.Msg("View Card", "عرض البطاقات")); }

                hfdConnStr.Value   = ConfigurationManager.ConnectionStrings["constring"].ConnectionString.Replace("\\", "....");
                hfdLoginUser.Value = FormSession.LoginUsr.Replace("\\", "....");
                hfdLang.Value      = FormSession.Language;
                hfdType.Value      = CardType;
                string Value = hfdConnStr.Value + "," + hfdLoginUser.Value + "," + hfdLang.Value + "," + hfdType.Value;
                ClientScript.RegisterStartupScript(this.GetType(), "key", "javascript:Connect('" + Value + "');", true);
            }
        }
        catch (Exception e1)
        {
            DBFun.InsertError(FormSession.PageName, "PageLoad");
        }
    }
예제 #33
0
        // This returns the long value for a 8 byte texture name
        private void MakeNames(byte[] in_fixed)
        {
            /*
             * this.name = MakeNormalName(in_fixed, WAD.ENCODING).ToUpperInvariant();
             *          this.fixedname = MakeFixedName(name, WAD.ENCODING);
             * this.longname = MakeLongName(name);
             */

            int length;

            // Figure out the length of the lump name
            {
                int orig_length = in_fixed.Length;
                int l           = 0;
                int r           = orig_length;
                while (r - l > 1)
                {
                    int m = (r + l) / 2;

                    if (in_fixed[m] == 0)
                    {
                        r = m;
                    }
                    else
                    {
                        l = m;
                    }
                }
                length = l + 1;
            }

            // Make normal name
            name = WAD.ENCODING.GetString(in_fixed, 0, length).Trim().ToUpperInvariant();


            //makefixedname
            {
                int bytes = length;
                if (bytes < 8)
                {
                    bytes = 8;
                }

                // Make 8 bytes, all zeros
                fixedname = new byte[bytes];

                // Write the name in bytes
                WAD.ENCODING.GetBytes(name, 0, length, fixedname, 0);
            }

            //makelongname
            unsafe
            {
                long value = 0;
                uint bytes = (uint)length;

                if (bytes > 8)
                    bytes = 8;

                fixed(void *bp = fixedname)
                {
                    General.CopyMemory(&value, bp, bytes);
                }

                longname = value;
            }
        } // makenames
예제 #34
0
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        public static OperationResult <Relationship> CreateRelationship(Idea DestinationComposite, RelationshipDefinition Definitor, View TargetView,
                                                                        VisualRepresentation OriginRepresentation, Point OriginPosition,
                                                                        VisualRepresentation TargetRepresentation, Point TargetPosition,
                                                                        bool ExtendFromOriginRelationship = true, // (Shift not pressed) Applicable only when origin and target are both relationships. Else (Shift pressed) create Rel. from Target to Origin.
                                                                        bool ExtendExistingRelationship   = true) // (Right-Alt not pressed) Applicable only when origin is a not (simple and hiding-central-symbol) relationship. Else (Right-Alt pressed) created Rel. from Rel.
        {
            bool EditInPlace = false;

            General.ContractRequiresNotNull(DestinationComposite, Definitor, TargetView, OriginRepresentation);

            var MaxQuota = AppExec.CurrentLicenseEdition.TechName.SelectCorresponding(LicensingConfig.IdeasCreationQuotas);

            if (!ProductDirector.ValidateEditionLimit(DestinationComposite.OwnerComposition.DeclaredIdeas.Count() + 1, MaxQuota, "create", "Ideas (Concepts + Relationships)"))
            {
                return(OperationResult.Failure <Relationship>("This product edition cannot create more than " + MaxQuota + " Ideas."));
            }

            if (!ExtendFromOriginRelationship && (TargetRepresentation == null || !(TargetRepresentation.RepresentedIdea is Relationship)))
            {
                ExtendFromOriginRelationship = true;
            }

            var  PotentialOriginRelationship = OriginRepresentation.RepresentedIdea as Relationship;
            var  PotentialTargetRelationship = (TargetRepresentation == null ? (Relationship)null : TargetRepresentation.RepresentedIdea as Relationship);
            bool CreatingNewRelationship     = (/*?*/ !ExtendExistingRelationship || /*?*/ !((PotentialOriginRelationship != null && PotentialOriginRelationship.RelationshipDefinitor.Value == Definitor) ||
                                                                                             (PotentialTargetRelationship != null && PotentialTargetRelationship.RelationshipDefinitor.Value == Definitor)));
            bool?ExtensionFromOriginRelationship = (CreatingNewRelationship ? (bool?)null : (PotentialOriginRelationship != null && ExtendFromOriginRelationship));

            if (!CreatingNewRelationship && TargetRepresentation == null)
            {
                if (OriginRepresentation is RelationshipVisualRepresentation representation)
                {
                    return(OperationResult.Success(representation.RepresentedRelationship, "Creating new Relationship."));
                }
                else
                {
                    return(OperationResult.Failure <Relationship>("There is no targeted Idea to relate."));
                }
            }

            if (DestinationComposite.IdeaDefinitor.CompositeContentDomain == null)
            {
                return(OperationResult.Failure <Relationship>("Destination Container doest not accept Composite-Content.", DestinationComposite));
            }

            if (DestinationComposite.CompositeContentDomain.GlobalId != Definitor.OwnerDomain.GlobalId)
            {
                return(OperationResult.Failure <Relationship>("The destination container only accepts content of the '" + DestinationComposite.CompositeContentDomain.Name + "' Domain."));
            }

            Relationship       WorkingRelationship = null;
            LinkRoleDefinition OriginLinkRoleDef   = null;
            RoleBasedLink      OriginLink          = null;

            DestinationComposite.EditEngine.StartCommandVariation("Create Relationship");

            if (CreatingNewRelationship)
            {
                if (TargetRepresentation != null)
                {
                    var CanLink = Definitor.CanLink(OriginRepresentation.RepresentedIdea.IdeaDefinitor, TargetRepresentation.RepresentedIdea.IdeaDefinitor);

                    if (!CanLink.Result)
                    {
                        DestinationComposite.EditEngine.DiscardCommandVariation();
                        return(OperationResult.Failure <Relationship>(CanLink.Message));
                    }
                }

                string NewName = Definitor.Name;

                var AppendNumToName = AppExec.GetConfiguration <bool>("IdeaEditing", "Relationship.OnCreationAppendDefNameAndNumber", true);
                if (AppendNumToName)
                {
                    NewName = NewName + " (Idea " + (DestinationComposite.CompositeIdeas.Count + 1).ToString() + ")";
                }

                WorkingRelationship = new Relationship(DestinationComposite.OwnerComposition, Definitor, NewName, NewName.TextToIdentifier());

                if (Definitor.IsVersionable)
                {
                    WorkingRelationship.Version = new VersionCard();
                }

                WorkingRelationship.AddToComposite(DestinationComposite);

                OriginLinkRoleDef = Definitor.GetLinkForRole(ERoleType.Origin);
                OriginLink        = new RoleBasedLink(WorkingRelationship, OriginRepresentation.RepresentedIdea, OriginLinkRoleDef, OriginLinkRoleDef.AllowedVariants[0]);
                WorkingRelationship.AddLink(OriginLink);

                PotentialOriginRelationship = WorkingRelationship;
                EditInPlace = true;
            }
            else
            {
                OperationResult <bool> CanLink = OperationResult.Success(true);

                if (ExtensionFromOriginRelationship.IsTrue())
                {
                    WorkingRelationship = PotentialOriginRelationship;
                }
                else
                {
                    WorkingRelationship = (PotentialTargetRelationship != null ? PotentialTargetRelationship : PotentialOriginRelationship);
                }

                if (TargetRepresentation != null)
                {
                    CanLink = EvaluateLinkability(Definitor, OriginRepresentation, TargetRepresentation,
                                                  PotentialOriginRelationship, PotentialTargetRelationship, WorkingRelationship);

                    if (!CanLink.Result)
                    {
                        DestinationComposite.EditEngine.DiscardCommandVariation();

                        return(OperationResult.Failure <Relationship>("Cannot create/extend Relationship. Cause: " + CanLink.Message));
                    }
                }
            }

            LinkRoleDefinition WorkingLinkRoleDef = null;
            RoleBasedLink      WorkingLink        = null;

            if (TargetRepresentation != null && (CreatingNewRelationship || (WorkingRelationship == PotentialOriginRelationship &&
                                                                             ExtensionFromOriginRelationship.IsTrue())))
            {
                WorkingLinkRoleDef = Definitor.GetLinkForRole(ERoleType.Target);

                if (WorkingRelationship.Links.Where(link => link.RoleDefinitor == WorkingLinkRoleDef &&
                                                    link.AssociatedIdea == TargetRepresentation.RepresentedIdea).Any())
                {
                    DestinationComposite.EditEngine.DiscardCommandVariation();

                    return(OperationResult.Failure <Relationship>("Cannot create Target Link. Cause: Already exists one of the same role-type associating the same Idea."));
                }

                WorkingLink = new RoleBasedLink(WorkingRelationship, TargetRepresentation.RepresentedIdea, WorkingLinkRoleDef, WorkingLinkRoleDef.AllowedVariants[0]);
                WorkingRelationship.AddLink(WorkingLink);
            }

            if (OriginRepresentation != null && !CreatingNewRelationship &&
                WorkingRelationship == PotentialTargetRelationship && !ExtensionFromOriginRelationship.IsTrue())
            {
                WorkingLinkRoleDef = Definitor.GetLinkForRole(ERoleType.Origin);

                if (WorkingRelationship.Links.Where(link => link.RoleDefinitor == WorkingLinkRoleDef &&
                                                    link.AssociatedIdea == OriginRepresentation.RepresentedIdea).Any())
                {
                    DestinationComposite.EditEngine.DiscardCommandVariation();

                    return(OperationResult.Failure <Relationship>("Cannot create Origin Link. Cause: Already exists one of the same role-type associating the same Idea."));
                }

                WorkingLink = new RoleBasedLink(WorkingRelationship, OriginRepresentation.RepresentedIdea, WorkingLinkRoleDef, WorkingLinkRoleDef.AllowedVariants[0]);
                WorkingRelationship.AddLink(WorkingLink);
            }

            RelationshipVisualRepresentation Representator = null;
            VisualSymbol CentralSymbol = null;

            if (TargetPosition != Display.NULL_POINT &&
                OriginPosition != Display.NULL_POINT)
            {
                VisualConnector OriginConnector = null;

                var InitialPosition    = OriginPosition;
                var EdgeOriginPosition = OriginPosition;
                var EdgeTargetPosition = TargetPosition;

                if (CreatingNewRelationship)
                {
                    // Force connect from Symbols' centers.
                    if (OriginRepresentation != null)
                    {
                        EdgeOriginPosition = OriginPosition.DetermineNearestIntersectingPoint(TargetPosition, TargetView.Presenter,
                                                                                              OriginRepresentation.MainSymbol.Graphic,
                                                                                              TargetView.VisualHitTestFilter);
                    }

                    if (TargetRepresentation == null)
                    {
                        InitialPosition = TargetPosition;
                    }
                    else
                    {
                        EdgeTargetPosition = TargetPosition.DetermineNearestIntersectingPoint(OriginPosition, TargetView.Presenter,
                                                                                              TargetRepresentation.MainSymbol.Graphic,
                                                                                              TargetView.VisualHitTestFilter);
                        InitialPosition = EdgeOriginPosition.DetermineCenterRespect(EdgeTargetPosition);
                    }

                    // Create representation
                    Representator = CreateRelationshipVisualRepresentation(WorkingRelationship, TargetView, InitialPosition);
                    CentralSymbol = Representator.MainSymbol;

                    // Notice that here the Origin connector is being drawn, so the Target plug is empty/none (because is connected to the Relationship Central/Main Symbol).
                    OriginConnector = new VisualConnector(Representator, OriginLink, OriginRepresentation.MainSymbol, CentralSymbol, OriginPosition, CentralSymbol.BaseCenter);
                }
                else
                {
                    if (WorkingRelationship == PotentialOriginRelationship)
                    {
                        Representator = (RelationshipVisualRepresentation)OriginRepresentation;
                    }
                    else
                    {
                        Representator = (RelationshipVisualRepresentation)TargetRepresentation;
                    }

                    CentralSymbol   = OriginRepresentation.MainSymbol;
                    InitialPosition = CentralSymbol.BaseCenter;
                }

                VisualConnector TargetConnector        = null;
                VisualConnector OriginAutoRefConnector = null;

                if (TargetRepresentation != null)
                {
                    TargetConnector = new VisualConnector(Representator, WorkingLink, CentralSymbol, TargetRepresentation.MainSymbol, InitialPosition, TargetPosition);

                    if (WorkingRelationship == PotentialOriginRelationship)
                    {
                        OriginAutoRefConnector = CentralSymbol.OriginConnections.FirstOrDefault(conn => conn.OriginSymbol == TargetRepresentation.MainSymbol);
                    }
                }

                if (CreatingNewRelationship)
                {
                    Representator.AddVisualPart(OriginConnector);
                }

                if (TargetConnector != null)
                {
                    Representator.AddVisualPart(TargetConnector);
                }

                if (OriginAutoRefConnector != null)
                {
                    Representator.BendAutoRefConnectors(OriginAutoRefConnector, TargetConnector);
                }

                Representator.Render();
            }

            DestinationComposite.UpdateVersion();
            DestinationComposite.EditEngine.CompleteCommandVariation();

            var InformedRelationship = WorkingRelationship;

            if (WorkingRelationship == PotentialTargetRelationship &&
                PotentialOriginRelationship != null)
            {
                InformedRelationship = PotentialOriginRelationship;
            }

            return(OperationResult.Success(InformedRelationship, null, null, CentralSymbol.OwnerRepresentation, EditInPlace));
        }
        /// <summary>
        /// Adds the authorization in the context to the data store.
        /// </summary>
        /// <returns>
        /// The ResultCode corresponding to the result of the operation.
        /// </returns>
        public ResultCode AddAuthorization()
        {
            int?offset = GetPartnerMerchantTimeZoneOffset();

            ResultCode    result;
            Authorization authorization = (Authorization)Context[Key.Authorization];

            // TEMPORARY: Determine if the allow list forces transaction rejection.
            if (PhysStoreFilter() == true)
            {
//Context.Log.Critical("AuthorizationId: {0}\r\nPartnerId: {1}\r\nPartnerDealId: {2}\r\nPartnerCardId: {3}\r\nPartnerMerchantId: {4}\r\nPurchaseDateTime: {5}\r\nAuthorizationAmount: {6}\r\nTransactionScopeId: {7}" +
//                     "TransactionId: {8}\r\nCurrency: {9}\r\nPartnerData: {10}\r\noffset: {11}", null,
//                     authorization.Id, (int)Context[Key.Partner], Context[Key.PartnerDealId], Context[Key.PartnerCardId], Context[Key.PartnerMerchantId], authorization.PurchaseDateTime, authorization.AuthorizationAmount, authorization.TransactionScopeId,
//                     authorization.TransactionId, authorization.Currency, Context[Key.PartnerData], offset);


                result = SqlProcedure("AddAuthorization",
                                      new Dictionary <string, object>
                {
                    { "@authorizationId", authorization.Id },
                    { "@partnerId", (int)Context[Key.Partner] },
                    { "@recommendedPartnerDealId", Context[Key.PartnerDealId] },
                    { "@partnerCardId", Context[Key.PartnerCardId] },
                    { "@partnerMerchantId", Context[Key.PartnerMerchantId] },
                    { "@purchaseDateTime", authorization.PurchaseDateTime },
                    { "@authAmount", authorization.AuthorizationAmount },
                    { "@transactionScopeId", authorization.TransactionScopeId },
                    { "@transactionId", authorization.TransactionId },
                    { "@currency", authorization.Currency },
                    { "@partnerData", Context[Key.PartnerData] },
                    { "@timeZoneOffset", offset }
                },

                                      (sqlDataReader) =>
                {
                    if (sqlDataReader.Read() == true)
                    {
                        RedeemedDealInfo redeemedDealInfo = new RedeemedDealInfo
                        {
                            GlobalId              = sqlDataReader.GetGuid(sqlDataReader.GetOrdinal("GlobalDealId")),
                            Currency              = sqlDataReader.GetString(sqlDataReader.GetOrdinal("Currency")),
                            Amount                = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("Amount")),
                            Percent               = sqlDataReader.GetDecimal(sqlDataReader.GetOrdinal("Percent")),
                            MinimumPurchase       = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("MinimumPurchase")),
                            GlobalUserId          = sqlDataReader.GetGuid(sqlDataReader.GetOrdinal("GlobalUserId")),
                            PartnerDealId         = sqlDataReader.GetString(sqlDataReader.GetOrdinal("PartnerDealId")),
                            PartnerClaimedDealId  = sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal("PartnerClaimedDealId")) ? null : sqlDataReader.GetString(sqlDataReader.GetOrdinal("PartnerClaimedDealId")),
                            PartnerRedeemedDealId = authorization.PartnerRedeemedDealId,
                            DiscountSummary       = sqlDataReader.GetString(sqlDataReader.GetOrdinal("DiscountSummary")),
                            LastFourDigits        = sqlDataReader.GetString(sqlDataReader.GetOrdinal("LastFourDigits")),
                            DiscountAmount        = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("DiscountAmount")),
                            PartnerMerchantId     = (string)Context[Key.PartnerMerchantId],
                            TransactionId         = authorization.TransactionId,
                            TransactionDate       = authorization.PurchaseDateTime,
                            PartnerId             = (int)Context[Key.Partner],
                            ReimbursementTenderId = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("ReimbursementTenderId"))
                        };

                        // Function based partner claimed deal id is not stored (comes as null or empty string). Generate it.
                        if (string.IsNullOrEmpty(redeemedDealInfo.PartnerClaimedDealId))
                        {
                            int cardId = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("CardId"));
                            int dealId = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("DealId"));
                            redeemedDealInfo.PartnerClaimedDealId = General.TwoIntegersToHexString(cardId, dealId);
                        }

                        // Add nullable items.
                        int merchantNameColumnId = sqlDataReader.GetOrdinal("MerchantName");
                        if (sqlDataReader.IsDBNull(merchantNameColumnId) == false)
                        {
                            redeemedDealInfo.MerchantName = sqlDataReader.GetString(merchantNameColumnId);
                        }

                        int parentDealIdColumnId = sqlDataReader.GetOrdinal("ParentDealId");
                        if (sqlDataReader.IsDBNull(parentDealIdColumnId) == false)
                        {
                            redeemedDealInfo.ParentDealId = sqlDataReader.GetGuid(parentDealIdColumnId);
                        }

                        // Populate the context.
                        Context[Key.RedeemedDealInfo] = redeemedDealInfo;
                    }
                });
            }
            // TEMPORARY: Log the disallowed transaction.
            else
            {
                result = ResultCode.NoApplicableDealFound;
                Context.Log.Warning("Transaction disallowed. Card / Allow list mismatch.");
            }

            if (result == ResultCode.Success)
            {
                result = ResultCode.Created;
            }

            return(result);
        }
예제 #36
0
 private void _CancelBT_Click(object sender, EventArgs e)
 {
     General.SafeLaunchEvent(CancelClick, this);
 }
예제 #37
0
 /// <summary>
 /// Getter for the player avatar's rigidbody.
 /// </summary>
 /// <returns></returns>
 public Rigidbody2D GetRigidBody2d()
 {
     General.CheckIfNull(rigidBody2d, "rigidBody2d", scriptName);
     return(this.rigidBody2d);
 }
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        public bool AppendPastedDetail(Idea Target, string DetailName, string MimeType, byte[] DetailContent)
        {
            if (DetailName.IsAbsent() || MimeType.IsAbsent() || DetailContent == null || DetailContent.Length < 1)
            {
                return(false);
            }

            ContainedDetail Detail = null;

            if (MimeType.StartsWith("text/"))
            {
                var Owner   = Ownership.Create <IdeaDefinition, Idea>(Target);
                var Content = DetailContent.BytesToString();
                if (Content.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase))
                {
                    var NewLink = new ResourceLink(Target, new Assignment <DetailDesignator>(
                                                       DomainServices.CreateLinkDesignation(
                                                           Owner,
                                                           DetailName),
                                                       true));
                    NewLink.TargetLocation = Content;
                    Detail = NewLink;
                }
                else
                if (MimeType.EndsWith("/tsv") || MimeType.EndsWith("/csv"))
                {
                    var Delimiter = (MimeType.EndsWith("/csv")
                                         ? General.GetCurrentTextListDelimiter()
                                         : "\t");
                    var TextRecords = General.LoadStreamDelimitedIntoStrings(Content.StringToStream(), Delimiter);

                    var TypingResult = DomainServices.GenerateTypedRecordsList(TextRecords.Item1);

                    var TableDef = DomainServices.CreateCompatibleTableDefinition(Target.OwnerComposition.CompositeContentDomain,
                                                                                  DetailName + " - TableDef",
                                                                                  TypingResult.Item2, TextRecords.Item2);
                    var Designator = new TableDetailDesignator(Owner, TableDef, true, DetailName, DetailName.TextToIdentifier());
                    var NewTable   = new Table(Target, Designator.Assign <DetailDesignator>(true));
                    foreach (var DataRecord in TypingResult.Item1)
                    {
                        NewTable.Add(new TableRecord(NewTable, DataRecord));
                    }

                    Detail = NewTable;
                }
            }

            if (Detail == null)
            {
                var Route = new Uri(DetailName, UriKind.RelativeOrAbsolute);
                Detail = this.CreateIdeaDetailAttachment(Ownership.Create <IdeaDefinition, Idea>(Target),
                                                         Target, DetailName, Route, DetailContent, MimeType);
                if (Detail == null)
                {
                    return(false);
                }
            }

            Target.Details.AddNew(Detail);

            return(true);
        }
예제 #39
0
 private void _OkBT_Click(object sender, EventArgs e)
 {
     General.SafeLaunchEvent(OkClick, this, (Number)_MemLB.SelectedItem);
 }
        public void InjectPastingContentToIdea(View TargetView, Idea TargetIdea, bool InjectAsDetail)
        {
            /*- var Content = General.Execute(() => Clipboard.GetDataObject(),
             *                            "Cannot access Windows Clipboard!").Result;
             * if (Content == null)
             *  return;
             *
             * var Formats = General.Execute(() => Content.GetFormats(false),
             *                            "Cannot access Windows Clipboard!").Result;
             * if (Formats == null)
             *  return; */

            BitmapSource SourceImage = null;
            string       SourceText  = null;

            byte[] Data           = null;
            string MimeType       = "";
            string DetailFileName = ""; // File extension needed to call external editor when editing attachment

            // NOTE: Do not ask with  "if (ClipboardCutTargetView != null) ..."
            // Because the clipboard can be externally written.

            var ContainsCSV = false;

            if (General.Execute(() => (ContainsCSV = Clipboard.ContainsText(TextDataFormat.CommaSeparatedValue)) || Clipboard.ContainsText(),
                                "Cannot access Windows Clipboard!").Result)
            {
                SourceText = General.Execute(() => (ContainsCSV ? Clipboard.GetText(TextDataFormat.CommaSeparatedValue) : Clipboard.GetText()),
                                             "Cannot access Windows Clipboard!").Result;

                if (SourceText != null)
                {
                    // Gets "text/plain": General.GetMimeTypeFromContent(SourceText.StringToBytes())
                    MimeType       = (ContainsCSV ? "text/csv" : General.GetMimeTypeFromContent(SourceText.StringToBytes()));
                    DetailFileName = "Detail " + TargetIdea.Details.Count.ToString() + ".txt";

                    Data = SourceText.StringToBytes();

                    if (InjectAsDetail)
                    {
                        AppendPastedDetail(TargetIdea, DetailFileName, MimeType, Data);
                    }
                    else
                    {
                        TargetIdea.Summary = SourceText;
                    }
                }
            }

            if (General.Execute(() => Clipboard.ContainsImage(),
                                "Cannot access Windows Clipboard!").Result)
            {
                SourceImage = Display.ImageFromClipboardDib();

                if (SourceImage != null)
                {
                    MimeType       = "image/bmp";
                    DetailFileName = "Detail " + TargetIdea.Details.Count.ToString() + ".bmp";

                    if (InjectAsDetail)
                    {
                        Data = SourceImage.ToBytes();
                        AppendPastedDetail(TargetIdea, DetailFileName, MimeType, Data);
                    }
                    else
                    {
                        TargetIdea.Pictogram = SourceImage;
                    }
                }
            }

            //! PENDING: Support pasting CSV and TSV to tables

            TargetIdea.UpdateVisualRepresentators();
        }
        private static void ClipboardPasteCreatingComplements(View TargetView, Point TargetPosition, IEnumerable <string> FilePaths)
        {
            TargetView.EditEngine.StartCommandVariation("Clipboard Paste (creating Complements)");

            if (FilePaths != null)
            {
                foreach (var FilePath in FilePaths)
                {
                    if (FilePath != null && File.Exists(FilePath))
                    {
                        PasteCreateComplement(TargetView, TargetPosition, General.BytesToAppropriateObject(General.FileToBytes(FilePath)));
                    }
                }
            }
            else
            {
                if (General.Execute(() => Clipboard.ContainsImage(), "Cannot access Windows Clipboard!").Result)
                {
                    PasteCreateComplement(TargetView, TargetPosition, Display.ImageFromClipboardDib());
                }

                if (General.Execute(() => Clipboard.ContainsText(), "Cannot access Windows Clipboard!").Result)
                {
                    PasteCreateComplement(TargetView, TargetPosition, General.Execute(() => Clipboard.GetText().ToStringAlways(), "Cannot access Windows Clipboard!").Result);
                }
            }

            TargetView.EditEngine.CompleteCommandVariation();
        }
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        public void ClipboardPaste(View TargetView, bool AsIdeaShortcut = false, Point TargetPosition = default(Point), bool IsDroppingFiles = false)
        {
            if (IsClipboardTransferring && TargetView == ClipboardTransferSourceView)
            {
                UnmarkSelectedObjectsForCut();
                return;
            }

            try
            {
                // Paste Intra-Composition content ............................................................
                if (General.Execute(() => Clipboard.ContainsData(IdeaTransferFormat.Name),
                                    "Cannot access Windows Clipboard!").Result || AsIdeaShortcut)
                {
                    InjectCompositionContentToView(TargetView, AsIdeaShortcut);
                    return;
                }

                // Determine target types
                ExtensionPanel       ExtraOptions = null;
                IEnumerable <string> FilePaths    = null;
                if (General.Execute(() => Clipboard.ContainsFileDropList(),
                                    "Cannot access Windows Clipboard!").Result)
                {
                    FilePaths = General.Execute(() => Clipboard.GetFileDropList().Cast <string>(),
                                                "Cannot access Windows Clipboard!").Result;
                }

                var TargetIdeas = new List <Idea>();
                //- TargetIdeas.Add(TargetView.VisualizedCompositeIdea);

                if (TargetPosition == default(Point) || TargetPosition == Display.NULL_POINT)
                {
                    TargetPosition = TargetView.CurrentPresentationCenter;
                }

                var TargetRep = TargetView.SelectedObjects.Where(vobj => vobj is VisualElement)
                                .Select(vobj => ((VisualElement)vobj).OwnerRepresentation).FirstOrDefault();

                if (General.Execute(() => Clipboard.ContainsText(), "Cannot access Windows Clipboard!").Result ||
                    General.Execute(() => Clipboard.ContainsImage(), "Cannot access Windows Clipboard!").Result ||
                    FilePaths != null)
                {
                    ExtraOptions = CreatePastingExtraOptions(ExtraOptions, TargetRep, FilePaths);
                }

                // Determine target
                string Selection = DetermineTargetRepresentations(TargetView, TargetPosition, ExtraOptions, TargetIdeas, TargetRep, FilePaths);
                if (Selection == null)
                {
                    return;
                }

                if (Selection == VisualComplement.__ClassDefinitor.TechName)
                {
                    ClipboardPasteCreatingComplements(TargetView, TargetPosition, FilePaths);
                }
                else
                {
                    ClipboardPasteIntoIdeas(TargetView, ExtraOptions, FilePaths, TargetIdeas);
                }
            }
            catch (Exception Problem)
            {
                if (TargetView.EditEngine.IsVariating)
                {
                    TargetView.EditEngine.CompleteCommandVariation();
                    TargetView.EditEngine.Undo();
                }
                Console.WriteLine("Cannot Paste content. Problem: " + Problem.Message);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:EnhancedLinks"/> class.
        /// </summary>
        public EnhancedLinks()
        {
            SupportsWorkflow = true;

            // Modified by Hongwei Shen([email protected]) to group the settings
            // 13/9/2005
            SettingItemGroup group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            int groupBase          = (int)group;
            // end of modification

            SettingItem IconPath = null;

            if (portalSettings != null)
            {
                IconPath =
                    new SettingItem(
                        new FolderDataType(HttpContext.Current.Server.MapPath(portalSettings.PortalFullPath),
                                           "IconContainer"));
                IconPath.Value = "IconContainer";
                // Modified by Hongwei Shen
                // IconPath.Order = 5;
                // IconPath.Group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
                IconPath.Order = groupBase + 15;
                IconPath.Group = group;
                // end of modification
                IconPath.EnglishName = "Container for Icons";
                IconPath.Description = "Portal directory for upload used icons";
            }
            _baseSettings.Add("ENHANCEDLINKS_ICONPATH", IconPath);

            ArrayList styleLink = new ArrayList();

            styleLink.Add(new SettingOption(1, General.GetString("ENHANCEDLINKS_DROPDOWNLIST", "DropDownList", null)));
            styleLink.Add(new SettingOption(2, General.GetString("ENHANCEDLINKS_LINKS", "Links", null)));


            SettingItem MaxColums = new SettingItem(new IntegerDataType());

            MaxColums.Value       = "1";
            MaxColums.EnglishName = "Max Colums";
            MaxColums.Description = "Maximun number of colums";
            // Modified by Hongwei Shen
            // MaxColums.Group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            // MaxColums.Order = 10;
            MaxColums.Group = group;
            MaxColums.Order = groupBase + 20;
            // end of modification
            _baseSettings.Add("ENHANCEDLINKS_MAXCOLUMS", MaxColums);

            SettingItem labelStyleLink = new SettingItem(new CustomListDataType(styleLink, "Name", "Val"));

            labelStyleLink.Description = "Select here how your module should look like";
            labelStyleLink.EnglishName = "Style Links";
            labelStyleLink.Value       = "2";
            // Modified by Hongwei Shen
            // abelStyleLink.Group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            // labelStyleLink.Order = 15;
            labelStyleLink.Group = group;
            labelStyleLink.Order = groupBase + 25;
            // end of modification
            _baseSettings.Add("ENHANCEDLINKS_SWITCHERTYPES", labelStyleLink);

            SettingItem ImageDefault = new SettingItem(new StringDataType());

            ImageDefault.Value       = "navLink.gif";
            ImageDefault.EnglishName = "Default Image for link";
            ImageDefault.Description = "Select here a image for links with no special setting image";
            // Modified by Hongwei Shen
            // ImageDefault.Group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            // ImageDefault.Order = 20;
            ImageDefault.Group = group;
            ImageDefault.Order = groupBase + 30;
            // end of modification
            _baseSettings.Add("ENHANCEDLINKS_DEFAULTIMAGE", ImageDefault);

            SettingItem ExpandAll = new SettingItem(new BooleanDataType());

            ExpandAll.Value       = "false";
            ExpandAll.EnglishName = "Show Description";
            ExpandAll.Description = "Mark this if you like to see the description down the link";
            // Modified by Hongwei Shen
            // ExpandAll.Group = SettingItemGroup.MODULE_SPECIAL_SETTINGS;
            // ExpandAll.Order = 25;
            ExpandAll.Group = group;
            ExpandAll.Order = groupBase + 35;
            // end of modification
            _baseSettings.Add("ENHANCEDLINKS_EXPANDALL", ExpandAll);
        }
예제 #44
0
        //
        // This changes the editing mode.
        // Order in which events occur for the old and new modes:
        //
        // - Constructor of new mode is called
        // - Disengage of old mode is called
        // ----- Mode switches -----
        // - Engage of new mode is called
        // - Dispose of old mode is called
        //
        // Returns false when cancelled
        public bool ChangeMode(EditMode nextmode)
        {
            EditMode oldmode = mode;

            if (nextmode != null)
            {
                // Verify that this mode is usable
                bool allowuse = false;
                foreach (EditModeInfo emi in usedmodes)
                {
                    if (emi.Type.FullName == nextmode.GetType().FullName)
                    {
                        allowuse = true;
                        break;
                    }
                }

                if (!allowuse)
                {
                    General.Interface.MessageBeep(MessageBeepType.Error);
                    General.WriteLogLine("Attempt to switch to an invalid edit mode " + nextmode.GetType().Name + "!");
                    return(false);
                }
                else
                {
                    General.WriteLogLine("Preparing to change editing mode to " + nextmode.GetType().Name + "...");
                }
            }
            else
            {
                General.WriteLogLine("Stopping editing mode...");
            }

            // Remember previous mode
            newmode = nextmode;
            if (mode != null)
            {
                prevmode = mode.GetType();
                if (!mode.Attributes.Volatile)
                {
                    prevstablemode = prevmode;
                    if (mode is ClassicMode)
                    {
                        prevclassicmode = prevmode;
                    }
                }
            }
            else
            {
                prevmode        = null;
                prevstablemode  = null;
                prevclassicmode = null;
            }

            // Let the plugins know beforehand and check if not cancelled
            if (General.Plugins.ModeChanges(oldmode, newmode))
            {
                // Disenagage old mode
                disengaging = true;
                if (oldmode != null)
                {
                    General.Plugins.OnEditDisengage(oldmode, newmode);
                    oldmode.OnDisengage();
                }

                // Reset cursor
                General.Interface.SetCursor(Cursors.Default);

                // Apply new mode
                General.WriteLogLine("Editing mode changes from " + TypeNameOrNull(oldmode) + " to " + TypeNameOrNull(nextmode));
                General.WriteLogLine("Previous stable mode is " + TypeNameOrNull(prevstablemode) + ", previous classic mode is " + TypeNameOrNull(prevclassicmode));
                mode        = newmode;
                disengaging = false;

                // Engage new mode
                if (newmode != null)
                {
                    newmode.OnEngage();
                    General.Plugins.OnEditEngage(oldmode, newmode);
                }

                // Bind new switch actions
                UnbindSwitchActions();
                BindAvailableSwitchActions();

                // Update the interface
                General.MainWindow.EditModeChanged();

                // Dispose old mode
                if (oldmode != null)
                {
                    oldmode.Dispose();
                }

                // Done switching
                General.WriteLogLine("Editing mode change complete.");
                newmode = null;

                // Redraw the display
                General.MainWindow.RedrawDisplay();
                return(true);
            }
            else
            {
                // Cancelled
                General.WriteLogLine("Editing mode change cancelled.");
                return(false);
            }
        }
예제 #45
0
 /// <summary>
 /// Getter for the player avatar's animator.
 /// </summary>
 /// <returns></returns>
 public Animator GetPlayerAnimator()
 {
     General.CheckIfNull(playerAnimator, "playerAnimator", scriptName);
     return(this.playerAnimator);
 }
 public GetPaymentProducts()
     : base("GET_PAYMENTPRODUCTS")
 {
     General = new General();
     Params.Parameters.Add(General);
 }
예제 #47
0
 /// <summary>
 /// Getter for the player avatar's collider.
 /// </summary>
 /// <returns></returns>
 public Collider2D GetCollider2d()
 {
     General.CheckIfNull(collider2d, "collider2d", scriptName);
     return(this.collider2d);
 }
예제 #48
0
 public override void OnHelp()
 {
     General.ShowHelp("e_drawgeometry.html");
 }
예제 #49
0
        // This requests loading the image
        protected virtual void LocalLoadImage()
        {
            lock (this) lock (bitmap ?? bitmapLocker)
                {
                    // Bitmap loaded successfully?
                    if (bitmap != null)
                    {
                        // Bitmap has incorrect format?
                        if (bitmap.PixelFormat != PixelFormat.Format32bppArgb)
                        {
                            if (dynamictexture)
                            {
                                throw new Exception("Dynamic images must be in 32 bits ARGB format.");
                            }

                            //General.ErrorLogger.Add(ErrorType.Warning, "Image '" + name + "' does not have A8R8G8B8 pixel format. Conversion was needed.");
                            Bitmap oldbitmap = bitmap;
                            try
                            {
                                // Convert to desired pixel format
                                bitmap = new Bitmap(oldbitmap.Size.Width, oldbitmap.Size.Height, PixelFormat.Format32bppArgb);
                                Graphics g = Graphics.FromImage(bitmap);
                                g.PageUnit           = GraphicsUnit.Pixel;
                                g.CompositingQuality = CompositingQuality.HighQuality;
                                g.InterpolationMode  = InterpolationMode.NearestNeighbor;
                                g.SmoothingMode      = SmoothingMode.None;
                                g.PixelOffsetMode    = PixelOffsetMode.None;
                                g.Clear(Color.Transparent);
                                g.DrawImage(oldbitmap, 0, 0, oldbitmap.Size.Width, oldbitmap.Size.Height);
                                g.Dispose();
                                oldbitmap.Dispose();
                            }
                            catch (Exception e)
                            {
                                bitmap = oldbitmap;
                                General.ErrorLogger.Add(ErrorType.Warning, "Cannot lock image \"" + name + "\" for pixel format conversion. The image may not be displayed correctly.\n" + e.GetType().Name + ": " + e.Message);
                            }
                        }

                        // This applies brightness correction on the image
                        if (usecolorcorrection)
                        {
                            BitmapData bmpdata = null;

                            try
                            {
                                // Try locking the bitmap
                                bmpdata = bitmap.LockBits(new Rectangle(0, 0, bitmap.Size.Width, bitmap.Size.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
                            }
                            catch (Exception e)
                            {
                                General.ErrorLogger.Add(ErrorType.Warning, "Cannot lock image \"" + name + "\" for color correction. The image may not be displayed correctly.\n" + e.GetType().Name + ": " + e.Message);
                            }

                            // Bitmap locked?
                            if (bmpdata != null)
                            {
                                // Apply color correction
                                PixelColor *pixels = (PixelColor *)(bmpdata.Scan0.ToPointer());
                                General.Colors.ApplyColorCorrection(pixels, bmpdata.Width * bmpdata.Height);
                                bitmap.UnlockBits(bmpdata);
                            }
                        }
                    }
                    else
                    {
                        // Loading failed
                        // We still mark the image as ready so that it will
                        // not try loading again until Reload Resources is used
                        loadfailed = true;
                        bitmap     = new Bitmap(Properties.Resources.Failed);
                    }

                    if (bitmap != null)
                    {
                        width  = bitmap.Size.Width;
                        height = bitmap.Size.Height;

                        if (dynamictexture)
                        {
                            if ((width != General.NextPowerOf2(width)) || (height != General.NextPowerOf2(height)))
                            {
                                throw new Exception("Dynamic images must have a size in powers of 2.");
                            }
                        }

                        // Do we still have to set a scale?
                        if ((scale.x == 0.0f) && (scale.y == 0.0f))
                        {
                            if ((General.Map != null) && (General.Map.Config != null))
                            {
                                scale.x = General.Map.Config.DefaultTextureScale;
                                scale.y = General.Map.Config.DefaultTextureScale;
                            }
                            else
                            {
                                scale.x = 1.0f;
                                scale.y = 1.0f;
                            }
                        }

                        if (!loadfailed)
                        {
                            //mxd. Check translucency and calculate average color?
                            if (General.Map != null && General.Map.Data != null && General.Map.Data.GlowingFlats != null &&
                                General.Map.Data.GlowingFlats.ContainsKey(longname) &&
                                General.Map.Data.GlowingFlats[longname].CalculateTextureColor)
                            {
                                BitmapData bmpdata = null;
                                try
                                {
                                    bmpdata = bitmap.LockBits(new Rectangle(0, 0, bitmap.Size.Width, bitmap.Size.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
                                }
                                catch (Exception e)
                                {
                                    General.ErrorLogger.Add(ErrorType.Error, "Cannot lock image \"" + this.filepathname + "\" for glow color calculation. " + e.GetType().Name + ": " + e.Message);
                                }

                                if (bmpdata != null)
                                {
                                    PixelColor *pixels    = (PixelColor *)(bmpdata.Scan0.ToPointer());
                                    int         numpixels = bmpdata.Width * bmpdata.Height;
                                    uint        r         = 0;
                                    uint        g         = 0;
                                    uint        b         = 0;

                                    for (PixelColor *cp = pixels + numpixels - 1; cp >= pixels; cp--)
                                    {
                                        r += cp->r;
                                        g += cp->g;
                                        b += cp->b;

                                        // Also check alpha
                                        if (cp->a > 0 && cp->a < 255)
                                        {
                                            istranslucent = true;
                                        }
                                        else if (cp->a == 0)
                                        {
                                            ismasked = true;
                                        }
                                    }

                                    // Update glow data
                                    int br = (int)(r / numpixels);
                                    int bg = (int)(g / numpixels);
                                    int bb = (int)(b / numpixels);

                                    int max = Math.Max(br, Math.Max(bg, bb));

                                    // Black can't glow...
                                    if (max == 0)
                                    {
                                        General.Map.Data.GlowingFlats.Remove(longname);
                                    }
                                    else
                                    {
                                        // That's how it's done in GZDoom (and I may be totally wrong about this)
                                        br = Math.Min(255, br * 153 / max);
                                        bg = Math.Min(255, bg * 153 / max);
                                        bb = Math.Min(255, bb * 153 / max);

                                        General.Map.Data.GlowingFlats[longname].Color = new PixelColor(255, (byte)br, (byte)bg, (byte)bb);
                                        General.Map.Data.GlowingFlats[longname].CalculateTextureColor = false;
                                        if (!General.Map.Data.GlowingFlats[longname].Fullbright)
                                        {
                                            General.Map.Data.GlowingFlats[longname].Brightness = (br + bg + bb) / 3;
                                        }
                                    }

                                    // Release the data
                                    bitmap.UnlockBits(bmpdata);
                                }
                            }
                            //mxd. Check if the texture is translucent
                            else
                            {
                                BitmapData bmpdata = null;
                                try
                                {
                                    bmpdata = bitmap.LockBits(new Rectangle(0, 0, bitmap.Size.Width, bitmap.Size.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
                                }
                                catch (Exception e)
                                {
                                    General.ErrorLogger.Add(ErrorType.Error, "Cannot lock image \"" + this.filepathname + "\" for translucency check. " + e.GetType().Name + ": " + e.Message);
                                }

                                if (bmpdata != null)
                                {
                                    PixelColor *pixels    = (PixelColor *)(bmpdata.Scan0.ToPointer());
                                    int         numpixels = bmpdata.Width * bmpdata.Height;

                                    for (PixelColor *cp = pixels + numpixels - 1; cp >= pixels; cp--)
                                    {
                                        // Check alpha
                                        if (cp->a > 0 && cp->a < 255)
                                        {
                                            istranslucent = true;
                                        }
                                        else if (cp->a == 0)
                                        {
                                            ismasked = true;
                                        }
                                    }

                                    // Release the data
                                    bitmap.UnlockBits(bmpdata);
                                }
                            }
                        }
                    }

                    // Image is ready
                    imagestate = ImageLoadState.Ready;
                }
        }
        /// <summary>
        /// Ask the user to select one or more event log files, import the data contained in each of the files into an event log file structure and return
        /// this event log file structure.
        /// </summary>
        /// <remarks>The filename and header fileds associated with the new event log file structure will be set to those values associated with
        /// the first file included in the list.</remarks>
        /// <returns>The event log file containing all of the imported event date.</returns>
        public EventLogFile_t ImportEventLogFiles()
        {
            // Create a structure to contain all of the imported data.
            EventLogFile_t eventLogFile = new EventLogFile_t();

            eventLogFile.EventRecordList = new List <EventRecord>();

            Debug.Assert(MainWindow != null, "MenuInterface.ShowEventLogFile() - [MainWindow != null]");


            string[] fullFilenames = General.FileDialogOpenFileMultiSelect(Resources.FileDialogOpenTitleEventLog,
                                                                           CommonConstants.ExtensionEventLog,
                                                                           Resources.FileDialogOpenFilterEventLog,
                                                                           InitialDirectory.EventLogsRead);

            // Skip, if the user didn't select a file.
            if (fullFilenames.Length == 0)
            {
                MainWindow.Cursor = Cursors.Default;
                return(eventLogFile);
            }

            // Update the initial directory with the path of the selected files.
            InitialDirectory.EventLogsRead = Path.GetDirectoryName(fullFilenames[0]);

            // Create a structure to contain the data contained within each selected file.
            EventLogFile_t currentEventLogFile;
            FileInfo       fileInfo;

            for (int fileIndex = 0; fileIndex < fullFilenames.Length; fileIndex++)
            {
                fileInfo = new FileInfo(fullFilenames[fileIndex]);
                MainWindow.WriteStatusMessage(string.Format(Resources.SMLoadFile, fileInfo.Name));

                currentEventLogFile = FileHandling.Load <EventLogFile_t>(fullFilenames[fileIndex], FileHandling.FormatType.Xml);

                // Ensure that the de-serialized file contains data.
                if (currentEventLogFile.EventRecordList == null)
                {
                    // File format is not recognised, report message.
                    MessageBox.Show(string.Format(Resources.MBTFormatNotRecognized, fileInfo.Name), Resources.MBCaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    continue;
                }

                // Ensure that the selected log file is associated with the current project.
                if (currentEventLogFile.Header.ProjectInformation.ProjectIdentifier != Parameter.ProjectInformation.ProjectIdentifier)
                {
                    MessageBox.Show(string.Format(Resources.MBTProjectIdMismatchMultipleImport, fileInfo.Name), Resources.MBCaptionError, MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    continue;
                }

                // -------------------------------------
                // The current file is valid, import it.
                // -------------------------------------
                // Use the header and filename associated with the first entry in the file list.
                if (fileIndex == 0)
                {
                    eventLogFile.Header       = currentEventLogFile.Header;
                    eventLogFile.Filename     = fileInfo.Name;
                    eventLogFile.FullFilename = fileInfo.FullName;
                }

                // Append the events contained within the current file into the existing event records.
                bool duplicationsFound;
                eventLogFile.AppendEventRecordList(currentEventLogFile.EventRecordList, out duplicationsFound);
            }

            MainWindow.WriteStatusMessage(string.Empty);
            return(eventLogFile);
        }
 /// <summary>
 /// Deprecated. Used for backwards compatibility with single card burning.
 /// </summary>
 /// <param name="card"></param>
 public void ChangeImage(Card card)
 {
     this.GetCardImage().sprite = General.GetCardSprite(card.GetCardSuit(),
                                                        GameMaster.Instance.GetCurPlayer().playerNo, card.GetCardRank());
 }
예제 #52
0
        public configurationController(
            IApplicationLifetime applicationLifetime,
            IWritableOptions <General> general_options,
            IWritableOptions <Database> database_options,
            IWritableOptions <Comments> comment_options,
            IWritableOptions <Smtp> smtp_options,
            IWritableOptions <Media> media_options,
            IWritableOptions <Features> features_options,
            IWritableOptions <Listing> listings_options,
            IWritableOptions <Authentication> authentication_options,
            IWritableOptions <Registration> registration_options,
            IWritableOptions <Aws> aws_options,
            IWritableOptions <Social> social_options,
            IWritableOptions <Contact> contact_options,
            IWritableOptions <Rechapcha> rechapcha_options,
            IWritableOptions <ElasticSearch> elasticsearch_options,
            IWritableOptions <ActiveCompaign> activecompany_options,
            IWritableOptions <Zendesk> zendesk_options,
            IOptions <General> generalSettings,
            IOptions <Comments> commentSettings,
            IOptions <Smtp> smtpSettings,
            IOptions <Media> mediaSettings,
            IOptions <Features> featureSettings,
            IOptions <Listing> listingSettings,
            IOptions <Authentication> authenticationSettings,
            IOptions <Registration> registrationSettings,
            IOptions <Aws> awsSettings,
            IOptions <Social> socialSettings,
            IOptions <Contact> contactSettings,
            IOptions <Rechapcha> rechapchaSettings,
            IOptions <ElasticSearch> elasticSearchSettings,
            IOptions <Zendesk> zendeskSettings,
            IOptions <ActiveCompaign> activeSettings,
            IOptions <Jugnoon.Blogs.Settings.General> blogs_general_Settings,
            IOptions <Jugnoon.Blogs.Settings.Aws> blogs_aws_Settings,
            ApplicationDbContext context

            )
        {
            _context = context;
            // writable injectors
            _database_options       = database_options;
            _general_options        = general_options;
            _comment_options        = comment_options;
            _smtp_options           = smtp_options;
            _media_options          = media_options;
            _features_options       = features_options;
            _listings_options       = listings_options;
            _authentication_options = authentication_options;
            _registration_options   = registration_options;
            _aws_options            = aws_options;
            _social_options         = social_options;
            _contact_options        = contact_options;
            _rechapcha_options      = rechapcha_options;
            _elasticsearch_options  = elasticsearch_options;
            _activecompaign_options = activecompany_options;
            _zendesk_options        = zendesk_options;

            ApplicationLifetime = applicationLifetime;
            // readable injectors
            _generalSettings        = generalSettings.Value;
            _commentSettings        = commentSettings.Value;
            _smtpSettings           = smtpSettings.Value;
            _mediaSettings          = mediaSettings.Value;
            _featureSettings        = featureSettings.Value;
            _listingSettings        = listingSettings.Value;
            _authenticationSettings = authenticationSettings.Value;
            _registrationSettings   = registrationSettings.Value;
            _awsSettings            = awsSettings.Value;

            _socialSettings        = socialSettings.Value;
            _contactSettings       = contactSettings.Value;
            _rechapchaSettings     = rechapchaSettings.Value;
            _elasticSearchSettings = elasticSearchSettings.Value;
            _zendeskSettings       = zendeskSettings.Value;
            _activeSettings        = activeSettings.Value;

            _blogs_general_Settings = blogs_general_Settings.Value;
            _blogs_aws_Settings     = blogs_aws_Settings.Value;
        }
 public MotorMakeYear()
 {
     master = Master as General;
 }
예제 #54
0
        private void BindData()
        {
            int userID = ( int )Security.StringToLongOrRedirect(Request.QueryString ["u"]);

            MembershipUser user = UserMembershipHelper.GetMembershipUser(userID);

            if (user == null)
            {
                YafBuildLink.AccessDenied(/*No such user exists*/);
            }

            YafCombinedUserData userData = new YafCombinedUserData(user, userID);

            // populate user information controls...
            UserName.Text        = HtmlEncode(userData.Membership.UserName);
            Name.Text            = HtmlEncode(userData.Membership.UserName);
            Joined.Text          = String.Format("{0}", YafDateTime.FormatDateLong(Convert.ToDateTime(userData.Joined)));
            LastVisit.Text       = YafDateTime.FormatDateTime(userData.LastVisit);
            Rank.Text            = userData.RankName;
            Location.Text        = HtmlEncode(General.BadWordReplace(userData.Profile.Location));
            RealName.InnerHtml   = HtmlEncode(General.BadWordReplace(userData.Profile.RealName));
            Interests.InnerHtml  = HtmlEncode(General.BadWordReplace(userData.Profile.Interests));
            Occupation.InnerHtml = HtmlEncode(General.BadWordReplace(userData.Profile.Occupation));
            Gender.InnerText     = GetText("GENDER" + userData.Profile.Gender);

            PageLinks.Clear();
            PageLinks.AddLink(PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum));
            PageLinks.AddLink(GetText("MEMBERS"), YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.members));
            PageLinks.AddLink(userData.Membership.UserName, "");

            double dAllPosts = 0.0;

            if (SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumPostsForum"]) > 0)
            {
                dAllPosts = 100.0 * SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumPosts"]) / SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumPostsForum"]);
            }

            Stats.InnerHtml = String.Format("{0:N0}<br/>[{1} / {2}]",
                                            userData.DBRow ["NumPosts"],
                                            String.Format(GetText("NUMALL"), dAllPosts),
                                            String.Format(GetText("NUMDAY"), (double)SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumPosts"]) / SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumDays"]))
                                            );

            // private messages
            ///CHANGED THIS ON 12/1/2010
            //PM.Visible = !userData.IsGuest && User != null && PageContext.BoardSettings.AllowPrivateMessages;
            PM.Visible = false;

            PM.NavigateUrl = YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.pmessage, "u={0}", userData.UserID);

            // email link
            Email.Visible     = !userData.IsGuest && User != null && PageContext.BoardSettings.AllowEmailSending;
            Email.NavigateUrl = YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.im_email, "u={0}", userData.UserID);
            if (PageContext.IsAdmin)
            {
                Email.TitleNonLocalized = userData.Membership.Email;
            }

            // homepage link
            Home.Visible = !String.IsNullOrEmpty(userData.Profile.Homepage);
            SetupThemeButtonWithLink(Home, userData.Profile.Homepage);

            // blog link
            Blog.Visible = !String.IsNullOrEmpty(userData.Profile.Blog);
            SetupThemeButtonWithLink(Blog, userData.Profile.Blog);

            MSN.Visible     = (User != null && !String.IsNullOrEmpty(userData.Profile.MSN));
            MSN.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_email, "u={0}", userData.UserID);

            YIM.Visible     = (User != null && !String.IsNullOrEmpty(userData.Profile.YIM));
            YIM.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_yim, "u={0}", userData.UserID);

            AIM.Visible     = (User != null && !String.IsNullOrEmpty(userData.Profile.AIM));
            AIM.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_aim, "u={0}", userData.UserID);

            ICQ.Visible     = (User != null && !String.IsNullOrEmpty(userData.Profile.ICQ));
            ICQ.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_icq, "u={0}", userData.UserID);

            Skype.Visible     = (User != null && !String.IsNullOrEmpty(userData.Profile.Skype));
            Skype.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_skype, "u={0}", userData.UserID);

            // localize tab titles...
            AboutTab.HeaderText       = GetText("ABOUT");
            StatisticsTab.HeaderText  = GetText("STATISTICS");
            AvatarTab.HeaderText      = GetText("AVATAR");
            Last10PostsTab.HeaderText = GetText("LAST10");

            if (PageContext.BoardSettings.AvatarUpload && userData.HasAvatarImage)
            {
                Avatar.ImageUrl = YafForumInfo.ForumRoot + "resource.ashx?u=" + (userID);
            }
            else if (!String.IsNullOrEmpty(userData.Avatar))                 // Took out PageContext.BoardSettings.AvatarRemote
            {
                Avatar.ImageUrl = String.Format("{3}resource.ashx?url={0}&width={1}&height={2}",
                                                Server.UrlEncode(userData.Avatar),
                                                PageContext.BoardSettings.AvatarWidth,
                                                PageContext.BoardSettings.AvatarHeight,
                                                YafForumInfo.ForumRoot);
            }
            else
            {
                Avatar.Visible    = false;
                AvatarTab.Visible = false;
            }

            Groups.DataSource = Roles.GetRolesForUser(UserMembershipHelper.GetUserNameFromID(userID));

            //EmailRow.Visible = PageContext.IsAdmin;
            ModerateTab.Visible     = PageContext.IsAdmin || PageContext.IsForumModerator;
            AdminUserButton.Visible = PageContext.IsAdmin;

            if (LastPosts.Visible)
            {
                LastPosts.DataSource   = YAF.Classes.Data.DB.post_last10user(PageContext.PageBoardID, Request.QueryString ["u"], PageContext.PageUserID);
                SearchUser.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.search,
                                                                                          "postedby={0}",
                                                                                          userData.Membership.UserName);
            }

            DataBind();
        }
예제 #55
0
            public void Start()
            {
                var isXml    = false;
                var xml      = string.Empty;
                var duration = DateTime.Now;

                Connections++;
                Debug.WriteLine("Connections: {0}", Connections);
                try
                {
                    Debug.WriteLine("PipeConnection [{0}]: Connected:{1}", _stream.GetHashCode(), _stream.IsConnected);
                    while (_stream.IsConnected)
                    {
                        var temp = _reader.ReadLine();
                        if (temp == null)
                        {
                            Thread.Sleep(Program.Sleeptime);
                            continue;
                        }
                        if (temp.Equals("END"))
                        {
                            Debug.WriteLine("PipeConnection [{0}]: Duration:{1} XML:{2}", _stream.GetHashCode(), General.DateSubtract(duration, false), xml);
                            HandleXml(xml);
                        }

                        if (temp.StartsWith("XML:"))
                        {
                            temp  = temp.Substring(4);
                            isXml = true;
                        }

                        if (isXml)
                        {
                            xml += temp + "\n";
                        }
                        else
                        {
                            Debug.WriteLine("PipeConnection [{0}]: Duration:{1} Data:{2}", _stream.GetHashCode(), General.DateSubtract(duration, false), temp);
                            HandleMsg(temp);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                Debug.WriteLine("PipeConnection [{0}]: Connected:{1} Duration:{2}ms", _stream.GetHashCode(), _stream.IsConnected, General.DateSubtract(duration, false));
                Dispose();
                Connections--;
            }
예제 #56
0
        const int MAX_PREVIEW_SIZE = 256; //mxd

        // This makes a preview for the given image and updates the image settings
        private void MakeImagePreview(LocalLoadResult loadResult)
        {
            if (loadResult.bitmap == null)
            {
                return;
            }

            Bitmap image = loadResult.bitmap;
            Bitmap preview;

            int imagewidth  = image.Width;
            int imageheight = image.Height;

            // Determine preview size
            float scalex        = (imagewidth > MAX_PREVIEW_SIZE) ? (MAX_PREVIEW_SIZE / (float)imagewidth) : 1.0f;
            float scaley        = (imageheight > MAX_PREVIEW_SIZE) ? (MAX_PREVIEW_SIZE / (float)imageheight) : 1.0f;
            float scale         = Math.Min(scalex, scaley);
            int   previewwidth  = (int)(imagewidth * scale);
            int   previewheight = (int)(imageheight * scale);

            if (previewwidth < 1)
            {
                previewwidth = 1;
            }
            if (previewheight < 1)
            {
                previewheight = 1;
            }

            //mxd. Expected and actual image sizes and format match?
            if (previewwidth == imagewidth && previewheight == imageheight && image.PixelFormat == PixelFormat.Format32bppArgb)
            {
                preview = new Bitmap(image);
            }
            else
            {
                // Make new image
                preview = new Bitmap(previewwidth, previewheight, PixelFormat.Format32bppArgb);
                Graphics g = Graphics.FromImage(preview);
                g.PageUnit = GraphicsUnit.Pixel;
                //g.CompositingQuality = CompositingQuality.HighQuality; //mxd
                g.InterpolationMode = InterpolationMode.NearestNeighbor;
                //g.SmoothingMode = SmoothingMode.HighQuality; //mxd
                g.PixelOffsetMode = PixelOffsetMode.None;
                //g.Clear(Color.Transparent); //mxd

                // Draw image onto atlas
                Rectangle  atlasrect = new Rectangle(0, 0, previewwidth, previewheight);
                RectangleF imgrect   = General.MakeZoomedRect(new Size(imagewidth, imageheight), atlasrect);
                if (imgrect.Width < 1.0f)
                {
                    imgrect.X    -= 0.5f - imgrect.Width * 0.5f;
                    imgrect.Width = 1.0f;
                }
                if (imgrect.Height < 1.0f)
                {
                    imgrect.Y     -= 0.5f - imgrect.Height * 0.5f;
                    imgrect.Height = 1.0f;
                }
                g.DrawImage(image, imgrect);
                g.Dispose();
            }

            loadResult.preview = preview;
        }
예제 #57
0
        public static List <WMOrders> GetList(out int pageCount, string userId = null, string orderId = null, DateTime?minDate = null, DateTime?maxDate = null, int payId = 0, int paid = -1, int state = 0, int pageIndex = 0, int pageSize = 0)
        {
            List <WMOrders> list    = null;
            bool            isUser  = !General.IsNullable(userId);
            bool            isOrder = !General.IsNullable(orderId);
            DateTime        min     = minDate.HasValue ? minDate.Value : DateTime.MinValue;
            DateTime        max     = maxDate.HasValue ? maxDate.Value : DateTime.MaxValue;

            pageCount = 0;

            using (WMContext context = new WMContext())
            {
                var query = (
                    from o in context.Orders
                    join u in context.Users on o.UserId equals u.Id
                    join p in context.Options on o.PayId equals p.Id
                    join s in context.Options on o.StatusId equals s.Id
                    join pv in context.Regions on o.ProvinceId equals pv.Id
                    join city in context.Regions on o.CityId equals city.Id
                    join area in context.Regions on o.AreaId equals area.Id
                    where (isUser ? o.UserId.Equals(userId) : true) &&
                    (isOrder ? o.Id.Contains(orderId) : true) &&
                    o.AddDate >= min &&
                    o.AddDate <= max &&
                    (payId > 0 ? o.PayId == payId : true) &&
                    (state > 0 ? o.StatusId == state : true) &&
                    (paid >= 0 ? (o.Paid == (paid == 1)) : true)
                    orderby o.AddDate descending
                    select new WMOrders
                {
                    Id = o.Id,
                    UserId = o.UserId,
                    NickName = u.NickName,
                    ProvinceId = o.ProvinceId,
                    ProvinceName = pv.Name,
                    CityId = o.CityId,
                    CityName = city.Name,
                    AreaId = o.AreaId,
                    AreaName = area.Name,
                    Contact = o.Contact,
                    Address = o.Address,
                    Phone = o.Phone,
                    ZipCode = o.ZipCode,
                    PayId = o.PayId,
                    PayName = p.Name,
                    Paid = o.Paid,
                    Freight = o.Freight,
                    Message = o.Message,
                    StatusId = o.StatusId,
                    StatusName = s.Name,
                    AddDate = o.AddDate
                }
                    );

                if (query != null)
                {
                    pageCount = query.Count();

                    if (pageIndex >= 0 && pageSize > 0)
                    {
                        query = query.Skip(pageIndex * pageSize).Take(pageSize);
                    }

                    list = query.ToList();
                }
            }

            return(list);
        }
예제 #58
0
 //page unload
 protected void Page_Unload(object sender, EventArgs e)
 {
     CamperAppl = null;
     objGeneral = null;
 }
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        public bool ClipboardCopy(View SourceView)
        {
            if (!SourceView.SelectedObjects.Any())
            {
                return(false);
            }

            ClipboardTransferSourceView = SourceView;   // must be before the unmarking

            UnmarkSelectedObjectsForCut();

            General.Execute(() => Clipboard.Clear(), "Cannot access Windows Clipboard!");
            ClipboardTransferSelectedObjects = SourceView.SelectedObjects.Where(vobj => vobj is VisualElement || vobj is VisualComplement).ToList();

            string Data          = null;
            var    DataContainer = new DataObject();

            // Copy Idea's visual representations Guids
            var VisRespsGuids = new StringBuilder();

            try
            {
                // Copy visual Representations and individual Complements Guids and Drawings
                var  DrawingComponents      = new Dictionary <Drawing, int>(); // Temporal storage for Drawing and z-order per object
                Rect TotalBounds            = Rect.Empty;
                var  SelectedRepresentators = ClipboardTransferSelectedObjects.CastAs <VisualElement, VisualObject>()
                                              .Select(velem => velem.OwnerRepresentation).Distinct();
                foreach (var Selection in SelectedRepresentators)
                {
                    VisRespsGuids.Append(Selection.GlobalId.ToString() + '\t');

                    var NewDrawings = Selection.CreateIntegralGraphic();
                    foreach (var NewDraw in NewDrawings)
                    {
                        TotalBounds = Rect.Union(TotalBounds, NewDraw.Key.Bounds);
                        DrawingComponents.Add(NewDraw.Key, NewDraw.Value);
                    }
                }

                var SelectedComplements = ClipboardTransferSelectedObjects.CastAs <VisualComplement, VisualObject>()
                                          .Where(vcomp => vcomp.Target.IsGlobal);
                foreach (var Selection in SelectedComplements)
                {
                    // Consider to append individual Complements?
                    // VisRespsGuids.Append(Selection.GlobalId.ToString() + '\t');

                    var NewDraw = Selection.CreateDraw(false);
                    TotalBounds = Rect.Union(TotalBounds, NewDraw.Bounds);
                    DrawingComponents.Add(NewDraw, Selection.ZOrder);
                }

                Data = VisRespsGuids.ToString();
                DataContainer.SetData(IdeaTransferFormat.Name, Data);

                // Draw considering z-order
                var DrawnObjects = new DrawingGroup();
                foreach (var DrawComponent in DrawingComponents.OrderBy(cmp => cmp.Value))
                {
                    DrawnObjects.Children.Add(DrawComponent.Key);
                }

                // Set margin
                TotalBounds = new Rect(TotalBounds.X - View.SNAPSHOT_MARGIN, TotalBounds.Y - View.SNAPSHOT_MARGIN,
                                       TotalBounds.Width + View.SNAPSHOT_MARGIN * 2.0, TotalBounds.Height + View.SNAPSHOT_MARGIN * 2.0);

                // Adjust position
                DrawnObjects.Transform = new TranslateTransform(-TotalBounds.X, -TotalBounds.Y);

                DrawnObjects.Children.Insert(0, new GeometryDrawing(Brushes.White, null, new RectangleGeometry(TotalBounds)));

                // Render to bitmap
                var Result = DrawnObjects.RenderToDrawingVisual().RenderToBitmap((int)TotalBounds.Width, (int)TotalBounds.Height);

                DataContainer.SetImage(Result);

                // Copy also as text only when pressing [Alt] (which takes precedence over image when pasting in MS-Office)
                if (Keyboard.IsKeyDown(Key.LeftAlt) || Keyboard.IsKeyDown(Key.RightAlt))
                {
                    // Copy only Ideas synopsis (without duplicates from shortcuts or synonyms)
                    var Ideas         = ClipboardTransferSelectedObjects.CastAs <VisualElement, VisualObject>().Select(velem => velem.OwnerRepresentation.RepresentedIdea).Distinct();
                    var IdeasSynopsis = new StringBuilder();

                    foreach (var Selection in Ideas)
                    {
                        IdeasSynopsis.AppendLine(Selection.GetTextSynopsis());
                    }

                    Data = IdeasSynopsis.ToString();
                    DataContainer.SetText(Data);
                }

                General.Execute(() => Clipboard.SetDataObject(DataContainer), "Cannot access Windows Clipboard!");
            }
            catch (Exception Problem)
            {
                Console.WriteLine("Cannot Copy content and place it into clipboard. Problem: " + Problem.Message);
                return(false);
            }

            return(true);
        }
예제 #60
0
        public static List <SalesPersonPerformanceVM> Select_SalesPersonPerformance(string dealerCode)
        {
            List <SalesPersonPerformanceVM> lst = new List <SalesPersonPerformanceVM>();
            DataTable dt = new DataTable();

            try
            {
                SqlParameter[] param =
                {
                    new SqlParameter("@EmpCode",    AuthBase.EmpCode),
                    new SqlParameter("@DealerCode", dealerCode)
                };

                dt = DataAccess.getDataTable("Select_SalesPersonPerformance ", param, General.GetBMSConString());
                if (dt.Rows.Count > 0)
                {
                    lst = EnumerableExtension.ToList <SalesPersonPerformanceVM>(dt);
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(lst);
        }