protected void btnSave_Click(object sender, EventArgs e)
    {
        CommonMapping    oCM    = new CommonMapping();
        CommonMappingDAL oCMDAL = new CommonMappingDAL();

        if (!string.IsNullOrEmpty(ddlCurrencyID.SelectedItem.Value))
        {
            oCM.Currency.CurrencyID = ddlCurrencyID.SelectedItem.Value;
        }
        oCM.PnLAcc     = SBM_BLC1.Common.String.RemoveSeperator(txtAccount.Text);
        oCM.PnLAccName = txtAccName.Text;

        oCM.UserDetails          = ucUserDet.UserDetail;
        oCM.UserDetails.MakeDate = DateTime.Now;
        ucUserDet.ResetData();

        Result oResult = (Result)oCMDAL.Save(oCM);

        if (oResult.Status)
        {
            this.LoadList();
            this.ClearTextValue();
            hdCurrencyID.Value = "";

            ucMessage.OpenMessage(Constants.MSG_SUCCESS_SAVE, Constants.MSG_TYPE_SUCCESS);
        }
        else
        {
            ucMessage.OpenMessage(Constants.MSG_ERROR_SAVE, Constants.MSG_TYPE_ERROR);
        }
    }
 bool CommonMappingContainsName(CommonMapping mapping, string name)
 {
     foreach (string mapName in mapping.names)
     {
         if (name == mapName)
         {
             return(true);
         }
     }
     return(false);
 }
