Пример #1
0
        private void BindData(CostRequestModel result)
        {
            ClearBinding();

            #region Initail list of value

            txtEstimateNo.DataBindings.Add("Text", result, "EstimateNo", true, DataSourceUpdateMode.OnPropertyChanged);
            txtReviseNo.DataBindings.Add("Text", result, "RevisionStr", true, DataSourceUpdateMode.OnPropertyChanged);
            txtRequestBy.DataBindings.Add("Text", result, "RequestBy", true, DataSourceUpdateMode.OnPropertyChanged);
            dtpRequestDate.DataBindings.Add(new System.Windows.Forms.Binding("Value", result, "RequestDate", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
            chkGKCStadardFlag.DataBindings.Add("Checked", result, "GKCStadardFlag", true, DataSourceUpdateMode.OnPropertyChanged);
            chkCustomerSpecFlag.DataBindings.Add("Checked", result, "CustomerSpecFlag", true, DataSourceUpdateMode.OnValidation);
            chkJisFlag.DataBindings.Add("Checked", result, "JisFlag", true, DataSourceUpdateMode.OnPropertyChanged);
            chkDinFlag.DataBindings.Add("Checked", result, "DinFlag", true, DataSourceUpdateMode.OnPropertyChanged);
            chkANSFlag.DataBindings.Add("Checked", result, "ANSFlag", true, DataSourceUpdateMode.OnPropertyChanged);
            chkOtherFlag.DataBindings.Add("Checked", result, "OtherFlag", true, DataSourceUpdateMode.OnPropertyChanged);
            txtOtherRemark.DataBindings.Add("Text", result, "OtherRemark", true, DataSourceUpdateMode.OnPropertyChanged);
            txtCustomer.DataBindings.Add("Text", result, "CustomerName", true, DataSourceUpdateMode.OnPropertyChanged);
            txtProjectName.DataBindings.Add("Text", result, "ProjectName", true, DataSourceUpdateMode.OnPropertyChanged);
            txtBudget.DataBindings.Add("Text", result, "Budget", true, DataSourceUpdateMode.OnPropertyChanged, 1, "#,###,##0.00");
            txtLocation.DataBindings.Add("Text", result, "Location", true, DataSourceUpdateMode.OnPropertyChanged);
            txtRemarks.DataBindings.Add("Text", result, "Remarks", true, DataSourceUpdateMode.OnPropertyChanged);

            txtFlowsheetFilePath.DataBindings.Add("Text", result, "FlowsheetFilePath", true, DataSourceUpdateMode.OnPropertyChanged);
            txtLayoutFilePath.DataBindings.Add("Text", result, "LayoutFilePath", true, DataSourceUpdateMode.OnPropertyChanged);
            txtSpecFilePath.DataBindings.Add("Text", result, "SpecFilePath", true, DataSourceUpdateMode.OnPropertyChanged);
            txtOtherFilePath.DataBindings.Add("Text", result, "OtherFilePath", true, DataSourceUpdateMode.OnPropertyChanged);


            rdoEstimateByCost.Checked  = result.EstimateByCostFlag;
            rdoEstimateByOwner.Checked = !result.EstimateByCostFlag;
            #endregion Initail list of value
        }
Пример #2
0
        private void SetSelected()
        {
            string estNo = dgvList.CurrentRow.Cells["estimateno"].Value.ToString().Trim();
            string rev   = dgvList.CurrentRow.Cells["rev"].Value.ToString().Trim();

            selected = _repo.GetEstimateByID(estNo, rev);
        }
Пример #3
0
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     this.model                    = new CostRequestModel();
     this.model.RequestDate        = DateTime.Now;
     this.model.RequestBy          = epiSession.UserID;
     this.model.EstimateByCostFlag = true;
     BindData(this.model);
 }
Пример #4
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();
 }
Пример #5
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();
        }
Пример #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.model.RequestBy   = epiSession.UserID;
            this.model.RequestDate = DateTime.Now;

            using (EstimateReqDialog frm = new EstimateReqDialog(epiSession))
            {
                frm.ShowDialog();
                if (frm.selected != null)
                {
                    this.model = frm.selected;
                }
            }
            BindData(model);
        }
