Example #1
0
 public void LoadData(Ice.Core.Session epiSession)
 {
     Hierarchy  = _repo.GetAllHierarchy(Tree.TreeViewId).ToList();
     Teams      = _repo.GetAllTeam().ToList();
     Available  = _repo.GetAllAvailable().ToList();
     Authorized = _repo.GetAuthorizedByTree(Tree.TreeViewId).ToList();
 }
Example #2
0
        public void DeleteRootNode(Ice.Core.Session session, int id)
        {
            string sql = string.Format(@"DELETE FROM Custom_Tree WHERE TreeViewId = {0} " + Environment.NewLine
                                       , id);

            Repository.Instance.ExecuteWithTransaction(sql, "Delete root");
        }
Example #3
0
        public IEnumerable <TeamHierarchyModel> InsertTeam(Ice.Core.Session session, TeamHierarchyModel model)
        {
            string sql = string.Format(@"INSERT INTO Custom_TeamNode
                                                   (TreeViewId
                                                   ,TeamId
                                                   ,ParentId
                                                   ,VisibleFlag
                                                   ,CreateBy
                                                   ,LastUpdateBy)
                                             VALUES
                                                   ( {0} --<TreeViewId, int,>
                                                   , '{1}' --<TeamId, nvarchar(50),>
                                                   , '{2}' --<ParentId, nvarchar(50),>
                                                   , {3} --<VisibleFlag, int,>
                                                   , '{4}' --<CreateBy, nvarchar(50),>
                                                   , '{4}')" + Environment.NewLine
                                       , model.TreeViewId
                                       , model.TeamId
                                       , model.ParentId
                                       , 1
                                       , session.UserID);

            Repository.Instance.ExecuteWithTransaction(sql, "Add node");
            return(GetAllHierarchy(model.TreeViewId));
        }
Example #4
0
 public AddTree(Ice.Core.Session _session, string param = null)
 {
     InitializeComponent();
     this._repo      = new AuthRepo();
     this.epiSession = _session;
     addedModel      = new TreeViewModel();
 }
Example #5
0
 public TeamManagement(EpiTransaction iTrans)
     : base(iTrans)
 {
     InitializeComponent();
     this._repo      = new AuthRepo();
     this.trans      = new TransModel();
     this.epiSession = ((Ice.Core.Session)oTransaction.Session);
 }
Example #6
0
 public BuyerSearch(Ice.Core.Session _session = null, string userId = null)
 {
     InitializeComponent();
     epiSession  = _session;
     this.Code   = string.Empty;
     this.UserID = userId;
     this._repo  = new RequisitionRepo();
 }
Example #7
0
 public TreeList(Ice.Core.Session _session)
 {
     InitializeComponent();
     this._repo      = new AuthRepo();
     this.trees      = new List <TreeViewModel>();
     this.selected   = new TreeViewModel();
     this.epiSession = _session;
 }
Example #8
0
 public EstimateReqDialog(Ice.Core.Session _session = null)
 {
     InitializeComponent();
     epiSession        = _session;
     this._repo        = new Erp.Custom.CostManagement.Repositories();
     this._repoAuth    = new AuthRepo();
     this.estimateList = new List <CostRequestModel>();
     this.selected     = new CostRequestModel();
 }
Example #9
0
 public PRList(EpiTransaction iTrans)
     : base(iTrans)
 {
     InitializeComponent();
     this.trans      = (Transaction)iTrans;
     this._repo      = new RequisitionRepo();
     this._repoAth   = new AuthRepo();
     this.epiSession = ((Ice.Core.Session)oTransaction.Session);
 }
Example #10
0
 public Approval(Ice.Core.Session _session = null, ApprovalModel model = null, ReqHeadModel reqHead = null)
 {
     InitializeComponent();
     epiSession        = _session;
     this.content      = model;
     this.reqHeadModel = reqHead;
     this._repo        = new AuthRepo();
     this._repoReq     = new RequisitionRepo();
 }
Example #11
0
        public bool DeleteAuthorized(Ice.Core.Session session, TeamMemberModel model)
        {
            string sql = string.Format(@"DELETE FROM Custom_Authorized WHERE TreeViewId = {0} AND TeamId = '{1}' AND UserId = '{2}'" + Environment.NewLine
                                       , model.TreeViewId
                                       , model.TeamCode
                                       , model.UserId);

            Repository.Instance.ExecuteWithTransaction(sql, "Delete Authorized");

            return(true);
        }