Example #3
0
        public List <MMCS_MarketsList> MMCS_MarketList()
        {
            List <MMCS_MarketsList> MMCS_MarketLists = null;

            try
            {
                List <MMCS_MarketsList_Result> getMarketList = db.MMCS_MarketsList().ToList();

                MMCS_MarketLists = CommonMapping.GetMarketListMapping(getMarketList);
                if (getMarketList == null)
                {
                    return(MMCS_MarketLists);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(MMCS_MarketLists);
        }
Example #4
0
        public List <MMCS_MediaSets> MMCS_MediaSets()
        {
            List <MMCS_MediaSets> MMCS_MediaSets = null;

            try
            {
                List <MMCS_MediasetsList_Result> getMediaSets = db.MMCS_MediasetsList().ToList();

                MMCS_MediaSets = CommonMapping.GetMediaSetsMapping(getMediaSets);
                if (getMediaSets == null)
                {
                    return(MMCS_MediaSets);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(MMCS_MediaSets);
        }
Example #5
0
        public List <MMCS_ReportList> MMCS_GetReportList(int?productID)
        {
            List <MMCS_ReportList> reportListValue = null;

            try
            {
                List <MMCS_ListReport_Result> reportListRec = db.MMCS_ListReport(productID).ToList();

                reportListValue = CommonMapping.ReportListValue(reportListRec);
                if (reportListValue == null)
                {
                    return(reportListValue);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(reportListValue);
        }
Example #6
0
        public List <MMCS_PackageListFeatureForReport> MMCS_GetPackageListFeatureForReports(int?packageID, int?productID, int?reportID)
        {
            List <MMCS_PackageListFeatureForReport> packageListFeatureForReport = null;

            try
            {
                List <MMCS_PackageListFeatureForReport_Result> packageFeatureReport = db.MMCS_PackageListFeatureForReport(packageID, productID, reportID).ToList();

                packageListFeatureForReport = CommonMapping.PackageListFeatureForReport(packageFeatureReport);
                if (packageListFeatureForReport == null)
                {
                    return(packageListFeatureForReport);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(packageListFeatureForReport);
        }
Example #7
0
        public List <MMCS_PackageListReport> MMCS_GetPackageListReport(int?productID)
        {
            List <MMCS_PackageListReport> packageListReportValue = null;

            try
            {
                List <MMCS_packageListReport_Result> packageListReport = db.MMCS_packageListReport(productID).ToList();

                packageListReportValue = CommonMapping.PackageListValue(packageListReport);
                if (packageListReportValue == null)
                {
                    return(packageListReportValue);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(packageListReportValue);
        }
Example #8
0
        public List <MMCS_CSCompanyListReport> MMCS_GetCompanyListReport(int?companyID, int?productID)
        {
            List <MMCS_CSCompanyListReport> companyListReport = null;

            try
            {
                List <csCompanyListReport_Result> companyReport = db.csCompanyListReport(companyID, productID).ToList();

                companyListReport = CommonMapping.ListofCompanyReport(companyReport);
                if (companyListReport == null)
                {
                    return(companyListReport);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(companyListReport);
        }
Example #9
0
        public List <MMCS_CategoryList> MMCS_CategoryList(int?productid, int?featureid)
        {
            List <MMCS_CategoryList> MMCS_CategoryListValue = null;

            try
            {
                List <MMcs_CategoryList_Result> MMCS_CategoryValue = db.MMcs_CategoryList(productid, featureid).ToList();

                MMCS_CategoryListValue = CommonMapping.GetCategoryListMapping(MMCS_CategoryValue);
                if (MMCS_CategoryValue == null)
                {
                    return(MMCS_CategoryListValue);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(MMCS_CategoryListValue);
        }
Example #10
0
        public List <MMCS_GetThemes> MMCS_GetThemes()
        {
            List <MMCS_GetThemes> MMCS_GetThemesList = null;

            try
            {
                List <Get_Themes_Result> getThemes = db.Get_Themes().ToList();

                MMCS_GetThemesList = CommonMapping.GetThemesMapping(getThemes);
                if (getThemes == null)
                {
                    return(MMCS_GetThemesList);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(MMCS_GetThemesList);
        }
Example #11
0
        public List <MMCS_SalesRep> MMCS_SalesRep()
        {
            List <MMCS_SalesRep> MMCS_SalesRep = null;

            try
            {
                List <MMCS_GetSalesRep_Result> getSalesRepList = db.MMCS_GetSalesRep().ToList();

                MMCS_SalesRep = CommonMapping.GetSalesRepMapping(getSalesRepList);
                if (getSalesRepList == null)
                {
                    return(MMCS_SalesRep);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(MMCS_SalesRep);
        }
    private void LoadDataByID(string sCurrencyID)
    {
        CommonMapping    oCM    = new CommonMapping(sCurrencyID);
        CommonMappingDAL oCMDAL = new CommonMappingDAL();

        Result oResult = new Result();

        oResult = oCMDAL.LoadByID(oCM);
        if (oResult.Status)
        {
            oCM             = (CommonMapping)oResult.Return;
            txtAccount.Text = oCM.PnLAcc.Trim();
            txtAccName.Text = oCM.PnLAccName.Trim();
            DDListUtil.Assign(ddlCurrencyID, oCM.Currency.CurrencyID);
            ddlCurrencyID.Enabled = false;
            if (string.IsNullOrEmpty(hdDataType.Value))
            {
                //When Loading from Approver End
                UserDetails userDetails = ucUserDet.UserDetail;
                userDetails.MakerID  = oCM.UserDetails.MakerID;
                userDetails.MakeDate = oCM.UserDetails.MakeDate;
                ucUserDet.UserDetail = userDetails;
            }
            else if (hdDataType.Value.Equals("T"))
            {
                //When loading from temp table
                UserDetails userDetails = ucUserDet.UserDetail;
                userDetails.CheckDate      = oCM.UserDetails.CheckDate;
                userDetails.CheckerID      = oCM.UserDetails.CheckerID;
                userDetails.CheckDate      = oCM.UserDetails.CheckDate;
                userDetails.CheckerComment = oCM.UserDetails.CheckerComment;
                ucUserDet.UserDetail       = userDetails;
            }

            hdCurrencyID.Value = sCurrencyID;
        }
        else
        {
            ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND, Constants.MSG_TYPE_ERROR);
        }
    }
    protected void btnApprove_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(hdCurrencyID.Value))
        {
            CommonMapping    oCM    = new CommonMapping(hdCurrencyID.Value);
            CommonMappingDAL oCMDAL = new CommonMappingDAL();
            oCM.UserDetails = ucUserDet.UserDetail;

            Result oResult = (Result)oCMDAL.Approve(oCM);
            if (oResult.Status)
            {
                ucMessage.OpenMessage(Constants.MSG_SUCCESS_APPROVE, Constants.MSG_TYPE_SUCCESS);
            }
            else
            {
                ucMessage.OpenMessage(Constants.MSG_ERROR_APPROVE, Constants.MSG_TYPE_ERROR);
            }
        }
        else
        {
            ucMessage.OpenMessage(Constants.MSG_ERROR_APPROVE, Constants.MSG_TYPE_ERROR);
        }
    }
    public void LoadList()
    {
        Config oConfig = (Config)Session[Constants.SES_USER_CONFIG];

        if (oConfig != null)
        {
            CommonMapping    oCM     = new CommonMapping();
            CommonMappingDAL oCMDAL  = new CommonMappingDAL();
            Result           oResult = oCMDAL.LoadUnapprovedList(oConfig.UserName, false);

            if (oResult.Status)
            {
                DataTable dtTmpCurrencyList = (DataTable)oResult.Return;
                if (dtTmpCurrencyList.Rows.Count > 0)
                {
                    gvList.DataSource = dtTmpCurrencyList;
                    gvList.DataBind();
                    this.gvList.HeaderRow.Cells[1].Text = "Currency ID";

                    Session[Constants.SES_CONFIG_UNAPPROVE_DATA] = dtTmpCurrencyList;
                }
                else
                {
                    gvList.DataSource = null;
                    gvList.DataBind();
                }
            }
            else
            {
                ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND, Constants.MSG_TYPE_ERROR);
            }
        }
        else
        {
            ucMessage.OpenMessage(Constants.MSG_ERROR_NOT_FOUND, Constants.MSG_TYPE_ERROR);
        }
    }
    public override void OnInspectorGUI()
    {
        CommonMapping padMapping = (CommonMapping)target;

        EditorGUI.BeginChangeCheck();

        string[] strs = new string[] { "Gamepad", "Buttons", "Axis" };
        currentPanel = GUILayout.Toolbar(currentPanel, strs);
        EditorGUILayout.Space();
        EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);


        if (currentPanel == 0)
        {
            //Gamepad general menu
            padMapping.os = (OSFamily)EditorGUILayout.EnumPopup("Operating System:", padMapping.os);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);

            EditorGUILayout.PrefixLabel("Gamepad Names:");
            EditorGUILayout.LabelField("Which gamepads will this mapping apply to?");
            EditorGUILayout.LabelField("(Case insensitive, but needs to match what unity detects)");


            for (int i = 0; i < padMapping.names.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                padMapping.names[i] = EditorGUILayout.TextField(padMapping.names[i]);
                if (GUILayout.Button("x"))
                {
                    //remove gamepad name
                    padMapping.names.RemoveAt(i);
                }
                EditorGUILayout.EndHorizontal();
            }
            if (GUILayout.Button("+"))
            {
                //add gamepad name here
                padMapping.names.Add("GAMEPAD_NAME_HERE");
            }
            EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);

            EditorGUILayout.Space();
            EditorGUILayout.PrefixLabel("Partial Names:");
            EditorGUILayout.LabelField("If a gamepad can't find a match on the above names,");
            EditorGUILayout.LabelField("check if it contains any of the following.");


            for (int i = 0; i < padMapping.partialNames.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                padMapping.partialNames[i] = EditorGUILayout.TextField(padMapping.partialNames[i]);
                if (GUILayout.Button("x"))
                {
                    //remove gamepad name
                    padMapping.partialNames.RemoveAt(i);
                }
                EditorGUILayout.EndHorizontal();
            }
            if (GUILayout.Button("+"))
            {
                //add gamepad name here
                padMapping.partialNames.Add("PARTIAL_NAME_HERE");
            }
            EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);

            EditorGUILayout.Space();
            EditorGUILayout.PrefixLabel("Default pad:");
            EditorGUILayout.LabelField("If a common or saved binding isn't found,");
            EditorGUILayout.LabelField("is this the default mapping that will be loaded?");
            bool wasDefault = padMapping.isDefault;
            padMapping.isDefault = EditorGUILayout.Toggle("Is Default", padMapping.isDefault);
            if (padMapping.isDefault && !wasDefault)
            {
                //we set this mapping to default, lets unset any other common mappings of the same OS from being default
                System.Object[] commonMappingAssets = Resources.LoadAll("", typeof(CommonMapping));
                for (int i = 0; i < commonMappingAssets.Length; i++)
                {
                    if (((CommonMapping)commonMappingAssets[i]).os == padMapping.os)
                    {
                        ((CommonMapping)commonMappingAssets[i]).isDefault = false;
                        EditorUtility.SetDirty((CommonMapping)commonMappingAssets[i]);
                    }
                }
                padMapping.isDefault = true;
            }
        }

        if (currentPanel == 1)
        {
            //button mapping menu
            if (padMapping.buttons.Count > 0)
            {
                //EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Button Type / Button ID / Display Name");
                //EditorGUILayout.EndHorizontal();
            }

            CommonMapping.GamepadButtonInput activeButton = new CommonMapping.GamepadButtonInput();
            for (int i = 0; i < padMapping.buttons.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                activeButton              = padMapping.buttons[i];
                activeButton.buttonType   = (CommonGamepadInputs)EditorGUILayout.EnumPopup(padMapping.buttons[i].buttonType);
                activeButton.buttonNumber = EditorGUILayout.IntField(padMapping.buttons[i].buttonNumber);
                activeButton.displayName  = EditorGUILayout.TextField(activeButton.displayName);
                padMapping.buttons[i]     = activeButton;
                if (GUILayout.Button("x"))
                {
                    //remove button
                    padMapping.buttons.RemoveAt(i);
                }
                EditorGUILayout.EndHorizontal();
            }
            if (GUILayout.Button("+"))
            {
                //add button mapping name here
                CommonMapping.GamepadButtonInput newButtonInput = new CommonMapping.GamepadButtonInput();
                newButtonInput.buttonType   = CommonGamepadInputs.NOBUTTON;
                newButtonInput.displayName  = "[?]";
                newButtonInput.buttonNumber = 0;
                padMapping.buttons.Add(newButtonInput);
            }
        }

        if (currentPanel == 2)
        {
            //axis mapping menu
            if (axisEditFoldouts.Count != padMapping.axis.Count)
            {
                axisEditFoldouts = new List <bool>();
                for (int i = 0; i < padMapping.axis.Count; i++)
                {
                    axisEditFoldouts.Add(false);
                }
            }

            CommonMapping.GamepadAxisInput activeAxis = new CommonMapping.GamepadAxisInput();
            bool delete = false;
            for (int i = 0; i < padMapping.axis.Count; i++)
            {
                axisEditFoldouts[i] = EditorGUILayout.Foldout(axisEditFoldouts[i], padMapping.axis[i].buttonType.ToString(), true);
                if (axisEditFoldouts[i])
                {
                    delete     = false;
                    activeAxis = padMapping.axis[i];
                    EditorGUILayout.BeginHorizontal();
                    activeAxis.buttonType = (CommonGamepadInputs)EditorGUILayout.EnumPopup(activeAxis.buttonType);
                    if (GUILayout.Button("x"))
                    {
                        delete = true;
                    }
                    EditorGUILayout.EndHorizontal();

                    activeAxis.axisNumber = EditorGUILayout.IntField("Axis ID", activeAxis.axisNumber);

                    activeAxis.displayName = EditorGUILayout.TextField("Display name", activeAxis.displayName);
                    EditorGUILayout.Space();
                    activeAxis.defaultVal = EditorGUILayout.FloatField("Default Value", activeAxis.defaultVal);
                    activeAxis.invert     = EditorGUILayout.Toggle("Invert", activeAxis.invert);
                    activeAxis.clamp      = EditorGUILayout.Toggle("Clamp to [0-1]", activeAxis.clamp);

                    if (!activeAxis.rescaleAxis)
                    {
                        activeAxis.rescaleAxis = EditorGUILayout.Toggle("Rescale to [0-1]", activeAxis.rescaleAxis);
                    }
                    else
                    {
                        EditorGUILayout.BeginHorizontal();
                        activeAxis.rescaleAxis    = EditorGUILayout.Toggle("Rescale to [0-1]", activeAxis.rescaleAxis);
                        activeAxis.rescaleAxisMin = EditorGUILayout.FloatField(activeAxis.rescaleAxisMin);
                        activeAxis.rescaleAxisMax = EditorGUILayout.FloatField(activeAxis.rescaleAxisMax);

                        EditorGUILayout.EndHorizontal();
                    }
                    EditorGUILayout.Space();

                    //EditorGUILayout.LabelField("Counts as pressed button when:");
                    EditorGUILayout.BeginHorizontal();
                    string compareStr = "Pressed if >";
                    if (!activeAxis.compareGreater)
                    {
                        compareStr = "Pressed if <";
                    }
                    if (GUILayout.Button(compareStr))
                    {
                        activeAxis.compareGreater = !activeAxis.compareGreater;
                    }
                    activeAxis.compareVal = EditorGUILayout.FloatField(activeAxis.compareVal);

                    EditorGUILayout.EndHorizontal();

                    padMapping.axis[i] = activeAxis;

                    if (delete)
                    {
                        //remove axis
                        padMapping.axis.RemoveAt(i);
                        axisEditFoldouts.RemoveAt(i);
                        i--;
                    }
                    EditorGUILayout.Space();
                }

                //EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
            }
            EditorGUILayout.Space();
            if (GUILayout.Button("+"))
            {
                //add axis mapping name here
                CommonMapping.GamepadAxisInput newAxisInput = new CommonMapping.GamepadAxisInput();
                newAxisInput.buttonType = CommonGamepadInputs.NOBUTTON;

                newAxisInput.axisNumber = 1;
                newAxisInput.invert     = false;
                newAxisInput.clamp      = false;            //applied AFTER invert, to keep input result between 0 and 1

                //for using the axis as a button
                newAxisInput.compareGreater = true;          //true is ([axisVal]>compareVal), false is ([axisVal]<compareVal)
                newAxisInput.compareVal     = 0.4f;          //how var does have to go to count as "pressed" as a button

                newAxisInput.rescaleAxis    = false;
                newAxisInput.rescaleAxisMin = 0f;
                newAxisInput.rescaleAxisMax = 1f;

                newAxisInput.defaultVal = 0f;                 //all GetAxis() checks will return default value until a measured change occurs, since readings before then can be wrong


                newAxisInput.displayName = "[?]";

                padMapping.axis.Add(newAxisInput);
                axisEditFoldouts.Add(true);
            }
        }


        if (EditorGUI.EndChangeCheck())
        {
            //something was changed
            EditorUtility.SetDirty(padMapping);
        }
    }