Пример #7
0
        public CostRequestModel Save(CustomSession session, CostRequestModel model, bool insertFlag, out string resultMessage)
        {
            CostRequestModel result      = new CostRequestModel();
            CustomSession    custSession = _s.GetSessionForWCFAccount();

            Erp.Custom.Core.Session.EndpointBindingSvc.EndpointBindingType bindingType;
            resultMessage = "Save Completed.";// +Environment.NewLine +
            //"EstimateNo = " + model.GKCStadardFlag + Environment.NewLine +
            //"ReviseNo = " + model.ReviseNo + Environment.NewLine +
            //"RevisionStr = " + model.RevisionStr;


            string sRowMod = string.Empty;

            UriBuilder builder = _inst.EndpointBinding(out bindingType);
            SessionModSvcContractClient sessionModClient = _inst.IdentifiesSession(custSession);

            builder.Path = _inst.epiSite + "/Ice/BO/UD07.svc";
            UD07SvcContractClient ud07Client = _inst.GetClient <UD07SvcContractClient, UD07SvcContract>(builder.Uri.ToString(), custSession.UserId, custSession.Password, bindingType);

            //resultMessage = resultMessage + Environment.NewLine + "Binded.";
            Guid sessionId = Guid.Empty;

            try
            {
                sessionId = sessionModClient.Login();
                sessionModClient.Endpoint.Behaviors.Add(new HookServiceBehavior(sessionId, custSession.UserId));
                ud07Client.Endpoint.Behaviors.Add(new HookServiceBehavior(sessionId, custSession.UserId));

                //resultMessage = resultMessage + Environment.NewLine + "GUID : " + sessionId;
                var ts = new UD07Tableset();

                if (!insertFlag)
                {
                    var row = GetRowByID(model.EstimateNo, model.ReviseNo);
                    ts      = ud07Client.GetByID(row.EstimateNo, row.RevisionStr.Trim(), row.RunningNo.ToString(), row.TeamId, row.GeneratedPerson);
                    sRowMod = "U";
                }
                else
                {
                    int iRn = 1;
                    ud07Client.GetaNewUD07(ref ts);
                    sRowMod = "A";
                    if (string.IsNullOrEmpty(model.EstimateNo))
                    {
                        var res = GetLastRow(model.TeamId);
                        if (model != null)
                        {
                            iRn = ((res == null) ? 0 : res.RunningNo) + 1;
                        }
                        model.EstimateNo = string.Format(@"{0}E{1:00}{2:00}{3:000}", model.TeamId, DateTime.Now.ToString("yy"), DateTime.Now.ToString("MM"), iRn);
                        model.ReviseNo   = 0;
                        model.RunningNo  = iRn;
                        model.RequestBy  = session.UserId;
                    }
                    else
                    {
                        model.ReviseNo = GetLastRow(model.TeamId).ReviseNo + 1;
                    }

                    ts.UD07[0].Key1     = model.EstimateNo;
                    ts.UD07[0].Key2     = string.IsNullOrEmpty(Enum.GetName(typeof(RevisionEnum), Convert.ToInt32(Convert.ToInt32((model.ReviseNo.GetInt() == 0) ? 0 : model.ReviseNo)))) ? string.Empty : Enum.GetName(typeof(RevisionEnum), Convert.ToInt32(Convert.ToInt32((model.ReviseNo.GetInt() == 0) ? 0 : model.ReviseNo)));
                    ts.UD07[0].Key3     = model.RunningNo.GetString();
                    ts.UD07[0].Number02 = model.ReviseNo.GetInt();
                    ts.UD07[0].Key4     = model.TeamId;
                    ts.UD07[0].Key5     = model.RequestBy;
                }

                ts.UD07[0].Character01 = string.IsNullOrEmpty(model.ProjectName) ? "" : model.ProjectName;
                ts.UD07[0].Character03 = string.IsNullOrEmpty(model.OtherRemark) ? "" : model.OtherRemark;
                ts.UD07[0].Character04 = string.IsNullOrEmpty(model.Remarks) ? "" : model.Remarks;
                ts.UD07[0].Character05 = string.IsNullOrEmpty(model.Location) ? "" : model.Location;
                ts.UD07[0].Number01    = model.Budget;
                ts.UD07[0].CheckBox01  = model.GKCStadardFlag;
                ts.UD07[0].CheckBox02  = model.JisFlag;
                ts.UD07[0].CheckBox03  = model.ANSFlag;
                ts.UD07[0].CheckBox04  = model.CustomerSpecFlag;
                ts.UD07[0].CheckBox05  = model.DinFlag;
                ts.UD07[0].CheckBox06  = model.OtherFlag;
                ts.UD07[0].CheckBox07  = model.EstimateByCostFlag;
                //ts.UD07[0].CheckBox08 = model.EstimateByOwner;
                ts.UD07[0].ShortChar01 = string.IsNullOrEmpty(model.CustomerName) ? "" : model.CustomerName;
                ts.UD07[0].ShortChar02 = string.IsNullOrEmpty(model.Ref_ProjectID) ? "" : model.Ref_ProjectID;

                ts.UD07[0].Date01 = model.RequestDate;
                ts.UD07[0].RowMod = sRowMod;
                //resultMessage = resultMessage + Environment.NewLine + "RowMod : " + sRowMod + model.ToString();

                try
                {
                    ud07Client.Update(ref ts);
                }
                catch (FaultException <Erp.Custom.Core.Session.Epicor.ReqSvc.EpicorFaultDetail> ex)
                {
                    if (ex.Detail.ExceptionKindValue.Equals("RecordNotFound", StringComparison.InvariantCultureIgnoreCase))
                    {
                        resultMessage = "Record deleted.";
                    }
                    else
                    {
                        resultMessage = ex.Message;
                    }
                }
                catch (Exception x)
                {
                    resultMessage = x.Message;
                }
                result = GetEstimateByID(model.EstimateNo, model.ReviseNo.GetString());
            }
            catch (Exception ex)
            {
                resultMessage = "Error Code : 20055 " + ex.Message + Environment.NewLine + "Source : " + ex.Source + Environment.NewLine + "StackTrace : " + ex.StackTrace;
                sessionModClient.Logout();
            }

            //sessionModClient.Logout();
            return(result);
        }