示例#1
0
 public string SaveBulkAcr(DataTable dt)
 {
     AcrController objAcrController = new AcrController();
     string sConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["connectionString"].ToString();
     string lblMessage = "";
     try
     {
         SqlConnection sqlconn = new SqlConnection(sConnectionString);
         sqlconn.Open();
         SqlBulkCopy bulkCopy = new SqlBulkCopy(sqlconn);
         bulkCopy.DestinationTableName = "AcrBulkTemp";
         bulkCopy.WriteToServer(dt);
         int Status = objAcrController.SaveBulkAcr();
         //string strQuery = "UPDATE AcrBulk SET ModelMappingID =( SELECT Production.ModelMappingID FROM Production WHERE Production.SerialNo = Convert(varchar,AcrBulk.Tractor_No)) WHERE EXISTS ( SELECT Production.ModelMappingID FROM Production WHERE Production.SerialNo = Convert(varchar,AcrBulk.Tractor_No))";
         string strQuery = "Update AcrBulk set ModelMappingID = Production.ModelMappingID  from AcrBulk inner join Production on Convert(varchar,AcrBulk.Tractor_No) = Production.SerialNo ";
         objController.ExecuteQuery(strQuery);
         if (Status == 0)
         {
             lblMessage = "File Acr saved successfully";
         }
         else
         {
             lnkExceptions.Visible = true;
             lblMessage = "File Acr could not be saved successfully";
         }
     }
     catch
     {
         lnkExceptions.Visible = true;
         lblMessage = "File Acr could not be saved successfully";
     }
     return lblMessage;
 }
示例#2
0
    public string SaveBulkAcr()
    {
        AcrController objAcrController = new AcrController();
        string sConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["connectionString"].ToString();
        string lblMessage = "";
        try
        {

            int Status = objAcrController.SaveBulkAcr();
            string strQuery = "Update AcrBulk set ModelMappingID = Production.ModelMappingID  from AcrBulk inner join Production on Convert(varchar,AcrBulk.Tractor_No) = Production.SerialNo";
            //string strQuery = "UPDATE AcrBulk SET ModelMappingID =( SELECT Production.ModelMappingID FROM Production WHERE Production.SerialNo = Convert(varchar,AcrBulk.Tractor_No)) WHERE EXISTS ( SELECT Production.ModelMappingID FROM Production WHERE Production.SerialNo = Convert(varchar,AcrBulk.Tractor_No))";
            objQuerycontroller.ExecuteQuery(strQuery);
            if (Status == 0)
            {
                lblMessage = "File Acr saved successfully";
            }
            else
            {
                lblMessage = "File Acr could not be saved successfully";
            }
        }
        catch
        {
            lblMessage = "File Acr could not be saved successfully";
        }
        return lblMessage;
    }