/// <summary>
        /// 亮度测试更新
        /// </summary>
        /// <param name="piLD"></param>
        /// <param name="SQLCommand"></param>
        /// <returns></returns>
        public int updateProjectorInformation_MainTable_LDZ2Dal(ProjectorInformation_LD piLD, string SQLCommand)
        {
            string sql = SQLhelp.GetSQLCommand(SQLCommand);

            SqlParameter[] pms = new SqlParameter[]
            {
                new SqlParameter("@FuselageCode", SqlDbType.VarChar, 80)
                {
                    Value = piLD.FuselageCode
                },
                new SqlParameter("@IlluminationValue", SqlDbType.VarChar, 50)
                {
                    Value = piLD.IlluminationValue
                },
                new SqlParameter("@WiredMAC", SqlDbType.VarChar, 50)
                {
                    Value = piLD.WiredMAC
                },
                new SqlParameter("@wirelessMAC", SqlDbType.VarChar, 50)
                {
                    Value = piLD.wirelessMAC
                },
            };

            return(SQLhelp.ExecuteNonQuery(sql, CommandType.Text, pms));
        }
 public bool updateProjectorInformation_MainTable_LDZ2Bll(ProjectorInformation_LD piLD, string SQLCommand)
 {
     if (pmtd.updateProjectorInformation_MainTable_LDZ2Dal(piLD, SQLCommand) > 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 /// <summary>
 /// 亮度测试插入
 /// </summary>
 /// <param name="piLD"></param>
 /// <param name="SQLCommand"></param>
 /// <returns></returns>
 public bool insertProjectorInformation_MainTable_LDBll(ProjectorInformation_LD piLD, string SQLCommand)
 {
     if (pmtd.insertProjectorInformation_MainTable_LDDal(piLD, SQLCommand) > 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
        void ExcelInput(string fileName, bool bl)
        {
            try
            {
                DataTable dt = ExcelHelperForCs.ImportFromExcel(fileName, "Sheet1", 0);
                List <ProjectorInformation_LD> list = new List <ProjectorInformation_LD>();
                if (bl)
                {
                    foreach (DataRow item in dt.Rows)
                    {
                        ProjectorInformation_LD ld = new ProjectorInformation_LD()
                        {
                            FuselageCode      = item[4].ToString(),
                            IlluminationValue = item[5].ToString(),
                            LuminanceTestTime = Convert.ToDateTime(item[1].ToString()),
                            WiredMAC          = item[2].ToString(),
                            wirelessMAC       = item[3].ToString(),
                            ZhiDan            = ZhiDan
                        };
                        list.Add(ld);
                    }
                    int i = 0;
                    foreach (ProjectorInformation_LD item in list)
                    {
                        i++;
                        if (pmtb.updateProjectorInformation_MainTable_LDBll(item, "updateProjectorInformation_MainTable_LD"))
                        {
                            my_context.Post(SetTextBox, "照度值写入成功!***" + " 机身码:" + item.FuselageCode + " ***时间:" + DateTime.Now.ToString() + "\r\n" + "\r\n");
                        }
                        else
                        {
                            my_context.Post(SetTextBox2, "照度值写入失败!***" + " 机身码:" + item.FuselageCode + " ***时间:" + DateTime.Now.ToString() + "\r\n" + "\r\n");
                        }

                        my_context.Post(SetLable, i.ToString() + "/" + list.Count.ToString());
                    }
                }
                else
                {
                    foreach (DataRow item in dt.Rows)
                    {
                        ProjectorInformation_LD ld = new ProjectorInformation_LD()
                        {
                            WiredMAC          = item[1].ToString(),
                            wirelessMAC       = item[2].ToString(),
                            FuselageCode      = item[3].ToString(),
                            IlluminationValue = item[4].ToString(),
                            ZhiDan            = ZhiDan
                        };
                        list.Add(ld);
                    }
                    int i = 0;
                    foreach (ProjectorInformation_LD item in list)
                    {
                        i++;
                        if (pmtb.updateProjectorInformation_MainTable_LDZ2Bll(item, "updateProjectorInformation_MainTableLDZ2"))
                        {
                            my_context.Post(SetTextBox, "照度值写入成功!***" + " 机身码:" + item.FuselageCode + " ***时间:" + DateTime.Now.ToString() + "\r\n" + "\r\n");
                        }
                        else
                        {
                            my_context.Post(SetTextBox2, "照度值写入失败!***" + " 机身码:" + item.FuselageCode + " ***时间:" + DateTime.Now.ToString() + "\r\n" + "\r\n");
                        }

                        my_context.Post(SetLable, i.ToString() + "/" + list.Count.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }