Пример #1
0
        public static string InsertDataControl(DDataControl pitems)
        {
            int   i        = 0;
            Query _QueryRS = DDataControl.CreateQuery();

            try
            {
                //if ((!DDataControl.FetchByParameter(DDataControl.Columns.DataName, Comparison.Equals, pitems.DataName).
                //          Read()) &&
                //    (!DDataControl.FetchByParameter(DDataControl.Columns.AliasName, Comparison.Equals, pitems.AliasName)
                //          .Read()))
                //{
                pitems.IsNew = true;
                pitems.Save(i);
                return(_QueryRS.GetMax(DDataControl.Columns.DataControlId).ToString());
                //}
                //else
                //{
                //    return "-1";
                //}
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
 public static void UpdateDataControl(DDataControl pitems)
 {
     try
     {
         if (DDataControl.FetchByID(pitems.DataControlId) != null)
         {
             pitems.IsNew = false;
             pitems.Save();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
        public void Update(decimal DataControlId, decimal DeviceId, int DataTypeId, int?DataSequence, bool?ControlType, string DataName, string AliasName, string MeasureUnit, short DataPoint, string NormalLevel, string NormalLevelW, bool?DataView, bool?DataPrint, string DataType, string Description, string TestDataId, string SCondition, string SFormula, short?ForceRun)
        {
            DDataControl item = new DDataControl();

            item.MarkOld();
            item.IsLoaded = true;

            item.DataControlId = DataControlId;

            item.DeviceId = DeviceId;

            item.DataTypeId = DataTypeId;

            item.DataSequence = DataSequence;

            item.ControlType = ControlType;

            item.DataName = DataName;

            item.AliasName = AliasName;

            item.MeasureUnit = MeasureUnit;

            item.DataPoint = DataPoint;

            item.NormalLevel = NormalLevel;

            item.NormalLevelW = NormalLevelW;

            item.DataView = DataView;

            item.DataPrint = DataPrint;

            item.DataType = DataType;

            item.Description = Description;

            item.TestDataId = TestDataId;

            item.SCondition = SCondition;

            item.SFormula = SFormula;

            item.ForceRun = ForceRun;

            item.Save(UserName);
        }
Пример #4
0
        private void cmdSave_Click(object sender, EventArgs e)
        {
            try
            {
                txtID.Text = txtID.Text.ToUpper();
                if (ValidData())
                {
                    switch (vAction)
                    {
                    case action.Insert:
                        var obj = new DDataControl();
                        obj.DataName    = "";
                        obj.DeviceId    = Utility.Int32Dbnull(cboDevice.SelectedValue, -1);
                        obj.DataTypeId  = 0;
                        obj.ControlType = true;
                        obj.AliasName   = Utility.sDbnull(txtAlias.Text);
                        obj.Description = Utility.sDbnull(txtDesc.Text);
                        obj.IsNew       = true;
                        obj.Save();

                        drData = dtDataControl.NewRow();
                        drData[DDataControl.Columns.DataControlId] =
                            DDataControl.CreateQuery().WHERE(DDataControl.Columns.DeviceId, Utility.Int32Dbnull(cboDevice.SelectedValue, -1)).
                            WHERE(DDataControl.Columns.AliasName, txtAlias.Text).GetMax(DDataControl.Columns.DataControlId);
                        txtID.Text = drData[DDataControl.Columns.DataControlId].ToString();
                        ApplyData2Datarow();
                        dtDataControl.Rows.InsertAt(drData, 0);
                        dtDataControl.AcceptChanges();
                        vAction = action.Update;
                        break;

                    case action.Update:
                        new Update(DDataControl.Schema.Name).Set(DDataControl.Columns.AliasName).EqualTo(txtAlias.Text).
                        Set(DDataControl.Columns.Description).EqualTo(txtDesc.Text).
                        Set(DDataControl.Columns.DeviceId).EqualTo(Utility.Int32Dbnull(cboDevice.SelectedValue, -1)).
                        Where(DDataControl.Columns.DataControlId).IsEqualTo(Utility.Int32Dbnull(txtID.Text, -1)).Execute();
                        ApplyData2Datarow();
                        drData.AcceptChanges();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
        private void cmdSave_Click(object sender, EventArgs e)
        {
            try
            {
                txtID.Text = txtID.Text.ToUpper();
                if (ValidData())
                    switch (vAction)
                    {
                        case action.Insert:
                            var obj = new DDataControl();
                            obj.DataName = "";
                            obj.DeviceId = Utility.Int32Dbnull(cboDevice.SelectedValue, -1);
                            obj.DataTypeId = 0;
                            obj.ControlType = true;
                            obj.AliasName = Utility.sDbnull(txtAlias.Text);
                            obj.Description = Utility.sDbnull(txtDesc.Text);
                            obj.IsNew = true;
                            obj.Save();

                            drData = dtDataControl.NewRow();
                            drData[DDataControl.Columns.DataControlId] =
                                DDataControl.CreateQuery().WHERE(DDataControl.Columns.DeviceId,Utility.Int32Dbnull(cboDevice.SelectedValue, -1)).
                                WHERE(DDataControl.Columns.AliasName, txtAlias.Text).GetMax(DDataControl.Columns.DataControlId);
                            txtID.Text = drData[DDataControl.Columns.DataControlId].ToString();
                            ApplyData2Datarow();
                            dtDataControl.Rows.InsertAt(drData, 0);
                            dtDataControl.AcceptChanges();
                            vAction=action.Update;
                            break;
                        case action.Update:
                            new Update(DDataControl.Schema.Name).Set(DDataControl.Columns.AliasName).EqualTo(txtAlias.Text).
                                Set(DDataControl.Columns.Description).EqualTo(txtDesc.Text).
                                Set(DDataControl.Columns.DeviceId).EqualTo(Utility.Int32Dbnull(cboDevice.SelectedValue,-1)).
                                Where(DDataControl.Columns.DataControlId).IsEqualTo(Utility.Int32Dbnull(txtID.Text,-1)).Execute();
                            ApplyData2Datarow();
                            drData.AcceptChanges();
                            break;
                    }
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
Пример #6
0
        public void Insert(decimal DeviceId,int DataTypeId,int? DataSequence,bool? ControlType,string DataName,string AliasName,string MeasureUnit,short DataPoint,string NormalLevel,string NormalLevelW,bool? DataView,bool? DataPrint,string DataType,string Description,string TestDataId,string SCondition,string SFormula,short? ForceRun)
        {
            DDataControl item = new DDataControl();

            item.DeviceId = DeviceId;

            item.DataTypeId = DataTypeId;

            item.DataSequence = DataSequence;

            item.ControlType = ControlType;

            item.DataName = DataName;

            item.AliasName = AliasName;

            item.MeasureUnit = MeasureUnit;

            item.DataPoint = DataPoint;

            item.NormalLevel = NormalLevel;

            item.NormalLevelW = NormalLevelW;

            item.DataView = DataView;

            item.DataPrint = DataPrint;

            item.DataType = DataType;

            item.Description = Description;

            item.TestDataId = TestDataId;

            item.SCondition = SCondition;

            item.SFormula = SFormula;

            item.ForceRun = ForceRun;

            item.Save(UserName);
        }