Пример #1
0
    public void Raycasts(SPData SPData, Branch branch)
    {
        int layerMask = ~LayerMask.GetMask("Ray");

        for (int i = 0; i < branch.Nodes.Count; i++)
        {
            RaycastHit Hit, Hit1;

            var origin = branch.Nodes[i].Point.position + Vector3.up * SPData.RaycastLength;
            if (Physics.Raycast(origin, -Vector3.up, out Hit, SPData.RaycastLength * 2, layerMask))
            {
                branch.Nodes[i].Point.position = Hit.point + Vector3.up * SPData.Offset;
                if (SPData.MeshOrientation)
                {
                    branch.Nodes[i].Normal = Hit.normal;
                }
            }
            if (SPData.HandlesProjection)
            {
                origin = branch.Nodes[i].Point1.position + Vector3.up * SPData.RaycastLength;
                if (Physics.Raycast(origin, -Vector3.up, out Hit1, SPData.RaycastLength * 2, layerMask))
                {
                    branch.Nodes[i].Point1.position      = Hit1.point + Vector3.up * SPData.Offset;
                    branch.Nodes[i].Point2.localPosition = -branch.Nodes[i].Point1.localPosition;
                }
            }
        }
    }
Пример #2
0
    public int Branch_Picking_SharedNode(SPData SPData, SharedNode sharedNode, data data, List <int> connectedBranches)
    {
        int branchKey = 0;
        var rand      = UnityEngine.Random.Range(0, connectedBranches.Count);

        if (sharedNode._Type == SharedNodeType.Defined)                                                                           // defined shared node type
        {
            branchKey = SPData.SplinePlus.FollowerClass.DefinedSharedNodeType(SPData, connectedBranches, sharedNode, data.wagon); // keyboard sharedPath Point type
        }
        else if (sharedNode._Type == SharedNodeType.Random)
        {
            if (connectedBranches.Count != 0)
            {
                branchKey = connectedBranches[rand];                              // random shared node type
            }
            else
            {
                branchKey = data.wagon._BranchKey; // if no eligible branch is found then pick previous branch back
            }
        }

        //events only for the trainhead
        SPData.SplinePlus.EventClass.EventsTriggering(data.train, data.wagon._BranchKey, branchKey);

        return(branchKey);
    }
Пример #3
0
        public DataSet BulkAPISvcLog(string companyCode, string userName, string serviceId, string hdLogID, int apiID)
        {
            try
            {
                Data       objData   = new Data();
                SPData     objSPData = new SPData();
                SqlCommand command   = new SqlCommand(SPHDBULKAPISVCLOG);
                command.CommandType = CommandType.StoredProcedure;
                objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 100, companyCode);
                objSPData.AddParamToSqlCommand(command, "@UserName", ParameterDirection.Input, SqlDbType.VarChar, 100, userName);
                objSPData.AddParamToSqlCommand(command, "@ServiceID", ParameterDirection.Input, SqlDbType.VarChar, 100, serviceId);
                objSPData.AddParamToSqlCommand(command, "@HDLogID", ParameterDirection.Input, SqlDbType.VarChar, 100, hdLogID);
                objSPData.AddParamToSqlCommand(command, "@APIID", ParameterDirection.Input, SqlDbType.Int, 100, apiID);

                DataSet dsRpt = objData.ExecuteGlobalDataSet(command);
                return(dsRpt);
            }
            catch (Exception ex)
            {
                Dictionary <string, string> dicObj = new Dictionary <string, string>();
                dicObj.Add("apiId", apiID.ToString());
                dicObj.Add("hdLogID", hdLogID);
                dicObj.Add("serviceId", serviceId);
                DataControl.Impl.ExceptionHandler.WriteLog(ex: ex, dic: dicObj);
                DataSet ds = new DataSet();
                return(ds);
            }
        }
