Пример #1
0
        /// <summary>
        /// 修改车型参数或者油耗值信息后,修改他们关联的油耗数据
        /// </summary>
        /// <param name="updateType">修改类型:“FUEL”表示修改车型参数对应的油耗数据;“CPOS”表示修改轮胎规格对应的油耗数据</param>
        protected void UpdateFuelData(string updateType)
        {
            try
            {
                // 记录修改后的CPOS或者车型参数编号
                string        mainIds      = string.Empty;
                ChryslerUtils chryslerUtil = new ChryslerUtils();
                List <string> ctnyList     = new List <string>();

                // 冲界面获取修改后的车型参数或者cpos信息
                if (updateType == "MAIN")
                {
                    ctnyList = chryslerUtil.GetMainIdFromControl(this.gvCtny, (DataTable)this.gcCtny.DataSource, updateType);
                    if (ctnyList.Count < 1)
                    {
                        MessageBox.Show("请首先选择车型参数数据或者油耗值数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
                else if (updateType == "FUEL")
                {
                    ctnyList = chryslerUtil.GetMainIdFromControl(this.gvCpos, (DataTable)this.gcCpos.DataSource, updateType);
                    if (ctnyList.Count < 1)
                    {
                        MessageBox.Show("请首先选择车型参数数据或者油耗值数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                foreach (string ctnyId in ctnyList)
                {
                    if (updateType == "MAIN")
                    {
                        mainIds += string.Format(",{0}", ctnyId);
                    }
                    else if (updateType == "FUEL")
                    {
                        mainIds += string.Format(",{0}", ctnyId);
                    }
                }
                if (!string.IsNullOrEmpty(mainIds))
                {
                    mainIds = mainIds.Substring(1);
                }

                // 查看修改后的CPOS或车型参数关联到的原始油耗数据
                using (ReviewUpdateVinForm reviewVinForm = new ReviewUpdateVinForm(mainIds, updateType))
                {
                    reviewVinForm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        /// <summary>
        /// 删除车型参数或CPOS
        /// </summary>
        /// <param name="deleteType">修改类型:“FUEL”表示修改车型参数对应的油耗数据;“CPOS”表示修改轮胎规格对应的油耗数据</param>
        protected void DeleteMainCpos(string deleteType)
        {
            // 记录修改后的CPOS或者车型参数编号
            string        mainIds      = string.Empty;
            ChryslerUtils chryslerUtil = new ChryslerUtils();

            try
            {
                List <string> ctnyList = new List <string>();

                // 冲界面获取修改后的车型参数或者cpos信息
                if (deleteType == "MAIN")
                {
                    ctnyList = chryslerUtil.GetMainIdFromControl(this.gvCtny, (DataTable)this.gcCtny.DataSource, deleteType);
                }
                else if (deleteType == "FUEL")
                {
                    ctnyList = chryslerUtil.GetMainIdFromControl(this.gvCpos, (DataTable)this.gcCpos.DataSource, deleteType);
                }
                if (ctnyList.Count < 1)
                {
                    MessageBox.Show("请选择要删除的数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                foreach (string ctnyId in ctnyList)
                {
                    if (deleteType == "MAIN")
                    {
                        mainIds += string.Format(",{0}", ctnyId);
                    }
                    else if (deleteType == "FUEL")
                    {
                        mainIds += string.Format(",{0}", ctnyId);
                    }
                }
                if (!string.IsNullOrEmpty(mainIds))
                {
                    mainIds = mainIds.Substring(1);
                }

                string delMsg = string.Empty;
                if (MessageBox.Show("确定要删除吗?", "删除确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
                {
                    delMsg = chryslerUtil.DeleteMainCpos(deleteType, mainIds);

                    if (deleteType == "MAIN")
                    {
                        this.ShowMainData();
                    }
                    else if (deleteType == "FUEL")
                    {
                        this.ShowCposFuelData();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }