/// <summary>
        /// 添加CVT终检记录
        /// </summary>
        /// <param name="lnqFinalInfo">CVT终检信息</param>
        public void AddCVTFinalInspectionInfo(ZL_CVTFinalInspection lnqFinalInfo)
        {
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

            lnqFinalInfo.WorkID = BasicInfo.LoginID;

            ctx.ZL_CVTFinalInspection.InsertOnSubmit(lnqFinalInfo);
            ctx.SubmitChanges();
        }
コード例 #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (customDataGridView1.CurrentRow != null)
            {
                DateTime startTime = ServerTime.StartTime(dtpStart.Value);
                DateTime endTime   = ServerTime.EndTime(dtpEnd.Value);

                ZL_CVTFinalInspection tempLnq = new ZL_CVTFinalInspection();

                tempLnq.ProductCode = customDataGridView1.CurrentRow.Cells["箱号"].Value.ToString();
                tempLnq.ProductType = customDataGridView1.CurrentRow.Cells["型号"].Value.ToString();
                tempLnq.SelectDate  = ServerTime.Time;
                tempLnq.WorkID      = BasicInfo.LoginID;

                m_serverDeliveryInSpection.DeleteCVTFinalInspectionInfo(startTime, endTime, tempLnq);

                customDataGridView1.Rows.Remove(customDataGridView1.CurrentRow);
            }
        }
        /// <summary>
        /// 删除CVT终检记录
        /// </summary>
        /// <param name="startTime">开始日期</param>
        /// <param name="endTime">结束日期</param>
        /// <param name="lnqFinalInfo">CVT终检信息</param>
        public void DeleteCVTFinalInspectionInfo(DateTime startTime, DateTime endTime, ZL_CVTFinalInspection lnqFinalInfo)
        {
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

            var varData = from a in ctx.ZL_CVTFinalInspection
                          where a.SelectDate >= startTime && a.SelectDate <= endTime && a.WorkID == lnqFinalInfo.WorkID &&
                          a.ProductCode == lnqFinalInfo.ProductCode && a.ProductType == lnqFinalInfo.ProductType
                          select a;

            ctx.ZL_CVTFinalInspection.DeleteAllOnSubmit(varData);
            ctx.SubmitChanges();
        }
コード例 #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                Hashtable hsTable = new Hashtable();

                hsTable.Add("@ProductCode", txtProductCode.Text.Trim());
                hsTable.Add("@ProductType", cmbProductType.Text);

                DataTable tempTable =
                    GlobalObject.DatabaseServer.QueryInfoPro("CVTFinalInspection_Select", hsTable, out m_strError);

                DataTable sourceTable = (DataTable)customDataGridView1.DataSource;
                DataRow   tempRow     = sourceTable.NewRow();

                tempRow["型号"]  = cmbProductType.Text;
                tempRow["箱号"]  = txtProductCode.Text.Trim();
                tempRow["终检人"] = BasicInfo.LoginName;

                if (tempTable == null || tempTable.Rows.Count == 0)
                {
                    tempRow["下线试验信息"] = "";
                    tempRow["审核时间"]   = "";
                    tempRow["称重信息"]   = "";
                    tempRow["称重时间"]   = "";
                    tempRow["气密性信息"]  = "";
                    tempRow["检测时间"]   = "";
                }
                else
                {
                    bool isReapt = false;

                    if (sourceTable != null)
                    {
                        for (int i = 0; i < sourceTable.Rows.Count; i++)
                        {
                            if (sourceTable.Rows[i]["型号"].ToString() == tempTable.Rows[0]["型号"].ToString() &&
                                sourceTable.Rows[i]["箱号"].ToString() == tempTable.Rows[0]["箱号"].ToString())
                            {
                                isReapt = true;
                                return;
                            }
                        }
                    }

                    if (!isReapt)
                    {
                        tempRow["下线试验信息"] = tempTable.Rows[0]["下线试验信息"];
                        tempRow["审核时间"]   = tempTable.Rows[0]["审核时间"];
                        tempRow["称重信息"]   = tempTable.Rows[0]["称重信息"];
                        tempRow["称重时间"]   = tempTable.Rows[0]["称重时间"];
                        tempRow["气密性信息"]  = tempTable.Rows[0]["气密性信息"];
                        tempRow["检测时间"]   = tempTable.Rows[0]["检测时间"];
                    }
                }

                sourceTable.Rows.Add(tempRow);

                ZL_CVTFinalInspection tempLnq = new ZL_CVTFinalInspection();

                tempLnq.ProductCode = txtProductCode.Text.Trim();
                tempLnq.ProductType = cmbProductType.Text;
                tempLnq.SelectDate  = ServerTime.Time;

                m_serverDeliveryInSpection.AddCVTFinalInspectionInfo(tempLnq);

                customDataGridView1.DataSource = sourceTable;
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }