Ejemplo n.º 1
0
 /// <summary>
 /// �ֶ���ӵ���ϸ��
 /// </summary>
 /// <param name="infoTableName"></param>
 /// <param name="id"></param>
 /// <param name="bill"></param>
 /// <param name="product"></param>
 /// <param name="quantity"></param>
 /// <param name="isUpdate"></param>
 /// <param name="queryTable"></param>
 public void InsertDetail(string infoTableName, string id, string bill, string product, decimal quantity, bool isUpdate, string billDetailTable)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         UpdateUploadDao dao = new UpdateUploadDao();
         dao.SetPersistentManager(persistentManager);
         DataTable productTable = dao.ProductRate(product);
         decimal quan = Convert.ToDecimal(quantity * Convert.ToInt32(productTable.Rows[0]["JIANRATE"].ToString()) / Convert.ToInt32(productTable.Rows[0]["TIAORATE"].ToString()));
         if (isUpdate)
         {
             Thread.Sleep(500);//ȷ�������Ѿ����
             //string sql = string.Format("SELECT ID FROM {2} WHERE PRODUCTCODE='{0}' AND BILLNO='{1}'", product, bill, billDetailTable);
             //string stokeId = dao.GetDate(sql).ToString();
             DataTable table = dao.QueryBusiBill(infoTableName);
             DataRow newRow = table.NewRow();
             newRow["STORE_BILL_DETAIL_ID"] = id;
             newRow["STORE_BILL_ID"] = bill.ToString().Trim();
             newRow["BRAND_CODE"] = product;
             newRow["BRAND_NAME"] = this.QueryProduceName(product).ToString();
             newRow["QUANTITY"] = quan;
             newRow["IS_IMPORT"] = "0";
             newRow["BILL_TYPE"] = "1001";
             table.Rows.Add(newRow);
             dao.InsertMaster(infoTableName, table);
         }
         else
         {
             string productname = this.QueryProduceName(product).ToString();
             string sql = string.Format("UPDATE {0} SET STORE_BILL_ID='{1}',BRAND_CODE='{2}',BRAND_NAME='{3}',QUANTITY='{4}' WHERE STORE_BILL_DETAIL_ID='{5}'",
                 infoTableName, bill, product, productname, Convert.ToDecimal(quan), id.ToString());
             dao.UpdateTable(sql);
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// �ֶ���ӵ�������
 /// </summary>
 /// <param name="infoTableName"></param>
 /// <param name="bill"></param>
 /// <param name="type"></param>
 /// <param name="state"></param>
 /// <param name="operate"></param>
 /// <param name="isUpdate"></param>
 public void InsertBillMaster(string infoTableName, string bill, string type, string state, string operate, bool isUpdate)
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         UpdateUploadDao dao = new UpdateUploadDao();
         dao.SetPersistentManager(persistentManager);
         if (isUpdate)
         {
             DataTable table = dao.QueryBusiBill(infoTableName);
             DataRow newRow = table.NewRow();
             newRow["STORE_BILL_ID"] = bill.ToString().Trim();
             newRow["DIST_CTR_CODE"] = dao.GetCompany().ToString();
             newRow["AREA_TYPE"] = "0901";
             newRow["CREATOR_CODE"] = operate;
             newRow["CREATE_DATE"] = DateTime.Now.ToString("yyyyMMddHHmmss");
             newRow["IN_OUT_TYPE"] = "1202";
             newRow["BILL_TYPE"] = type;
             newRow["BILL_STATUS"] = state;
             newRow["DISUSE_STATUS"] = "0";
             newRow["IS_IMPORT"] = "0";
             table.Rows.Add(newRow);
             dao.InsertMaster(infoTableName, table);
         }
         else
         {
             string sql = string.Format("UPDATE {0} SET CREATE_DATE='{2}',BILL_TYPE='{3}',BILL_STATUS='{4}' WHERE STORE_BILL_ID='{5}'",
                 infoTableName, operate, DateTime.Now.ToString("yyyyMMddHHmmss"), type, state, bill);
             dao.UpdateTable(sql);
         }
     }
 }