Example #12
0
        public RequestEstimate(EpiTransaction iTrans)
            : base(iTrans)
        {
            InitializeComponent();
            this.trans      = (Transaction)iTrans;
            this.epiSession = ((Ice.Core.Session)oTransaction.Session);

            this._repo    = new Erp.Custom.CostManagement.Repositories();
            this._repoAth = new AuthRepo();
            this.model    = new CostRequestModel();
        }
        public void SendToPOSuggestionsTest()
        {
            try
            {
                Ice.Core.Session curr = new Ice.Core.Session("manager", "manager", "net.tcp://GOLLUM/E10Pilot", Ice.Core.Session.LicenseType.Default);
            }
            catch (Exception ex)
            {
                goto x;
            }

x:
            Assert.Fail();
        }
Example #14
0
 public Ice.Core.Session Login(string user, string password, out string errmsg, string company = "")
 {
     try
     {
         Ice.Core.Session _session = new Ice.Core.Session(user, password, Ice.Core.Session.LicenseType.Default, EpicorSysConfig);
         errmsg = "";
         return(_session);
     }
     catch (Exception err)
     {
         errmsg = err.Message;
         return(null);
     }
 }
Example #15
0
        public CustomSession IdentifySession(string userName, string userPassword, out string errmsg)
        {
            errmsg = "";
            CustomSession sessionResult = new CustomSession();

            String[] arguments = Environment.GetCommandLineArgs();

            var result = ProcessCommandLineArguments(arguments);

            sessionResult.AppServerURL     = result.FirstOrDefault(x => x.Key.Equals("AppServerURL")).Value;
            sessionResult.ConnectionString = result.FirstOrDefault(x => x.Key.Equals("connectionString")).Value;
            sessionResult.UserId           = result.FirstOrDefault(x => x.Key.Equals("UserID")).Value;
            sessionResult.Password         = result.FirstOrDefault(x => x.Key.Equals("Password")).Value;

            if (!string.IsNullOrEmpty(sessionResult.UserId) && !string.IsNullOrEmpty(sessionResult.Password))
            {
                userName     = sessionResult.UserId;
                userPassword = sessionResult.Password;
            }

            try
            {
                Ice.Core.Session curr = new Ice.Core.Session(userName, userPassword
                                                             , sessionResult.AppServerURL
                                                             , Ice.Core.Session.LicenseType.Default);

                if (!string.IsNullOrEmpty(curr.SessionID))
                {
                    sessionResult.Company     = curr.CompanyID;
                    sessionResult.CompanyName = curr.CompanyName;
                    sessionResult.PlantId     = curr.PlantID.GetString();
                    sessionResult.PlantName   = curr.PlantName.GetString();
                    sessionResult.UserId      = curr.UserID;
                    sessionResult.Username    = curr.UserName;
                    sessionResult.SessionId   = curr.SessionID;
                    sessionResult.Client      = curr.Client.ToString();
                    sessionResult.Password    = userPassword;
                }

                return(sessionResult);
            }
            catch (Exception ex)
            {
                errmsg = ex.Message;
                return(sessionResult);
            }
        }
