コード例 #1
0
 public int DeleteBusiness_Detail(H_Bus_DetailEntity hce)
 {
     int intResult = 0;
       string strSql = "Delete from  H_Business_Detail where CCID=@c1 AND CDetailID=@c2";
       OleDbParameter[] prams = {
                                      new OleDbParameter("@c1", hce.CCID),
                                       new OleDbParameter("@c2", hce.CDetailID)
                                  };
       intResult = AccessHelper.ExecuteNonQuery(strCon(), strSql, prams);
       return intResult;
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: SpiderLoveFish/HZLApp
        bool InsertBusinessDetail(int index)
        {
            try
            {
                H_Bus_DetailEntity HBD = new H_Bus_DetailEntity();
                HBD.CCID = CompanyID;
                switch (index)
                {
                    #region 保存明细

                    case 1:
                         HBD.CDetailID = txt1dh.Text.Trim();
                HBD.CWidth = TxtToDec(txt1cd.Text.Trim());
                HBD.CHigh = TxtToDec(txt1gd.Text.Trim());
                HBD.CTS = TxtToDec(txt1ts.Text.Trim());
                HBD.CPFS = TxtToDec(txt1pfs.Text.Trim());
                HBD.CDAdress = pictureBox1.Tag.ToString();
                        break;
                    case 2:
                         HBD.CDetailID = txt2dh.Text.Trim();
                HBD.CWidth = TxtToDec(txt2cd.Text.Trim());
                HBD.CHigh = TxtToDec(txt2gd.Text.Trim());
                HBD.CTS = TxtToDec(txt2ts.Text.Trim());
                HBD.CPFS = TxtToDec(txt2pfs.Text.Trim());
                HBD.CDAdress = pictureBox2.Tag.ToString();
                        break;
                    case 3:
                        HBD.CDetailID = txt3dh.Text.Trim();
                        HBD.CWidth = TxtToDec(txt3cd.Text.Trim());
                        HBD.CHigh = TxtToDec(txt3gd.Text.Trim());
                        HBD.CTS = TxtToDec(txt3ts.Text.Trim());
                        HBD.CPFS = TxtToDec(txt3pfs.Text.Trim());
                        HBD.CDAdress = pictureBox3.Tag.ToString();
                        break;
                    case 4:
                           HBD.CDetailID = txt4dh.Text.Trim();
                HBD.CWidth = TxtToDec(txt4cd.Text.Trim());
                HBD.CHigh = TxtToDec(txt4gd.Text.Trim());
                HBD.CTS = TxtToDec(txt4ts.Text.Trim());
                HBD.CPFS = TxtToDec(txt4pfs.Text.Trim());
                HBD.CDAdress = pictureBox4.Tag.ToString();
                        break;
                    case 5:
                           HBD.CDetailID = txt5dh.Text.Trim();
                HBD.CWidth = TxtToDec(txt5cd.Text.Trim());
                HBD.CHigh = TxtToDec(txt5gd.Text.Trim());
                HBD.CTS = TxtToDec(txt5ts.Text.Trim());
                HBD.CPFS = TxtToDec(txt5pfs.Text.Trim());
                HBD.CDAdress = pictureBox5.Tag.ToString();
                        break;
                    case 6:
                           HBD.CDetailID = txt6dh.Text.Trim();
                HBD.CWidth = TxtToDec(txt6cd.Text.Trim());
                HBD.CHigh = TxtToDec(txt6gd.Text.Trim());
                HBD.CTS = TxtToDec(txt6ts.Text.Trim());
                HBD.CPFS = TxtToDec(txt6pfs.Text.Trim());
                HBD.CDAdress = pictureBox6.Tag.ToString();
                        break;
                    default: break;
                    #endregion
                }

                db.DeleteBusiness_Detail(HBD);
                if (!db.InsertBusiness_Detail(HBD))
                    return false;
                else return true;
            }
            catch (Exception ex)
            {
                log.wrirteLog("主页面", "增加明细", ex.Message); return false;
            }
        }
コード例 #3
0
        /// <summary>
        /// 公司
        /// </summary>
        /// <param name="ue"></param>
        /// <returns></returns>
        public bool InsertBusiness_Detail(H_Bus_DetailEntity hce)
        {
            bool result = true;
              try
              {
              string SqlStr = "  " +
                  " Insert into H_Business_Detail (CCID,CDetailID,CWidth,CHigh,CTS, CPFS,CDAdress, DoTime) " +
                  " values(@c1,@c2,round(@c3,2),round(@c4,2),@c5,@c6,@c7,@8) ";
              OleDbParameter[] prams = {
                                                     new OleDbParameter("@c1", hce.CCID),
                                                     new OleDbParameter("@c2", hce.CDetailID),
                                                       new OleDbParameter("@c3", hce.CWidth),
                                                     new OleDbParameter("@c4", hce.CHigh),
                                                      new OleDbParameter("@c5", hce.CTS),
                                                      new OleDbParameter("@c6", hce.CPFS),
                                                      new OleDbParameter("@c7", hce.CDAdress),
                                                       new OleDbParameter("@c8", DateTime.Now.ToString())   };

              int intresult = AccessHelper.ExecuteNonQuery(strCon(), SqlStr, prams);
              if (intresult == 0) result = false;
              else result = true;

              }
              catch (Exception ex)
              {
              log.wrirteLog("数据库操作", "公司明细", ex.Message);
              result = false;
              }
              return result;
        }