Example #1
0
        public string GetSpec(string sampleName)
        {
            try
            {
                QCSample sample = db.Select <QCSample>(new QCSample {
                    SampleName = sampleName
                });

                if (string.IsNullOrEmpty(sample.Description_CN))
                {
                    return("");
                }

                WorkCenter workCenter = db.Select <WorkCenter>(new WorkCenter {
                    LabID = sample.LabID, Lang = "CN"
                });
                Category category = db.Select <Category>(new Category {
                    TypeID = sample.TypeID, Lang = "CN"
                });
                return(string.Format("({0}){1}-{2}", workCenter.LabID, workCenter.LabName, category.TypeName));
            }
            catch (Exception e)
            {
                log.Error(e);

                throw new Exception(e.Message);
            }
        }
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            int rowCount = gridView1.SelectedRowsCount;

            if (rowCount != 1)
            {
                return;
            }

            Dictionary <string, object> paramenters = new Dictionary <string, object>();
            DataRow row = gridView1.GetDataRow(gridView1.GetSelectedRows()[0]);

            foreach (DataColumn c in row.Table.Columns)
            {
                paramenters.Add(c.ColumnName, row[c.ColumnName]);
            }
            if (EditEvent != null)
            {
                GetSample = new QCSample
                {
                    SampleName     = paramenters["SampleName"].ToString(),
                    LabID          = this.LabID,
                    TypeID         = this.TypeID,
                    Description_EN = paramenters["Description_EN"].ToString(),
                    Description_TW = paramenters["Description_TW"].ToString(),
                    Description_CN = paramenters["Description_CN"].ToString(),
                    Description_VN = paramenters["Description_VN"].ToString(),
                    AB             = paramenters["AB"].ToString()
                };


                EditEvent(sender, e);
            }
        }
Example #3
0
        public bool UpdateSample(QCSample sample)
        {
            Console.WriteLine("SampleService-DeleteSample():" + DateTime.Now);
            try
            {
                return(sampledal.UpdateSample(sample));
            }
            catch (Exception e)
            {
                log.Error(e);

                throw new Exception(e.Message);
            }
        }
Example #4
0
        public bool UpdateSample(QCSample sample)
        {
            Console.WriteLine("SampleDAL - UpdateSample():" + DateTime.Now.ToString());
            try
            {
                return(db.Update(sample));
            }
            catch (Exception e)
            {
                log.Error(e);

                throw new Exception(e.Message);
            }
        }
Example #5
0
        /// <summary>
        /// Add a new Sample
        /// </summary>
        /// <param name="sample"> Sample Model</param>
        /// <returns></returns>
        public bool AddSample(QCSample sample)
        {
            string sampleName = CreateSampleNameCode(sample.LabID, sample.TypeID);

            sample.SampleName = sampleName;
            Console.WriteLine("SampleDAL - AddSample():" + DateTime.Now.ToString());
            try
            {
                return(db.Insert(sample));
            }
            catch (Exception e)
            {
                log.Error(e);

                throw new Exception(e.Message);
            }
        }
        public IHttpActionResult GradesProcessing(string id)
        {
            try
            {
                JsonObject       json  = new JsonObject();
                GradeMaterial    gra   = biz.GetGradeMaterial(id);
                GradeMaterialDto grade = new GradeMaterialDto();
                if (!string.IsNullOrEmpty(gra.SampleName) && !string.IsNullOrEmpty(gra.LOT_NO))
                {
                    SampleService sampleDal = new SampleService();
                    QCSample      sample    = sampleDal.SelectSample(gra.SampleName);

                    QCMaterial material = sampleDal.GetMaterial(gra.SampleName, gra.LOT_NO);
                    json["SampleName"]           = sample.SampleName;
                    json["SampleDescription_EN"] = sample.Description_EN;
                    json["SampleDescription_CN"] = sample.Description_CN;
                    json["SampleDescription_TW"] = sample.Description_TW;
                    json["SampleDescription_VN"] = sample.Description_VN;
                    json["Status"] = gra.Status;
                    json["Grade"]  = gra.Grades;
                    json["LOT_NO"] = material.LOT_NO;
                    json["MaterialDescription_EN"] = material.Description_EN;
                    json["MaterialDescription_CN"] = material.Description_CN;
                    json["MaterialDescription_TW"] = material.Description_TW;
                    json["MaterialDescription_VN"] = material.Description_VN;
                    json["Version"]    = gra.Version;
                    json["VersionSpc"] = gra.VersionSpc;
                    json["UserID"]     = gra.UserID;
                    //json["Remark"] = gra.Remark;
                    DataTable dtGrade = biz.NewestGrades(id);
                    json["Grades"] = helpbiz.ConvertJson(dtGrade);
                    return(Ok(json));
                }
                else
                {
                    return(BadRequest("NO DATA"));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Loger.Error(ex);
                return(BadRequest(ex.Message + ex.StackTrace));
            }
        }
        public void EditSample(QCSample Sample)
        {
            _QCDialog._STEP  = STEP.Edit;
            _QCDialog.Sample = Sample;
            bool isAb = false;

            if (_SP01View.TypeID == 2)
            {
                isAb = true;
            }
            Console.WriteLine(_SP01View.TypeID);
            _QCDialog.SetLine(isAb);
            _QCDialog.LabName  = _SP01View.LabName;
            _QCDialog.TypeName = _SP01View.TypeName;
            _QCDialog.ShowDialog();
            if (_QCDialog.RValue)
            {
                string msg = _QCDialog.ReadyWork;
                if (string.IsNullOrEmpty(msg))
                {
                    if (!biz.UpdateSample(_QCDialog.Sample))
                    {
                        WriteTips(5, "Edit Sample Failed!");
                    }
                    else
                    {
                        WriteTips(5, "Edit Sample Successful!" + Sample.SampleName);
                        Query();
                    }
                }
                else
                {
                    WriteTips(5, msg, false);
                }
            }
        }
Example #8
0
 public bool CreateSample(QCSample sample)
 {
     return(sampledal.AddSample(sample));
 }
Example #9
0
 public bool UpdateSample(QCSample sample)
 {
     return(proxy.UpdateSample(sample));
 }
Example #10
0
 public bool CreateSample(QCSample sample)
 {
     return(proxy.CreateSample(sample));
 }