Пример #4
0
    void BranchEdit(SPData SPData)
    {
        if (!SPData.IsLooped && SPData.ObjectType != SPType.Extrude)
        {
            AddBranch(SPData);
        }

        if (SPData.DictBranches.Count == 0)
        {
            return;
        }
        if (GUI.Button(new Rect(272, 30, 30, 30), new GUIContent(SplinePlusEditor.Delete.image, "Delete the selected node "), GUIStyle.none) && EditorUtility.DisplayDialog("Branch deletion?",
                                                                                                                                                                            "Are you sure you want to delete this branch? "
                                                                                                                                                                            , "Yes", "No"))
        {
            BranchesClass.DeleteBranch(SPData, SPData.Selections._BranchKey);
            SceneView.RepaintAll();
        }

        if (GUI.Button(new Rect(304, 30, 30, 30), new GUIContent(SplinePlusEditor.FlipHandles.image, "Flips the handles of the selected node "), GUIStyle.none))
        {
            Undo.RecordObject(SPData.SplinePlus, "handles Fliped");
            BranchesClass.FlipHandles(SPData, SPData.Selections._BranchKey, SPData.Selections._LocalNodeIndex);

            EditorUtility.SetDirty(SPData.SplinePlus);
        }
        var rec = new Rect(336, 30, 30, 30);

        if (SPData.ObjectType != SPType.Extrude && !SPData.IsLooped)
        {
            rec = new Rect(368, 30, 30, 30);
            if (GUI.Button(new Rect(336, 30, 30, 30), new GUIContent(SplinePlusEditor.BreakAt.image, "Break the selected branch at the selected node"), GUIStyle.none))
            {
                if (!SPData.Selections._PathPoint.Equals(null))
                {
                    Undo.RecordObject(SPData.SplinePlus, "Break at branch");
                    var node = SPData.Selections._PathPoint;
                    BranchesClass.BreakBranch(SPData, node);
                    EditorUtility.SetDirty(SPData.SplinePlus);
                }
                else
                {
                    EditorUtility.DisplayDialog("Error",
                                                "You need to have a node selected where you want your branch to be broken at "
                                                , "Ok");
                }
            }
        }
        else
        {
            rec = new Rect(336, 30, 30, 30);
        }

        if (GUI.Button(rec, new GUIContent(SplinePlusEditor.Reverse.image, "Reverse the direction of the selected branch "), GUIStyle.none))
        {
            Undo.RecordObject(SPData.SplinePlus, "branch Reversed");
            BranchesClass.ReverseBranch(SPData, SPData.Selections._BranchKey);
            EditorUtility.SetDirty(SPData.SplinePlus);
        }
    }
Пример #5
0
    public static void SetTrainBranchKey(SPData SPData, SharedNode sharedNode, data data, int branchKey)
    {
        //concerve constant spacing values between wagons
        // this should be caculated before new branch option is selected
        if (data.wagon.Progress > SPData.DictBranches[data.wagon._BranchKey].BranchDistance)
        {
            data.wagon.Delta = data.wagon.Progress - SPData.DictBranches[data.wagon._BranchKey].BranchDistance;
        }
        else if (data.wagon.Progress < 0)
        {
            data.wagon.Delta = -data.wagon.Progress;
        }
        SPData.SplinePlus.EventClass.EventsTriggering(data.wagon, data.wagon._BranchKey, branchKey);

        //set new branch
        data.wagon._BranchKey = branchKey;


        //follower new progress value calculation
        var pathLength = SPData.DictBranches[data.wagon._BranchKey].BranchDistance;

        if (!SPData.DictBranches[data.wagon._BranchKey].Nodes[0].Equals(sharedNode.Node))
        {
            data.wagon.Reverse  = true;
            data.wagon.Progress = pathLength - data.wagon.Delta;
        }
        else
        {
            data.wagon.Reverse  = false;
            data.wagon.Progress = data.wagon.Delta;
        }

        TransformFollower(SPData, data);
    }
