예제 #1
0
        /// <summary>
        /// This function fetches data for comboboxes based on the input parameter
        /// </summary>
        /// <param name="lCtrlName"></param>
        /// <returns></returns>
        public DataTable FetchControlData(ControlName lCtrlName)
        {
            string         lQuery    = string.Empty;
            OracleProvider lProvider = new OracleProvider();

            switch (lCtrlName)
            {
            case ControlName.AssignedTo:
                lQuery = "Select EMP_LANID, LAST_NAME||', '||FIRST_NAME AS FullName from T_USERS_ACCESS where ACCESS_GROUP='ADMIN' order by 2";
                break;

            case ControlName.OrganizationType:
                lQuery = "Select LOOKUP_ID, LOOKUP_DESC from T_LOOKUP where  LOOKUP_GROUP='ORG_TYPE' and DELETED is Null order by 2";
                break;

            case ControlName.OrganizationProvince:
                lQuery = "Select LOOKUP_ID, LOOKUP_DESC from T_LOOKUP where  LOOKUP_GROUP='PROV' and DELETED is Null order by 2";
                break;

            case ControlName.PayableProvince:
                lQuery = "Select LOOKUP_ID, LOOKUP_DESC from T_LOOKUP where  LOOKUP_GROUP='PROV' and DELETED is Null order by 2";
                break;

            case ControlName.RequestType:
                lQuery = "Select LOOKUP_ID, LOOKUP_DESC from T_LOOKUP where  LOOKUP_GROUP='REQTYPE' and DELETED is Null order by 2";
                break;
            }

            return(lProvider.FetchDataFromDB(lQuery));
        }
예제 #2
0
 public static void RemoveControl(ControlName controlName, ControlsListener controlsListener)
 {
     if (listeners.ContainsKey(controlName) && listeners[controlName].Contains(controlsListener))
     {
         listeners[controlName].Remove(controlsListener);
     }
 }
 public DalControlName MapToDal(ControlName entity)
 {
     return(new DalControlName
     {
         Id = entity.id,
         Name = entity.name
     });
 }
예제 #4
0
        /// <summary>
        /// Gets an instance of the <see cref="ControlChangeEvent"/> corresponding to the specified controller.
        /// </summary>
        /// <param name="controlName"><see cref="ControlName"/> to get an event for.</param>
        /// <param name="controlValue">Controller value to set to event.</param>
        /// <param name="channel">Channel an event should be created for.</param>
        /// <returns>An instance of the <see cref="ControlChangeEvent"/> corresponding to the <paramref name="controlName"/>.</returns>
        /// <exception cref="InvalidEnumArgumentException"><paramref name="controlName"/> specified an invalid value.</exception>
        public static ControlChangeEvent GetControlChangeEvent(this ControlName controlName, SevenBitNumber controlValue, FourBitNumber channel)
        {
            ThrowIfArgument.IsInvalidEnumValue(nameof(controlName), controlName);

            return(new ControlChangeEvent(controlName.AsSevenBitNumber(), controlValue)
            {
                Channel = channel
            });
        }
예제 #5
0
            public AxisControl(ControlName name, Quaternion rot, Quaternion rot2D, Color color)
            {
                this._controlName = name;
                this.rotation     = rot;
                this.rotation2D   = rot2D;
                this.colour       = color;

                this.alpha.speed = 5f;
                this.alpha.value = 1f;
            }
예제 #6
0
 public static void AddControl(ControlName controlName, ControlsListener controlsListener)
 {
     if (!listeners.ContainsKey(controlName))
     {
         listeners.Add(controlName, new List <ControlsListener>());
     }
     if (!listeners[controlName].Contains(controlsListener))
     {
         listeners[controlName].Add(controlsListener);
     }
 }
예제 #7
0
            public void ChangeInput(string _input, string _button, bool _usesAxis, int position)
            {
                //If the input dosen't exist create it
                if (!controls.ContainsKey(_input))
                    controls.Add(_input, new List<ControlName>());

                //Make sure we have an input to replace
                while (controls[_input].Count < position + 1)
                    controls[_input].Add(new ControlName("", false));

                controls[_input][position] = new ControlName(_button, _usesAxis);
            }
예제 #8
0
 // override object.GetHashCode
 public override int GetHashCode()
 {
     return(ControlName.GetHashCode());
 }