Example #16
0
        public IEnumerable <TeamHierarchyModel> DeleteNode(Ice.Core.Session session, TeamHierarchyModel model)
        {
            string sql = string.Format(@"DELETE FROM Custom_AuthTree WHERE TreeViewId = {0} AND TeamId = '{1}' " + Environment.NewLine
                                       , model.TreeViewId
                                       , model.TeamId);

            sql = sql + string.Format(@"DELETE FROM Custom_TeamNode WHERE TreeViewId = {0} AND TeamId = '{1}' " + Environment.NewLine
                                      , model.TreeViewId
                                      , model.TeamId);

            sql = sql + string.Format(@"DELETE FROM Custom_Authorized WHERE TreeViewId = {0} AND TeamId = '{1}' " + Environment.NewLine
                                      , model.TreeViewId
                                      , model.TeamId);

            Repository.Instance.ExecuteWithTransaction(sql, "Delete node");
            return(GetAllHierarchy(model.TreeViewId));
        }
    static void Main(string[] args)
    {
        // Hard-coded LogOn method
        // Reference: Ice.Core.Session.dll
        Ice.Core.Session session = new Ice.Core.Session("manager", "manager", "net.tcp://AppServer/MyCustomerAppserver-99999-10.0.700.2");

        // References: Epicor.ServiceModel.dll, Erp.Contracts.BO.ABCCode.dll
        var abcCodeBO = Ice.Lib.Framework.WCFServiceSupport.CreateImpl <Erp.Proxy.BO.ABCCodeImpl>(session, Erp.Proxy.BO.ABCCodeImpl.UriPath);

        // Call the BO methods
        var ds  = abcCodeBO.GetByID("A");
        var row = ds.ABCCode[0];

        System.Console.WriteLine("CountFreq is {0}", row.CountFreq);
        System.Console.WriteLine("CustomField_c is {0}", row["CustomField_c"]);
        System.Console.ReadKey();
    }
        /// <summary>
        /// 取得EpicorSession
        /// </summary>
        /// <returns></returns>
        public static Ice.Core.Session GetEpicorSession()
        {
            try
            {
                //string serverUrl = ConfigurationManager.AppSettings["ServerUrl"];
                string userName = ConfigurationManager.AppSettings["EpicorLoginName"];
                string passWord = ConfigurationManager.AppSettings["EpicorLoginPassword"];

                //passWord = DESEncrypt.Decrypt(passWord);
                string           configFile    = System.AppDomain.CurrentDomain.BaseDirectory + "/Config/Default.sysconfig";
                Ice.Core.Session epicorSession = new Ice.Core.Session(userName, passWord, serverUrl, Ice.Core.Session.LicenseType.Default, configFile);
                return(epicorSession);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #19
0
        /// <summary>初始化数据(InitializeCustomCode中调用该方法)</summary>
        /// <param name="csm1">接受从Epicor中传过来的CustomScriptManager对象</param>
        public void Initialize(Ice.Lib.Customization.CustomScriptManager csm1)
        {
            csm = csm1;
            //((Ice.Core.Session)(csm.GetGlobalInstance("oTrans")));//(Ice.Core.Session)(csm.GetGlobalInstance("oTrans"));//
            oTrans  = ((Erp.UI.App.POEntry.Transaction)(csm.GetGlobalInstance("oTrans")));
            session = (Ice.Core.Session)(oTrans.Session);
            edvUD01 = ((EpiDataView)(oTrans.EpiDataViews["POHeader"]));
            //oTrans.AdapterList[""];
            poAdapter           = new POAdapter(oTrans);
            baseToolbarsManager = ((UltraToolbarsManager)(csm.GetGlobalInstance("baseToolbarsManager")));
            standardTools       = baseToolbarsManager.Toolbars["Standard Tools"];
            TForm           = ((Erp.UI.App.POEntry.POEntryForm)(this.csm.GetGlobalInstance("POEntryForm")));
            epiBtNew        = GetControlByName <EpiButton>(TForm, "eb_sendPO");//获取UI界面的控件
            epiBtNew.Click += EpiBtNew_Click;

            ds_po       = oTrans.POData;
            dt_poheder  = ds_po.POHeader;
            dt_podetail = ds_po.PODetail;
        }
Example #20
0
        public bool AddAuthorized(Ice.Core.Session session, TeamMemberModel model)
        {
            string sql = string.Format(@"IF NOT EXISTS
                                         (
                                           SELECT * FROM Custom_Authorized (NOLOCK) WHERE TreeViewId = {0} AND TeamId = '{1}' AND UserId = '{2}'
                                         )
                                            BEGIN
                                                INSERT INTO Custom_Authorized
                                                           (TreeViewId
                                                           ,TeamId
                                                           ,UserId
                                                           ,VisibleFlag
                                                           ,CreateBy
                                                           ,LastUpdateBy)
                                                     VALUES
                                                           ( {0} --<TreeViewId, int,>
                                                           , '{1}' --<TeamId, nvarchar(100),>
                                                           , '{2}' --<UserId, nvarchar(100),>
                                                           , 1 --<VisibleFlag, int,>
                                                           , '{3}' --<CreateBy, nvarchar(50),>
                                                           , '{3}' --<LastUpdateBy, nvarchar(50),>
                                                           )
                                            END
                                        ELSE
                                            BEGIN
                                                UPDATE Custom_Authorized
                                                    SET TreeViewId = {0} --<TreeViewId, int,>
                                                        ,TeamId = '{1}' --<TeamId, nvarchar(100),>
                                                        ,UserId = '{2}' --<UserId, nvarchar(100),>
                                                        ,VisibleFlag = 1 --<VisibleFlag, int,>
                                                        ,LastUpdateBy = '{3}' --<LastUpdateBy, nvarchar(50),>
                                                        WHERE TreeViewId = {0} AND TeamId = '{1}' AND UserId = '{2}'
	                                        END"     + Environment.NewLine
                                       , model.TreeViewId
                                       , model.TeamCode
                                       , model.UserId
                                       , session.UserID);

            Repository.Instance.ExecuteWithTransaction(sql, "Add Authorized");

            return(true);
        }
Example #21
0
        public string GetLastRunning(Ice.Core.Session _session, string teamid, int quoteNo)
        {
            var team = _repo.GetTeamByUserID(_session.UserID);
            EstimateRunningModel model = new EstimateRunningModel();
            int    iRn = 1;
            string no  = "";

            if (quoteNo == 0)
            {
                return(no);
            }

            model = GetExistingRow(quoteNo);

            if (model == null)
            {
                model = GetLastRow(team);
                if (model != null)
                {
                    iRn = model.RunningNo + 1;
                }
                no = string.Format(@"{0}E{1:00}{2:00}{3:000}", team, DateTime.Now.ToString("yy"), DateTime.Now.ToString("MM"), iRn);
            }
            else
            {
                iRn = model.RunningNo;
                no  = model.EstimateNo;
            }

            string outResult         = string.Empty;
            EstimateRunningModel est = new EstimateRunningModel();

            est.TeamId          = team;
            est.RunningNo       = iRn;
            est.EstimateNo      = no;
            est.QuoteNumber     = quoteNo;
            est.GeneratedPerson = _session.UserID;
            CustomSession custSession = _s.GetSessionForWCFAccount();

            NewRunningRow(custSession, est, out outResult);
            return(no);
        }
Example #22
0
        public Ice.Core.Session GetSession()
        {
            CustomSession sessionResult = new CustomSession();

            sessionResult.AppServerURL     = "net.tcp://GOLLUM/E10Pilot";
            sessionResult.ConnectionString = "Data Source=gollum;Initial Catalog=E10Pilot;Persist Security Info=True;User ID=sa;Password=sp3@rm1nt";
            sessionResult.UserId           = "manager";
            sessionResult.Password         = "******";

            try
            {
                Ice.Core.Session curr = new Ice.Core.Session("manager", "manager"
                                                             , "net.tcp://GOLLUM/E10Pilot"
                                                             , Ice.Core.Session.LicenseType.Default);
                return(curr);
            }
            catch
            {
                return(null);
            }
        }
Example #23
0
        public IEnumerable <TeamMemberModel> AddAllMember(CustomSession session, List <TeamMemberModel> list, out bool IsSucces, out string msgError)
        {
            try
            {
                Ice.Core.Session curr = new Ice.Core.Session(session.UserId, session.Password
                                                             , session.AppServerURL
                                                             , Ice.Core.Session.LicenseType.Default);

                //UD07Tableset myUD = new UD07Tableset();

                //UD07DataSet
                IsSucces = true;
                msgError = "";
            }
            catch (Exception ex)
            {
                IsSucces = false;
                msgError = ex.Message;
            }

            return(null);
        }
Example #24
0
        public TreeViewModel SaveTree(Ice.Core.Session session, TreeViewModel model)
        {
            string sql = string.Format(@"IF NOT EXISTS
                                         (
                                           SELECT * FROM Custom_Tree (NOLOCK) WHERE TreeViewName = '{0}'
                                         )
                                           BEGIN
                                            INSERT INTO Custom_Tree
                                                       (TreeViewName
                                                       ,Description
                                                       ,VisibleFlag
                                                       ,CreateBy
                                                       ,LastUpdateBy)
                                                 VALUES
                                                       ( '{0}' --<TreeViewName, nvarchar(100),>
                                                       , '{1}'--<Description, nvarchar(max),>
                                                       ,  {2} --<VisibleFlag, int,>
                                                       , '{3}'--<CreateBy, nvarchar(50),>
                                                       , '{3}'--<LastUpdateBy, nvarchar(50),>
                                                       )
                                            END
                                        ELSE
                                            BEGIN
                                                UPDATE Custom_Tree
                                                   SET TreeViewName = '{0}' --<TreeViewName, nvarchar(100),>
                                                      ,Description = '{1}' --<Description, nvarchar(max),>
                                                      ,VisibleFlag = {2} --<VisibleFlag, int,>
                                                      ,LastUpdateBy = '{3}' --<LastUpdateBy, nvarchar(50),>
                                                 WHERE TreeViewName = '{0}'
	                                        END"     + Environment.NewLine
                                       , model.TreeViewName
                                       , model.Description
                                       , model.VisibleFlag
                                       , session.UserID);

            Repository.Instance.ExecuteWithTransaction(sql, "Delete Invoice");

            return(GetTree(model.TreeViewName));
        }
Example #25
0
 public void GetNew(Ice.Core.Session epiSession)
 {
     Teams     = _repo.GetAllTeam().ToList();
     Available = _repo.GetAllAvailable().ToList();
 }
Example #26
0
 public void DefaultSession()
 {
     eSession = _repo.GetSession();
 }