Пример #6
0
        public DataSet GetHelpDescription(string pageId, string controlId, out string errorMsg)
        {
            try
            {
                SPData     objSPData = new SPData();
                SqlCommand command   = new SqlCommand(SPHDGETHELPITEM);
                command.CommandType = CommandType.StoredProcedure;
                objSPData.AddParamToSqlCommand(command, "@PageId", ParameterDirection.Input, SqlDbType.VarChar, 100, pageId);
                objSPData.AddParamToSqlCommand(command, "@ControlId", ParameterDirection.Input, SqlDbType.VarChar, 100, controlId);

                _objData.OpenConnection_Global();
                DataSet ds = _objData.ExecuteDataSet(command);
                errorMsg = string.Empty;
                return(ds);
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
                return(null);
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Пример #7
0
    void PivotEdit(SPData SPData)
    {
        EditorGUI.BeginChangeCheck();
        var pos = Handles.PositionHandle(SPData.Pivot, SPData.DataParent.transform.rotation);

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObject(SPData.SplinePlus, "Pivot position changed");
            SPData.Pivot = pos;

            Vector3[] pathPointsPosCach = new Vector3[SPData.DataParent.transform.childCount];
            for (int i = 0; i < SPData.DataParent.transform.childCount; i++)
            {
                pathPointsPosCach[i] = SPData.DataParent.transform.GetChild(i).position;
            }

            SPData.DataParent.transform.position = SPData.Pivot;

            for (int i = 0; i < SPData.DataParent.transform.childCount; i++)
            {
                SPData.DataParent.transform.GetChild(i).position = pathPointsPosCach[i];
            }
            //PivotEdit delegate
            if (PivotEditDel != null)
            {
                PivotEditDel();
            }

            EditorUtility.SetDirty(SPData.SplinePlus);
            SPData.SplinePlus.SplineCreationClass.UpdateAllBranches(SPData);
        }
    }
        public RegionMigrationModel GetRegionMigrationDetails(string Region_Name)
        {
            List <RegionMigrationModel> lstRegion = null;

            _objSPData = new SPData();
            _objData   = new Data();
            try
            {
                using (IDbConnection connection = IDbOpenConnection())
                {
                    var p = new DynamicParameters();
                    p.Add("@Region_Name", Region_Name);
                    lstRegion = connection.Query <RegionMigrationModel>(SP_HD_GETREGIONDETAILS, p, commandType: CommandType.StoredProcedure).ToList <RegionMigrationModel>();
                    connection.Close();
                    if (lstRegion != null && lstRegion.Count > 0)
                    {
                        return(lstRegion[0]);
                    }
                    else
                    {
                        return(new RegionMigrationModel());
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #9
0
        public bool InsertHelpDescription(string pageId, string controlId, string helpItemId, string helpDescrip, out string errorMsg)
        {
            try
            {
                SPData     _objSPData = new SPData();
                SqlCommand command    = new SqlCommand(SPHDINSERTHELPDESCRP);
                command.CommandType = CommandType.StoredProcedure;
                _objSPData.AddParamToSqlCommand(command, "@PageId", ParameterDirection.Input, SqlDbType.VarChar, 100, pageId);
                _objSPData.AddParamToSqlCommand(command, "@ControlId", ParameterDirection.Input, SqlDbType.VarChar, 100, controlId);
                _objSPData.AddParamToSqlCommand(command, "@HelpItemId", ParameterDirection.Input, SqlDbType.VarChar, 100, helpItemId);
                _objSPData.AddParamToSqlCommand(command, "@HelpDescrp", ParameterDirection.Input, SqlDbType.VarChar, helpDescrip.Length, helpDescrip);

                _objData.OpenConnection_Global();
                DataSet dsConnectionString = _objData.ExecuteDataSet(command);
                errorMsg = string.Empty;

                return(true);
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
                return(false);
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
        public bool CheckDuplicateRegion(string companyCode, string Region_Name, string Region_Code)
        {
            bool result = false;
            int  exists = 0;

            _objSPData = new SPData();
            _objData   = new Data();
            try
            {
                SqlCommand command = new SqlCommand(SP_HD_CheckDuplicateRegion);
                command.CommandType = CommandType.StoredProcedure;
                _objSPData.AddParamToSqlCommand(command, "@Company_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@Region_Name", ParameterDirection.Input, SqlDbType.VarChar, 30, Region_Name);
                _objSPData.AddParamToSqlCommand(command, "@Region_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, Region_Code);
                _objData.OpenConnection();
                exists = Convert.ToInt32(_objData.ExecuteScalar(command));
                if (exists == 0)
                {
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _objData.CloseConnection();
            }
            return(result);
        }
        public bool SaveDisableRegion(string companycode, string UserCode, string Companyid, string Disable_Date, string Region_Name, string Region_Code)
        {
            bool result = false;

            _objSPData = new SPData();
            _objData   = new Data();
            try
            {
                using (IDbConnection connection = IDbOpenConnection())
                {
                    var p = new DynamicParameters();
                    p.Add("@Company_Code", companycode);
                    p.Add("@User_Code", UserCode);
                    p.Add("@Companyid", Companyid);
                    p.Add("@Disable_Date", Disable_Date);
                    p.Add("@Region_Name", Region_Name);
                    p.Add("@Region_Code", Region_Code);

                    connection.Execute(SP_HD_DisableRegion, p, commandType: CommandType.StoredProcedure);
                    connection.Close();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(result);
        }
        public bool SaveReportingreg(string companyCode, List <Reportingreg> lstregdisable, DataTable dtdisable)
        {
            _objSPData = new SPData();
            bool result = false;

            _objData = new Data();
            string cmdText = string.Empty;

            try
            {
                cmdText = SP_HD_Changeleafregions;
                SqlCommand command = new SqlCommand(cmdText);
                command.CommandType = CommandType.StoredProcedure;

                if (lstregdisable.Count == 0)
                {
                    _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_HD_ReportingRegionInfo", ParameterDirection.Input, SqlDbType.Structured, null, "TVP_HD_ReportingRegionInfo");
                }
                else
                {
                    _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_HD_ReportingRegionInfo", ParameterDirection.Input, SqlDbType.Structured, dtdisable, "TVP_HD_ReportingRegionInfo");
                }

                _objData.OpenConnection(companyCode);
                _objData.ExecuteNonQuery(command);
                result = true;
            }


            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
        public string GetChemistAccMandatory(string Company_Code, string User_Code, string DCR_Date)
        {
            string drAccMandatory = "No";

            _objSPData = new SPData();
            _objData   = new Data();
            try
            {
                string cmdText = "SP_HD_V4_GetChemistAccompanistMand";

                SqlCommand command = new SqlCommand(cmdText);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@Company_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, Company_Code);
                _objSPData.AddParamToSqlCommand(command, "@User_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, User_Code);
                _objSPData.AddParamToSqlCommand(command, "@DCR_Date", ParameterDirection.Input, SqlDbType.Date, 30, DCR_Date);
                _objData.OpenConnection(Company_Code);
                using (SqlDataReader dataReader = _objData.ExecuteReader(command))
                    if (dataReader.HasRows)
                    {
                        while (dataReader.Read())
                        {
                            drAccMandatory = dataReader["result"].ToString();
                        }
                    }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(drAccMandatory);
        }
Пример #14
0
    public void WeldBranch(SPData SPData, Node node, int n)
    {
        var branch = SPData.DictBranches[SPData.Selections._BranchKey];

        Undo.RecordObject(SPData.SplinePlus, "branch welded");
        if (n == 0)
        {
            branch.Nodes.Insert(0, node);
        }
        else
        {
            branch.Nodes.Add(node);
        }

        if (SPData.NodeType == NodeType.Free)
        {
            node._Type = NodeType.Free;
        }
        else
        {
            node._Type = NodeType.Smooth;
        }

        BranchesClass.BreakBranch(SPData, node);
        BranchesClass.AddRefreshSharedNode(SPData, node);
        BranchesClass.BranchWeldSt(SPData);
        EditorUtility.SetDirty(SPData.SplinePlus);
        SPData.SplinePlus.SplineCreationClass.UpdateBranch(SPData, branch);
    }
        public bool InserPreviousDayDCR(string CompCode, string user_Codes, string LoggedUserCode, string DCRDate, string Remarks)
        {
            SqlConnection objSqlConnection = new SqlConnection();

            try
            {
                SPData     _objSPData  = new SPData();
                Data       _objData    = new Data();
                DataSet    ds          = new DataSet();
                bool       ReturnValue = false;
                SqlCommand command     = new SqlCommand(SPHDInsertAllowPreDayDCR);
                command.CommandType = CommandType.StoredProcedure;

                // assign to parameters to command object.
                _objSPData.AddParamToSqlCommand(command, "@CompCode", ParameterDirection.Input, SqlDbType.VarChar, 30, CompCode);
                _objSPData.AddParamToSqlCommand(command, "@UsrCode", ParameterDirection.Input, SqlDbType.VarChar, 100, user_Codes);
                _objSPData.AddParamToSqlCommand(command, "@LogUsrCode", ParameterDirection.Input, SqlDbType.VarChar, 30, LoggedUserCode);
                _objSPData.AddParamToSqlCommand(command, "@DcrDt", ParameterDirection.Input, SqlDbType.VarChar, 12, DCRDate);
                _objSPData.AddParamToSqlCommand(command, "@Remarks", ParameterDirection.Input, SqlDbType.VarChar, 150, Remarks);
                _objData.OpenConnection();
                ds          = _objData.ExecuteDataSet(command);
                ReturnValue = (ds.Tables[0].Rows[0][0].ToString() == "Success") ? true : false;
                return(ReturnValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Пример #16
0
    void Start()
    {
        //create the game object that will hold the spline plus component and catch the SPData to use further
        SPData = SplinePlusAPI.CreateSplinePlus(Vector3.zero);

        //create the 2 nodes
        var node1 = SplinePlusAPI.CreateNode(SPData, new Vector3(10, 0, 0));
        var node2 = SplinePlusAPI.CreateNode(SPData, new Vector3(-10, 0, 0));

        //connect the 2 node
        SplinePlusAPI.ConnectTwoNodes(SPData, node1, node2);

        //change the node points to get the oval shape,
        // just copy the values from the editor example it's easier this way
        node1.Point1.position = new Vector3(10, 0, Power);
        node1.Point2.position = new Vector3(10, 0, -Power);

        node2.Point1.position = new Vector3(-10, 0, Power);
        node2.Point2.position = new Vector3(-10, 0, -Power);

        //set looped to true to close the shape
        SPData.IsLooped = true;

        //trigger a spline plus update
        SPData.SplinePlus.SplineCreationClass.UpdateAllBranches(SPData);
    }
    public static void AnimationType(SPData SPData, Follower follower)
    {
        var flipDir = (follower.FlipDirection == Switch.On) ? true : false;

        flipDir = (follower._FollowerAnimation == FollowerAnimation.Auto) ? false : flipDir;
        follower.DistanceData = DistanceDataClass.DataExtraction(SPData, follower, follower.IsForward, flipDir);


        if (follower._FollowerAnimation == FollowerAnimation.Keyboard)
        {
            KeyboardAnimationType(SPData, follower);
        }
        else
        {
            AutoAnimated(follower);
        }

        //transform assign
        TransformFollower(follower);
        if (DistanceCheck(SPData, follower))
        {
            var delta = follower.Distance - SPData.Length;
            follower.Distance = delta;
        }
    }
        public List <Allow_PreviousDayDCR> GetPreviousDayDCR(string company_Code, string user_Code, char PrvDayDCRStatus)
        {
            try
            {
                SPData _objSPData = new SPData();

                // set command objects
                SqlCommand command = new SqlCommand(SPHDGetPrevDayDCRByUserCode);
                command.CommandType = CommandType.StoredProcedure;

                // assign to parameters to command object.
                _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.NVarChar, 30, company_Code);
                _objSPData.AddParamToSqlCommand(command, "@UserCode", ParameterDirection.Input, SqlDbType.NVarChar, 500, user_Code);
                _objSPData.AddParamToSqlCommand(command, "@PreDayDCRStatus", ParameterDirection.Input, SqlDbType.NChar, 1, PrvDayDCRStatus);

                // Opens the connection.
                _objData.OpenConnection();

                // Execuete the command.
                using (SqlDataReader reader = _objData.ExecuteReader(command))
                {
                    // converts and retruns the user model list.
                    return(ActvityDataReader_MaptoList(company_Code, reader));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Пример #19
0
        public DataSet GetDailyCallPlannerDoctorDetails(string companyCode, string userCode, string regionCode, string month, string year, string fromDate, string dcrDate)
        {
            DataSet ds         = new DataSet();
            SPData  _objSPData = new SPData();
            Data    _objData   = new Data();

            try
            {
                SqlCommand command = new SqlCommand(SP_HD_V4_GetDailyPlanDoctorYTD);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@UserCode", ParameterDirection.Input, SqlDbType.VarChar, 30, userCode);
                _objSPData.AddParamToSqlCommand(command, "@RegionCode", ParameterDirection.Input, SqlDbType.VarChar, 30, regionCode);
                _objSPData.AddParamToSqlCommand(command, "@Month", ParameterDirection.Input, SqlDbType.VarChar, 5, month);
                _objSPData.AddParamToSqlCommand(command, "@YEAR", ParameterDirection.Input, SqlDbType.VarChar, 5, year);
                _objSPData.AddParamToSqlCommand(command, "@FromDate", ParameterDirection.Input, SqlDbType.VarChar, 15, fromDate);
                _objSPData.AddParamToSqlCommand(command, "@DCRDate", ParameterDirection.Input, SqlDbType.VarChar, 15, dcrDate);

                _objData.OpenConnection(companyCode);
                ds = _objData.ExecuteDataSet(command);
                return(ds);
            }
            catch
            {
                throw;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
 public static void Follow(SPData SPData, List <Follower> followers)
 {
     for (int i = 0; i < followers.Count; i++)
     {
         Follow(SPData, followers[i]);
     }
 }
Пример #21
0
        public DataSet GetInstantReportDetails(string companyCode, string userCode, string regionCode, string dcrActualDate, string dcrCode, string flag)
        {
            SPData _objSPData = new SPData();
            Data   _objData   = new Data();

            try
            {
                string cmdText = SP_HD_V4_GetUserPerDayReport;

                SqlCommand command = new SqlCommand(cmdText);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@UserCode", ParameterDirection.Input, SqlDbType.VarChar, 30, userCode);
                _objSPData.AddParamToSqlCommand(command, "@RegionCode", ParameterDirection.Input, SqlDbType.VarChar, 30, regionCode);
                _objSPData.AddParamToSqlCommand(command, "@DCRActualDate", ParameterDirection.Input, SqlDbType.VarChar, 12, dcrActualDate);
                _objSPData.AddParamToSqlCommand(command, "@DCRCode", ParameterDirection.Input, SqlDbType.VarChar, 50, dcrCode);
                _objSPData.AddParamToSqlCommand(command, "@Flag", ParameterDirection.Input, SqlDbType.VarChar, 1, flag);

                DataSet ds = new DataSet();

                _objData.OpenConnection(companyCode);
                ds = _objData.ExecuteDataSet(command);
                return(ds);
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Пример #22
0
        public DataTable GetDailyCallPlanner(string companyCode, string userCode, string dcrDate)
        {
            DataTable dt         = new DataTable();
            SPData    _objSPData = new SPData();
            Data      _objData   = new Data();

            try
            {
                SqlCommand command = new SqlCommand(SP_HD_V4_GetDailyPlanHeader);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@UserCode", ParameterDirection.Input, SqlDbType.VarChar, 30, userCode);
                _objSPData.AddParamToSqlCommand(command, "@DCRDate", ParameterDirection.Input, SqlDbType.VarChar, 15, dcrDate);

                _objData.OpenConnection(companyCode);
                dt = _objData.ExecuteDataTable(command);
                return(dt);
            }
            catch
            {
                throw;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Пример #23
0
        public DataTable GetCompetitorBrandProducts(string companyCode, string userCode, string year, string month, string customerCode)
        {
            DataTable dt         = new DataTable();
            SPData    _objSPData = new SPData();
            Data      _objData   = new Data();

            try
            {
                SqlCommand command = new SqlCommand(SP_hdGetCompetitorBrandProducts);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@UserCode", ParameterDirection.Input, SqlDbType.VarChar, 30, userCode);
                _objSPData.AddParamToSqlCommand(command, "@Year", ParameterDirection.Input, SqlDbType.VarChar, 5, year);
                _objSPData.AddParamToSqlCommand(command, "@Month", ParameterDirection.Input, SqlDbType.VarChar, 5, month);
                _objSPData.AddParamToSqlCommand(command, "@CustomerCode", ParameterDirection.Input, SqlDbType.VarChar, 30, customerCode);

                _objData.OpenConnection(companyCode);
                dt = _objData.ExecuteDataTable(command);
                return(dt);
            }
            catch
            {
                throw;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Пример #24
0
        public string GetAttendanceDetail(string companyCode, string userCode, string dcrDate)
        {
            string result     = string.Empty;
            SPData _objSPData = new SPData();
            Data   _objData   = new Data();

            try
            {
                SqlCommand command = new SqlCommand(SP_HD_V4_GetTPAttendanceDetails);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@UserCode", ParameterDirection.Input, SqlDbType.VarChar, 30, userCode);
                _objSPData.AddParamToSqlCommand(command, "@DCRDate", ParameterDirection.Input, SqlDbType.VarChar, 15, dcrDate);

                _objData.OpenConnection(companyCode);
                result = Convert.ToString(_objData.ExecuteScalar(command));
                return(result);
            }
            catch
            {
                throw;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Пример #25
0
        public DataTable GetDoctorProductMappingDetail(string companyCode, string customerCode, string regionCode)
        {
            DataTable dt         = new DataTable();
            SPData    _objSPData = new SPData();
            Data      _objData   = new Data();

            try
            {
                SqlCommand command = new SqlCommand(SP_hdGetDoctorProductMappimgDetail);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@CustomerCode", ParameterDirection.Input, SqlDbType.VarChar, 30, customerCode);
                _objSPData.AddParamToSqlCommand(command, "@RegionCode", ParameterDirection.Input, SqlDbType.VarChar, 30, regionCode);

                _objData.OpenConnection(companyCode);
                dt = _objData.ExecuteDataTable(command);
                return(dt);
            }
            catch
            {
                throw;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Пример #26
0
        public DataTable GetNonSampleGivenYTD(string companyCode, string userCode, string fromDate, string customerCode)
        {
            DataTable dt         = new DataTable();
            SPData    _objSPData = new SPData();
            Data      _objData   = new Data();

            try
            {
                SqlCommand command = new SqlCommand(SP_hdGetGiftsGivenYTD);
                command.CommandType = CommandType.StoredProcedure;

                _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode);
                _objSPData.AddParamToSqlCommand(command, "@UserCode", ParameterDirection.Input, SqlDbType.VarChar, 30, userCode);
                _objSPData.AddParamToSqlCommand(command, "@FromDate", ParameterDirection.Input, SqlDbType.VarChar, 15, fromDate);
                _objSPData.AddParamToSqlCommand(command, "@CustomerCode", ParameterDirection.Input, SqlDbType.VarChar, 30, customerCode);

                _objData.OpenConnection(companyCode);
                dt = _objData.ExecuteDataTable(command);
                return(dt);
            }
            catch
            {
                throw;
            }
            finally
            {
                _objData.CloseConnection();
            }
        }
Пример #27
0
    public void  NodesGizmos(SPData SPData)
    {
        if (SPData.SharedSettings.ShowGizmos)
        {
            foreach (var branch in SPData.DictBranches)
            {
                for (int i = 0; i < branch.Value.Nodes.Count; i++)
                {
                    Gizmos.color = SPData.SharedSettings.StandardPathPointColor;
                    Gizmos.DrawSphere(branch.Value.Nodes[i].Point.position, SPData.SharedSettings.GizmosSize);
                }
            }

            for (int i = 0; i < SPData.SharedNodes.Count; i++)
            {
                if (SPData.SharedNodes[i].Node.Equals(null))
                {
                    continue;
                }

                if (SPData.SharedNodes[i]._Type == SharedNodeType.Random)
                {
                    Gizmos.color = SPData.SharedSettings.RandomSharedNodeColor;
                }
                else
                {
                    Gizmos.color = SPData.SharedSettings.DefinedSharedNodeColor;
                }

                Gizmos.DrawSphere(SPData.SharedNodes[i].Node.Point.position, SPData.SharedSettings.GizmosSize);
            }
        }
    }
Пример #28
0
    public void UpdateBranch(SPData SPData, Branch branch)
    {
        if (SPData.DictBranches.Count == 0)
        {
            return;
        }
        branch.Vertices.Clear();
        branch.Tangents.Clear();
        branch.Normals.Clear();
        branch.SpeedFactor.Clear();
        branch.VertexDistance.Clear();

        branch.BranchDistance = 0;
        for (int j = 0; j < branch.Nodes.Count - 1; j++)
        {
            var n = (j > 0) ? 1 : 0;
            CubicBezier(SPData, branch, n, branch.Nodes[j + 1], branch.Nodes[j]);
        }

        if (SPData.IsLooped)
        {
            CubicBezier(SPData, branch, 1, branch.Nodes[0],
                        branch.Nodes[branch.Nodes.Count - 1]);
        }
    }
Пример #29
0
    public void AddNewPoint(SPData SPData, Vector3 position, addPathPointPos addPathPointPos, int targetIndex)
    {
        Undo.RecordObject(SPData.SplinePlus, "Node added");


        var branch = SPData.DictBranches[SPData.Selections._BranchKey];

        SPData.EditSpline = false;
        var node = new Node();

        node._Type = SPData.NodeType;

        node.Point = CreatePoint(SPData, "p" + SPData.PathPointCount, position, Quaternion.identity, SPData.DataParent.transform);

        if (addPathPointPos == addPathPointPos.Beginning)
        {
            branch.Nodes.Insert(0, node);

            node.Point1 = CreatePoint(SPData, "p1", branch.Nodes[targetIndex].Point.position, Quaternion.identity, node.Point);
            node.Point2 = CreatePoint(SPData, "p2", branch.Nodes[targetIndex].Point.position, Quaternion.identity, node.Point);

            if (branch.Nodes.Count > 1)
            {
                node.Point2.position      = Vector3.Lerp(branch.Nodes[targetIndex + 1].Point.position, node.Point.position, 0.5f);
                node.Point1.localPosition = -node.Point2.localPosition;
            }
            else
            {
                node.Point1.localPosition = new Vector3(5, 0, 0);
                node.Point2.localPosition = -node.Point1.localPosition;
            }
        }
        else if (addPathPointPos == addPathPointPos.End)//end
        {
            branch.Nodes.Add(node);
            targetIndex               = branch.Nodes.Count - 1;
            node.Point1               = CreatePoint(SPData, "p1", branch.Nodes[targetIndex].Point.position, Quaternion.identity, node.Point);
            node.Point2               = CreatePoint(SPData, "p2", branch.Nodes[targetIndex].Point.position, Quaternion.identity, node.Point);
            node.Point1.position      = Vector3.Lerp(branch.Nodes[targetIndex - 1].Point.position, node.Point.position, 0.5f);
            node.Point2.localPosition = -node.Point1.localPosition;
        }
        else if (addPathPointPos == addPathPointPos.Middle)//middle
        {
            var a = (targetIndex - 1) < 0 ? branch.Nodes.Count - 1 : targetIndex - 1;
            var b = (targetIndex + 1) >= branch.Nodes.Count ? 0 : (targetIndex + 1);

            branch.Nodes.Insert(targetIndex, node);
            node.Point1 = CreatePoint(SPData, "p1", branch.Nodes[targetIndex].Point.position, Quaternion.identity, node.Point);
            node.Point2 = CreatePoint(SPData, "p2", branch.Nodes[targetIndex].Point.position, Quaternion.identity, node.Point);
            var dir = (branch.Nodes[a].Point.position - branch.Nodes[b].Point.position).normalized;
            node.Point1.localPosition = dir * Vector3.Distance(branch.Nodes[a].Point.position, branch.Nodes[b].Point.position) * 0.2f;
            node.Point2.localPosition = -node.Point1.localPosition;
        }

        BranchesClass.BranchWeldSt(SPData);
        EditorUtility.SetDirty(SPData.SplinePlus);
        SPData.SplinePlus.SplineCreationClass.UpdateAllBranches(SPData);

        SPData.PathPointCount++;
    }
Пример #30
0
    void SelectPoint(SPData SPData)
    {
        if (SPData.DictBranches.Count == 0)
        {
            return;
        }
        if (Event.current.type == EventType.MouseDown)
        {
            var branch = SPData.DictBranches[SPData.Selections._BranchKey];
            for (int i = 0; i < branch.Nodes.Count; i++)
            {
                var dist = Vector2.Distance(HandleUtility.WorldToGUIPoint(branch.Nodes[i].Point.position), Event.current.mousePosition);
                if (dist < 10)
                {
                    SPData.Selections._PathPoint      = branch.Nodes[i];
                    SPData.Selections._LocalNodeIndex = i;

                    var sharedPathPointIndex = SPData.SharedNodes.FindIndex(x => x.Node.Equals(SPData.Selections._PathPoint));
                    SPData.Selections._SharedPathPointIndex = sharedPathPointIndex;
                    return;
                }
            }
            SelectBranch(SPData);
        }
    }
Пример #31
0
        /// <summary>
        /// �����ݿ��ȡSP���ݼ���
        /// ���ߣ�Է��      ʱ�䣺2009-7-31
        /// �޸ģ�          ʱ�䣺
        /// </summary>
        private object GetSPData( string SPDataCacheName)
        {
            object ResultData = null;
            DataSet tmpData = new DataSet();

            try
            {
                SqlCommand selCmd = new SqlCommand();
                selCmd.CommandType = CommandType.Text;
                DataTable dt = new DataTable();
                if (SPDataCacheName == "SPData")
                {
                    selCmd.CommandText = SPInfoManager.SqlGetSPInfo;
                    SPData SPData = new SPData();
                    dt = SPData.Tables[SPData.TableName];
                    ResultData = SPData;
                }
                else if (SPDataCacheName == "SPIPListData")
                {
                    selCmd.CommandText = SPInfoManager.SqlGetSPIPList;
                    SPIPListData SPIPListData = new SPIPListData();
                    dt = SPIPListData.Tables[SPIPListData.TableName];
                    ResultData = SPIPListData;
                }
                else if (SPDataCacheName == "SPInterfaceLimitData")
                {
                    selCmd.CommandText = SPInfoManager.SqlGetSPInterfaceLimit;
                    SPInterfaceLimitData SPInterfaceLimitData = new SPInterfaceLimitData();
                    dt = SPInterfaceLimitData.Tables[SPInterfaceLimitData.TableName];
                    ResultData = SPInterfaceLimitData;
                }
                else if (SPDataCacheName == "SPCAData")
                {
                    selCmd.CommandText = SPInfoManager.SqlGetSPCAInfo;
                    SPCAData SPCAData = new SPCAData();
                    dt = SPCAData.Tables[SPCAData.TableName];
                    ResultData = SPCAData;
                }

                // ��ȡ����
                tmpData = DBUtility.FillData(selCmd, DBUtility.BestToneCenterConStr);

                // ����ת��
                // DataSet --> Object

                int intTargetColumnCount = dt.Columns.Count;
                foreach (DataRow row in tmpData.Tables[0].Rows)
                {
                    object[] newRow = new object[intTargetColumnCount];
                    for (int j = 0; j < intTargetColumnCount; j++)
                    {
                        newRow[j] = row[j];
                    }
                    dt.Rows.Add(newRow);
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }

            return ResultData;
        }