예제 #9
0
        /// <summary>
        /// Converts <see cref="ControlName"/> to the corresponding value of the <see cref="SevenBitNumber"/> type.
        /// </summary>
        /// <param name="controlName"><see cref="ControlName"/> to convert to <see cref="SevenBitNumber"/>.</param>
        /// <returns><see cref="SevenBitNumber"/> representing the <paramref name="controlName"/>.</returns>
        /// <exception cref="InvalidEnumArgumentException"><paramref name="controlName"/> specified an invalid value.</exception>
        public static SevenBitNumber AsSevenBitNumber(this ControlName controlName)
        {
            ThrowIfArgument.IsInvalidEnumValue(nameof(controlName), controlName);

            return((SevenBitNumber)(byte)controlName);
        }
예제 #10
0
 public static string GetControlFileName(ControlName controlId, string folderPath)
 {
     string controlName = "";
     string ext = ".ascx";
     switch (controlId)
     {
         case ControlName.Welcome:
             controlName = "ctlWelcome";
             break;
         case ControlName.AddServices:
             controlName = "ctlAddServices";
             break;
         case ControlName.ManageServices:
             controlName = "ctlManageServices";
             break;
         case ControlName.AddNews:
             controlName = "ctlAddNews";
             break;
         case ControlName.Services:
             controlName = "ctlServices";
             break;
         case ControlName.News:
             controlName = "ctlNews";
             break;
         case ControlName.ManageNews:
             controlName = "ctlManageNews";
             break;
         case ControlName.Client:
             controlName = "ctlClient";
             break;
         case ControlName.AddClient:
             controlName = "ctlAddClient";
             break;
         case ControlName.ManageClient:
             controlName = "ctlManageClient";
             break;
         case ControlName.Project:
             controlName = "ctlProject";
             break;
         case ControlName.AddProject:
             controlName = "ctlAddProject";
             break;
         case ControlName.ManageProject:
             controlName = "ctlManageProject";
             break;
         case ControlName.Portfolio:
             controlName = "ctlPortfolio";
             break;
         case ControlName.AddPortfolio:
             controlName = "ctlAddPortfolio";
             break;
         case ControlName.ManagePortfolio:
             controlName = "ctlManagePortfolio";
             break;
         default:
             controlName = "ctlLogin";
             break;
     }
     controlName += ext;
     return (String.IsNullOrEmpty(folderPath) == false ? folderPath + controlName : controlName);
 }
예제 #11
0
        /// <summary>
        /// Copies a grid's output to the clipboard
        /// </summary>
        private void CopyToClipboard()
        {
            if (ControlName.ToString().ToLower().Contains("two"))
            {
                StringBuilder sb = new StringBuilder();

                sb.AppendLine(Gadgetparameters.MainVariableName + " by " + Gadgetparameters.CrosstabVariableName);
                sb.AppendLine();
                sb.AppendLine("\t" + "Yes" + "\t" + "No" + "\tTotal");
                sb.AppendLine("Yes" + "\t" + GridCells.YyVal.ToString() + "\t" + GridCells.YnVal.ToString() + "\t" + GridCells.YtVal.ToString());
                sb.AppendLine("No" + "\t" + GridCells.NyVal.ToString() + "\t" + GridCells.NnVal.ToString() + "\t" + GridCells.NtVal.ToString());
                sb.AppendLine("Total\t" + GridCells.YtVal.ToString() + "\t" + GridCells.TnVal.ToString() + "\t" + GridCells.TtVal.ToString());
                sb.AppendLine();

                sb.AppendLine("(Exposure = Rows; Outcome = Columns)");

                try
                {
                    Clipboard.SetText(sb.ToString());
                }
                catch (System.Security.SecurityException)
                {
                    // this exception is thrown when the user declines to give
                    // permission for this web app to write to the clipboard
                }
                catch { }
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                foreach (Grid grid in this.strataGridList)
                {
                    string gridName = grid.Tag.ToString();

                    if (strataGridList.Count > 1)
                    {
                        sb.AppendLine(grid.Tag.ToString());
                    }

                    foreach (UIElement control in grid.Children)
                    {
                        if (control is TextBlock)
                        {
                            int    columnNumber = Grid.GetColumn((FrameworkElement)control);
                            string value        = ((TextBlock)control).Text;

                            sb.Append(value + "\t");

                            if (columnNumber >= grid.ColumnDefinitions.Count - 2)
                            {
                                sb.AppendLine();
                            }
                        }
                    }

                    sb.AppendLine();
                }

                try
                {
                    Clipboard.SetText(sb.ToString());
                }
                catch (System.Security.SecurityException)
                {
                    // this exception is thrown when the user declines to give
                    // permission for this web app to write to the clipboard
                }
                catch { }
            }
        }
