コード例 #1
0
ファイル: DieMaster.cs プロジェクト: swankham/Epicoil
 public DieMaster(SessionInfo _session, DieModel model = null)
 {
     InitializeComponent();
     this._repo = new DieMasterRepo();
     epiSession = _session;
     //epiSession = _session;
     DieHeader = model;
 }
コード例 #2
0
ファイル: DieMaster.cs プロジェクト: swankham/Epicoil
 private void SetHeaderContent(DieModel  model)
 {
     ClearHeaderContent();
     txtDieCode.DataBindings.Add("Text", model, "DieCode", false, DataSourceUpdateMode.OnPropertyChanged);
     txtDieName.DataBindings.Add("Text", model, "DieName", false, DataSourceUpdateMode.OnPropertyChanged);
     txtPattern.DataBindings.Add("Text", model, "Pattern.PatternID", false, DataSourceUpdateMode.OnPropertyChanged);
     txtPatternRemark.DataBindings.Add("Text", model, "Pattern.Remark", false, DataSourceUpdateMode.OnPropertyChanged);
     txtStrokePcs.DataBindings.Add("Text", model, "Pattern.StrokePerPcs", false, DataSourceUpdateMode.OnPropertyChanged);
     txtDieRemark.DataBindings.Add("Text", model, "DieRemark", false, DataSourceUpdateMode.OnPropertyChanged);          
 }
コード例 #3
0
ファイル: DieMaster.cs プロジェクト: swankham/Epicoil
 private void dataGridView1_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     if (e.RowIndex > -1)
     {
         DieHeader = _repo.GetByID(epiSession.PlantID, this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString().Trim());
         if (DieHeader != null)
         {
             SetHeaderContent(DieHeader);
         }
     }
 }
コード例 #4
0
ファイル: DieMasterRepo.cs プロジェクト: swankham/Epicoil
        public IEnumerable<DieModel> Save(DieModel data, SessionInfo epiSession)
        {
            try
            {
                Session currSession = new Session(epiSession.UserID, epiSession.UserPassword, epiSession.AppServer, Session.LicenseType.Default);
                UD107 myUD107 = new UD107(currSession.ConnectionPool);
                UD107DataSet dsUD107 = new UD107DataSet();

                string whereClause = string.Format(@"UD107.Key1 ='{0}' AND UD107.Key5 = '{1}'", data.DieCode, epiSession.PlantID);
                bool morePages = false;
                bool dataExisting = false;

                try
                {
                    UD107DataSet ds = myUD107.GetByID(data.DieCode, "", "", "", epiSession.PlantID);
                    dataExisting = true;
                }
                catch (Exception ex)
                {
                    if (ex.Message == "Record not found.") dataExisting = false;
                }

                if (dataExisting)
                {
                    dsUD107 = myUD107.GetRows(whereClause, "", "", 0, 1, out morePages);
                }
                else
                {
                    myUD107.GetaNewUD107(dsUD107);
                }

                DataRow drUD107 = dsUD107.Tables[0].Rows[0];
                drUD107.BeginEdit();
                drUD107["Key1"] = data.DieCode;
                drUD107["Key5"] = epiSession.PlantID;
                drUD107["Character01"] = data.DieName;
                drUD107["Character02"] = string.IsNullOrEmpty(data.DieRemark) ? "" : data.DieRemark;
                drUD107["ShortChar01"] = string.IsNullOrEmpty(data.PatternID) ? "" : data.PatternID;
                drUD107.EndEdit();
                myUD107.Update(dsUD107);
                currSession.Dispose();
                return GetDieAll(epiSession.PlantID);
            }
            catch (Exception ex)
            {
                return null;
            }
        }
コード例 #5
0
ファイル: DieMasterRepo.cs プロジェクト: swankham/Epicoil
        public IEnumerable<DieModel> GetByFilterDie(DieModel Filter)
        {
            IEnumerable<DieModel> query = this.GetDieAll(Filter.PlantID);

            if (!string.IsNullOrEmpty(Filter.DieCode)) query = query.Where(p => p.DieCode.ToString().ToUpper().Contains(Filter.DieCode.ToString().ToUpper()));

            return query;
        }
コード例 #6
0
ファイル: DieMaster.cs プロジェクト: swankham/Epicoil
        private void tlbSave_Click(object sender, EventArgs e)
        {
            bool err = false;
            DieModel model = new DieModel();
            if (txtDieCode.Text.Trim() == "")
            {
                err = true;
            }
            else
            {
                model.DieCode = txtDieCode.Text.Trim();
            }

            if (txtDieName.Text.Trim() == "")
            {
                err = true;
            }
            else
            {
                model.DieName = txtDieName.Text.Trim();
            }

            if (txtPattern.Text.Trim() == "")
            {
                err = true;
            }
            else
            {
                model.PatternID = txtPattern.Text.Trim();
            }
                  
            model.DieRemark = txtDieRemark.Text.Trim();
            
            if (err == false)
            {
                var result = _repo.Save(DieHeader, epiSession);
                SetGrid(result);
                ClearHeaderContent();
            }
            else
            {
                MessageBox.Show("Please insert data before SAVE !!!","Die Master Warning");
            }
        }
コード例 #7
0
ファイル: DieMaster.cs プロジェクト: swankham/Epicoil
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string dieID = "";
            int dieCode = 1;
            dieID = _repo.MaxID();
            dieID = dieID.Substring(3, 4);
            int ignoreMe;
            bool successfullyParsed = int.TryParse(dieID, out ignoreMe);
            if (successfullyParsed)
            {
                dieCode = Convert.ToInt32(dieID) + 1;
            }

            DieHeader = new DieModel();
            DieHeader.DieCode = "DIE" + dieCode.ToString("0000");
            SetHeaderContent(DieHeader);
        }
コード例 #8
0
ファイル: DieMaster.cs プロジェクト: swankham/Epicoil
 private void btnDieSearch_Click(object sender, EventArgs e)
 {
     DieModel model = new DieModel();
     model.DieCode  = txtDieSearch.Text;
     model.PlantID = epiSession.PlantID;
     var result = _repo.GetByFilterDie(model);
     SetGrid(result);
 }