public bool DelAttribute(QCAttribute attribute)
        {
            Console.WriteLine("AttributeService-DelAttribute():" + DateTime.Now.ToString());

            try
            {
                string msg = gate.DbHelper.ExecuteStoredProcedure("I_CheckDeleteAttibute",
                                                                  new string[] { "SampleName", "PropertyName" },
                                                                  new object[] { attribute.SampleName, attribute.PropertyName }).Tables[0].Rows[0][0].ToString();


                if (string.IsNullOrEmpty(msg))
                {
                    return(db.Delete(Select(attribute)));
                }
                else
                {
                    throw new Exception(msg);
                }
            }
            catch (Exception e)
            {
                log.Error(e);
                throw new Exception(e.Message);
            }
        }
 public bool AddAttribute(QCAttribute attribute)
 {
     Console.WriteLine("AttributeService-AddAttribute():" + DateTime.Now.ToString());
     try
     {
         return(db.Insert(attribute));
     }
     catch (Exception e)
     {
         log.Error(e);
         throw new Exception(e.Message);
     }
 }
 protected QCAttribute Select(QCAttribute attribute)
 {
     try
     {
         return(db.Select <QCAttribute>(new QCAttribute {
             SampleName = attribute.SampleName, PropertyName = attribute.PropertyName
         }));
     }
     catch (Exception e)
     {
         log.Error(e);
         throw new Exception(e.Message);
     }
 }
        public bool UpdateAttribute(QCAttribute attribute)
        {
            Console.WriteLine("AttributeService-UpdateAttribute():" + DateTime.Now.ToString() + attribute.Description_EN);

            try
            {
                return(db.Update(attribute));
            }
            catch (Exception e)
            {
                log.Error(e);
                throw new Exception(e.Message);
            }
        }
        public QCAttribute GetAttribute()
        {
            QCAttribute attr = new QCAttribute();

            attr.SampleName     = this.txtSampleName.Text.Trim();
            attr.PropertyName   = txtPropertyName.Text.Trim();
            attr.Description_EN = txtSpec_EN.Text.Trim();
            attr.Description_TW = txtSpec_TW.Text.Trim();
            attr.Description_CN = txtSpec_CN.Text.Trim();
            attr.Description_VN = txtSpec_VN.Text.Trim();
            attr.Unit           = txtUnit.Text.Trim();
            attr.Prec           = Convert.ToInt32(_Prec.Text.Trim());
            attr.Remark         = txtRemark.Text;
            attr.EnRemark       = txtEnRemark.Text;
            attr.JPNRemark      = txtJPNRemark.Text;
            attr.OrderBy        = Convert.ToInt32(txtOrderBy.Text.Trim());//Added By Isaac 05-29-2018 03:20 PM
            return(attr);
        }
        public bool AddAttribute(QCAttribute attribute, out string msg)
        {
            Console.WriteLine("AttributeService-AddAttribute():" + DateTime.Now);
            try
            {
                msg = "";

                Console.WriteLine("AttributeService-AddAttribute():" + DateTime.Now);
                attribute.OrderBy = (int)acQC.DbHelper.SelectScalar(@"
                                     SELECT ISNULL(max(OrderBy),0)+1 
                                      FROM [Attribute]
                                     WHERE SampleName = @SampleName",
                                                                    new object[] { attribute.SampleName });

                return(attributeDAL.AddAttribute(attribute));
            }
            catch (Exception e)
            {
                log.Error(e);

                throw new Exception(e.Message);
            }
        }
Esempio n. 7
0
        void _AT01View_eventShowDetails(object sender, EventArgs e)
        {
            EgateArgs args = (EgateArgs)e;

            //_AT01Dialog = new AT01Dialog();

            if (string.IsNullOrEmpty((string)args.EgateDictionary["SampleName"].ToString()))
            {
                // WriteTips(5, CultureLanguage.Translator(this.Name, 3, "No sample name selected"));
                WriteTips(5, "No sample name selected");
            }
            else
            {
                QCAttribute s = new QCAttribute();
                s.SampleName = (string)args.EgateDictionary["SampleName"].ToString();

                s.PropertyName           = (string)args.EgateDictionary["PropertyName"].ToString();
                s.Description_EN         = (string)args.EgateDictionary["Description_EN"].ToString();
                s.Description_TW         = (string)args.EgateDictionary["Description_TW"].ToString();
                s.Description_CN         = (string)args.EgateDictionary["Description_CN"].ToString();
                s.Description_VN         = (string)args.EgateDictionary["Description_VN"].ToString();
                s.Unit                   = (string)args.EgateDictionary["Unit"].ToString();
                s.Prec                   = Convert.ToInt32(args.EgateDictionary["Prec"].ToString());
                s.Remark                 = (string)args.EgateDictionary["Remark"].ToString();
                s.EnRemark               = (string)args.EgateDictionary["EnRemark"].ToString();
                s.JPNRemark              = (string)args.EgateDictionary["JPNRemark"].ToString();
                s.OrderBy                = Convert.ToInt32(args.EgateDictionary["OrderBy"].ToString());
                _AT01Dialog.SetAttribute = s;

                if (_AT01Dialog.ShowDialog() == DialogResult.OK)
                {
                    Query();
                    WriteTips(5, "Save Successful!");
                }
            }
        }
 public bool UpdateAttribute(QCAttribute attribute)
 {
     return(proxy.UpdateAttribute(attribute));
 }
 public bool AddAttribute(QCAttribute attribute, out string msg)
 {
     return(proxy.AddAttribute(attribute, out msg));
 }
 public bool UpdateAttribute(QCAttribute attribute)
 {
     Console.WriteLine("AttributeService-UpdateAttribute():" + DateTime.Now);
     return(attributeDAL.UpdateAttribute(attribute));
 }