예제 #12
0
        /// <summary>
        /// This function takes somes inputs and uploads the file to database.
        /// </summary>
        /// <param name="pUserLandId">User windows id</param>
        /// <param name="pApp">application id</param>
        /// <param name="pFileName">file name that is going to be uploaded</param>
        /// <param name="pFileContent">binary content of file</param>
        public void InsertFileIntoDB(string pUserLandId, string pApp, string pFileName, byte[] pFileContent, ControlName pControlName)
        {
            string         lQuery     = string.Empty;
            OracleProvider lProvider  = new OracleProvider();
            string         lFileId    = string.Empty;
            string         lVersionId = string.Empty;
            OracleCommand  lCommand   = null;
            string         lControl   = string.Empty;

            try
            {
                if (pControlName == ControlName.UploadOrganizationGovernance)
                {
                    lControl = "Organization Governance";
                }
                else if (pControlName == ControlName.UploadOrganizationBackground)
                {
                    lControl = "Organization Background";
                }

                //Get File and Version Id
                lFileId    = lProvider.FetchDataFromDBUsingExecuteScaler("Select SEQ_DOCUMENT_ID.Nextval from dual");
                lVersionId = lProvider.FetchDataFromDBUsingExecuteScaler("Select SEQ_VERSION_ID.Nextval from dual");

                //Begin Transaction
                lCommand = lProvider.OpenConnectionAndBeginTransaction();

                lQuery = "Insert into T_APPLICATION_DOCS (DOCUMENT_ID,APPLICATION_ID, DOC_TITLE,DOC_TYPE,DOC_ASSOCIATE,UPDATED_ON, UPDATED_BY) " +
                         "values (" + lFileId + ",'" + pApp + "','" + lControl + "','I','G'," +
                         "SYSDATE,'" + pUserLandId + "')";

                //Insert into Application Docs
                lProvider.FExecuteNonQuery(lCommand, lQuery, null);

                lQuery = "Insert into T_APPLICATION_DOCS_VERSIONS (DOCUMENT_ID,APPLICATION_ID,VERSION_ID,DOC_EXT,UPLOADED_ON, UPLOADED_BY) " +
                         "VALUES (" + lFileId + ",'" + pApp + "'," + lVersionId + ",'" + pFileName + "', SYSDATE,'" + pUserLandId + "')";

                //Insert into Application_docs_version
                lProvider.FExecuteNonQuery(lCommand, lQuery, null);

                lQuery = "declare xx blob; begin dbms_lob.createtemporary(xx, false, 0); :tempblob := xx; end;";

                OracleParameter lParam = new OracleParameter("tempblob", OracleType.Blob);
                lParam.Direction = ParameterDirection.Output;

                OracleParameterCollection lParamCollection = new OracleParameterCollection();
                lParamCollection.Add(lParam);

                lProvider.FExecuteNonQuery(lCommand, lQuery, lParamCollection);
                OracleLob tempLob = (OracleLob)lCommand.Parameters[0].Value;

                //Create temporary BLOB
                OracleLob lLob         = (OracleLob)lCommand.Parameters[0].Value;
                int       streamLength = pFileContent.Length;

                //Transfer data to server
                lLob.Write(pFileContent, 0, streamLength);

                lParam       = new OracleParameter("data", OracleType.Blob);
                lParam.Value = lLob;

                //Create a parameter collection
                lParamCollection = new OracleParameterCollection();
                lParamCollection.Add(lParam);

                lQuery = "Update T_APPLICATION_DOCS_VERSIONS set DOC_CONTENT=:data where DOCUMENT_ID=" + lFileId;

                //Execue the update query
                lProvider.FExecuteNonQuery(lCommand, lQuery, lParamCollection);

                //Commit
                lProvider.CommitTransaction(lCommand);
            }
            catch (Exception ex)
            {
                if (lProvider != null && lCommand != null)
                {
                    lProvider.RollBackTransaction(lCommand);
                }
            }
            finally
            {
                lProvider = null;
                lCommand  = null;
            }
        }