//產品認證 public void ProductCheck(string EnterpriseID, string CheckUserName) { string strSql = string.Format("delete from EP_Product where Flag=1 and EnterpriseID='{0}';update EP_Product set Flag=1,BU_CheckDate=getdate(),BU_CheckUserName='******' where Flag=2 and EnterpriseID='{0}'", EnterpriseID, CheckUserName); ia.ExecuteNonQuerySql(strSql); //轉到企業用戶庫 strSql = string.Format("select * from EP_Product where Flag=1 and EnterpriseID='{0}'", EnterpriseID); DataTable dt = ia.ExecuteDataSetSql(strSql).Tables[0]; dt.TableName = "EP_Product"; for (int i = 0; i < dt.Rows.Count; i++) dt.Rows[i]["Flag"] = 5; string filter = string.Format("Flag=5 and EnterpriseID='{0}'", EnterpriseID); //寫入企業資料庫 SubBaseDao subDao = new SubBaseDao(EnterpriseID); subDao.Save(dt, filter); //刪除待驗證的產品 strSql = string.Format("delete from EP_Product where (Flag=2 or Flag=3) and EnterpriseID='{0}'", EnterpriseID); ea.ExecuteNonQuerySql(strSql); //原認證產品插入記錄 strSql = "Insert into EP_ProductRecord select * from EP_Product A where Flag=1 and exists(select * from EP_Product where Flag=5 and EnterpriseID=A.EnterpriseID and ProductID=A.ProductID)"; ea.ExecuteNonQuerySql(strSql); //原認證產品放在Flag=3 strSql = "update EP_Product set Flag=3 from EP_Product A where Flag=1 and exists(select * from EP_Product where Flag=5 and EnterpriseID=A.EnterpriseID and ProductID=A.ProductID)"; ea.ExecuteNonQuerySql(strSql); //新認證的產品寫入 strSql = string.Format("update EP_Product set Flag=1 where Flag=5 and EnterpriseID='{0}'", EnterpriseID); ea.ExecuteNonQuerySql(strSql); }
//上傳到營運庫 public void UpoladBusinessUnit(string EnterpriseID, string UserName) { string strSql = string.Format("select * from {0} where Flag=2 and EnterpriseID='{1}'", SysModel.TableName, EnterpriseID); DataTable dt = ea.ExecuteDataSetSql(strSql).Tables[0]; dt.TableName = SysModel.TableName; string filter = string.Format("Flag=2 and EnterpriseID='{0}'", EnterpriseID); //寫入營運資料庫 SubBaseDao subDao = new SubBaseDao(); subDao.Save(dt, filter); //更新上傳人員上傳日期 strSql = string.Format("update {0} set UploadUserName='******',UploadDate=getdate(),State=3 where Flag=2 and EnterpriseID='{2}' and State=2", SysModel.TableName, UserName,EnterpriseID); ea.ExecuteNonQuerySql(strSql); ia.ExecuteNonQuerySql(strSql); }
//寫入EP_Product public void SaveProductLogistics(DataTable dt, string UserName) { string filter = string.Format("UserName='******'", UserName); SubBaseDao subDao = new SubBaseDao(cnKey); subDao.Save(dt, filter); //更新創建用戶、日期 string strSql = "update EP_ProductLogisticsTemp set CreateDate=EP_ProductLogistics.CreateDate,CreateUserName=EP_ProductLogistics.CreateUserName from EP_ProductLogisticsTemp inner join EP_ProductLogistics On EP_ProductLogisticsTemp.EnterpriseID=EP_ProductLogistics.EnterpriseID and EP_ProductLogisticsTemp.LogisticsID=EP_ProductLogistics.LogisticsID and EP_ProductLogisticsTemp.Flag=1"; ea.ExecuteNonQuerySql(strSql); strSql = string.Format("delete from EP_ProductLogistics where Flag=2 and exists(select * from EP_ProductLogisticsTemp where EnterpriseID = EP_ProductLogistics.EnterpriseID and LogisticsID=EP_ProductLogistics.LogisticsID and UserName='******')", UserName); ea.ExecuteNonQuerySql(strSql); strSql = string.Format("insert into EP_ProductLogistics( Flag, EnterpriseID, EnterpriseName, LogisticsID, ProductID, ProductName, Area, Description, " + "EPLogisticsID, LogisticsOfficalUrl, CreateDate, CreateUserName, LastModifyDate, LastModifyUserName) " + "select 2,A.EnterpriseID, A.EnterpriseName, A.LogisticsID, A.ProductID, B.ProductName, A.Area, A.Description, " + "A.EPLogisticsID, A.LogisticsOfficalUrl, A.CreateDate, A.CreateUserName, getdate(), '{0}' " + "from EP_ProductLogisticsTemp A " + "inner join EP_Product B On A.EnterpriseID=B.EnterpriseID and A.ProductID=B.ProductID and B.Flag=1 " + "where A.UserName='******' and A.EnterpriseID<>''", UserName); ea.ExecuteNonQuerySql(strSql); //刪除臨時資料 strSql = string.Format("delete from EP_ProductLogisticsTemp where UserName='******'", UserName); ea.ExecuteNonQuerySql(strSql); }
//寫入EP_Product public void SaveProductResume(DataTable dt, string UserName) { string filter = string.Format("UserName='******'", UserName); SubBaseDao subDao = new SubBaseDao(cnKey); subDao.Save(dt, filter); //更新創建用戶、日期 string strSql = "update EP_ProductResumeTemp set CreateDate=EP_ProductResume.CreateDate,CreateUserName=EP_ProductResume.CreateUserName from EP_ProductResumeTemp inner join EP_ProductResume On EP_ProductResumeTemp.EnterpriseID=EP_ProductResume.EnterpriseID and EP_ProductResumeTemp.ResumeID=EP_ProductResume.ResumeID and EP_ProductResume.Flag=1"; ea.ExecuteNonQuerySql(strSql); strSql = string.Format("delete from EP_ProductResume where Flag=2 and exists(select * from EP_ProductResumeTemp where EnterpriseID = EP_ProductResume.EnterpriseID and ResumeID=EP_ProductResume.ResumeID and UserName='******')", UserName); ea.ExecuteNonQuerySql(strSql); //過濾存在的產品 strSql = string.Format("insert into EP_ProductResume(Flag, EnterpriseID, EnterpriseName, ResumeID, ProductID, ProductName, ProduceDate, HasGarantee, GaranteeDate, " + "OfficalUrl, ServicePhone, Description, ResumeOfficalUrl, EPResumeID, CreateDate, CreateUserName, LastModifyDate, LastModifyUserName) " + "select 2,A.EnterpriseID, A.EnterpriseName, A.ResumeID, A.ProductID, B.ProductName, A.ProduceDate, A.HasGarantee, A.GaranteeDate, " + "A.OfficalUrl, A.ServicePhone, A.Description, A.ResumeOfficalUrl, A.EPResumeID, A.CreateDate, A.CreateUserName, getdate(), '{0}' " + "from Ep_ProductResumeTemp A " + "inner join EP_Product B On A.EnterpriseID=B.EnterpriseID and A.ProductID=B.ProductID and B.Flag=1 " + "where A.UserName='******' and A.EnterpriseID<>''", UserName); ea.ExecuteNonQuerySql(strSql); //刪除臨時資料 strSql = string.Format("delete from Ep_ProductResumeTemp where UserName='******'", UserName); ea.ExecuteNonQuerySql(strSql); }
//寫入EP_Product public void SaveProduct(DataTable dt, string UserName) { string filter = string.Format("UserName='******'", UserName); SubBaseDao subDao = new SubBaseDao(cnKey); subDao.Save(dt, filter); //更新創建用戶、日期 string strSql = "update EP_ProductTemp set CreateDate=EP_Product.CreateDate,CreateUserName=EP_Product.CreateUserName from EP_ProductTemp inner join EP_Product On EP_ProductTemp.EnterpriseID=EP_Product.EnterpriseID and EP_ProductTemp.ProductID=EP_Product.ProductID and EP_Product.Flag=1"; ea.ExecuteNonQuerySql(strSql); strSql = string.Format("delete from EP_Product where Flag=2 and exists(select * from EP_ProductTemp where EnterpriseID = EP_Product.EnterpriseID and ProductID=EP_Product.ProductID and UserName='******')", UserName); ea.ExecuteNonQuerySql(strSql); strSql = string.Format("insert into EP_Product(Flag, EnterpriseID, EnterpriseName, ProductID, ProductName, ProductEName, GroupName, ClassName, " + "Barcode1, Barcode2, Description, OfficalUrl, ServicePhone, Memo, CreateDate, CreateUserName, LastModifyDate, LastModifyUserName) " + "select 2,EnterpriseID, EnterpriseName, ProductID, ProductName, ProductEName, GroupName, ClassName, " + "Barcode1, Barcode2, Description, OfficalUrl, ServicePhone, Memo, CreateDate, CreateUserName, getdate(), '{0}' " + "from Ep_ProductTemp where UserName='******' and EnterpriseID<>''", UserName); ea.ExecuteNonQuerySql(strSql); //刪除臨時資料 strSql = string.Format("delete from Ep_ProductTemp where UserName='******'", UserName); ea.ExecuteNonQuerySql(strSql); }