示例#1
0
 public void UpdateSarfStatus(Sarf sarf)
 {
     using (MySqlConnection cn = new MySqlConnection(connString))
     {
         try
         {
             string query = "update sarf set SarfStatus='" + sarf.SarfStatus +
                            "' where SarfId='" + sarf.Id + "';";
             cn.Open();
             using (MySqlCommand cmd = new MySqlCommand(query, cn))
             {
                 cmd.ExecuteNonQuery();
             }
         }
         catch (Exception ex)
         {
             throw new Exception("Data Error : " + ex.Message);
         }
         finally
         {
             if (cn.State == System.Data.ConnectionState.Open)
             {
                 cn.Close();
             }
         }
     }
 }
示例#2
0
 public void UpdateSarf(Sarf sarf)
 {
     using (MySqlConnection cn = new MySqlConnection(connString))
     {
         try
         {
             string query = "update sarf set SarfName='" + sarf.SarfName + "',FA_Code='" +
                            sarf.FACode + "',Search_Ring_ID='" + sarf.SearchRingId + "',iPlan_Job='" +
                            sarf.IPlanJob + "',Pace='" + sarf.PaceNumber + "',Market='" + sarf.Market +
                            "',County='" + sarf.County + "',FA_Type='" + sarf.FAType +
                            "', ProcessInstanceID='" + sarf.ProcessInstanceID +
                            "', SarfStatus='" + sarf.SarfStatus +
                            "',Market_Cluster='" + sarf.MarketCluster + "',Region='" + sarf.Region +
                            "',RF_Design_Engineer_ATTUID='" + sarf.RFDesignEnggId + "' where SarfId='" +
                            sarf.Id + "';";
             cn.Open();
             using (MySqlCommand cmd = new MySqlCommand(query, cn))
             {
                 cmd.ExecuteNonQuery();
             }
         }
         catch (Exception ex)
         {
             throw new Exception("Data Error : " + ex.Message);
         }
         finally
         {
             if (cn.State == System.Data.ConnectionState.Open)
             {
                 cn.Close();
             }
         }
     }
 }
 public HttpResponseMessage UpdateSarfStatus([FromBody] Sarf sarf)
 {
     try
     {
         sarfDao.UpdateSarfStatus(sarf);
         return(WrapObjectToHttpResponse(1));
     }
     catch (Exception ex)
     {
         throw new Exception("Error : " + ex.Message);
     }
 }
 public HttpResponseMessage UpdateSarf([FromBody] Sarf sarf)
 {
     try
     {
         sarf.CreatedDate = DateTime.Now;
         sarfDao.UpdateSarf(sarf);
         return(WrapObjectToHttpResponse(1));
     }
     catch (Exception ex)
     {
         throw new Exception("Error : " + ex.Message);
     }
 }
 public HttpResponseMessage PostSarf([FromBody] Sarf sarf)
 {
     try
     {
         sarf.CreatedDate = DateTime.Now;
         transId          = sarfDao.SaveSarf(sarf);
         isValidArea      = sarf.IsValidArea;
         return(WrapObjectToHttpResponse(transId));
     }
     catch (Exception ex)
     {
         throw new Exception("Error : " + ex.Message);
     }
 }
示例#6
0
 public long SaveSarf(Sarf sarf)
 {
     using (MySqlConnection cn = new MySqlConnection(connString))
     {
         try
         {
             long   id    = 0;
             string query = "INSERT INTO SARF(SarfName,DateCreated,ProcessInstanceID, " +
                            "SarfStatus, AtollSiteName, FA_Code, Search_Ring_ID, iPlan_Job, " +
                            "Pace, Market, County, FA_Type, Market_Cluster, Region, RF_Design_Engineer_ATTUID) VALUES(" +
                            "?SarfName,?DateCreated,?ProcessInstanceID, ?SarfStatus, " +
                            "?AtollSiteName, ?FA_Code, ?Search_Ring_ID, ?iPlan_Job, ?Pace, ?Market," +
                            "?County, ?FA_Type, ?Market_Cluster, ?Region, ?RF_Design_Engineer_ATTUID);";
             cn.Open();
             using (MySqlCommand cmd = new MySqlCommand(query, cn))
             {
                 cmd.Parameters.Add("?SarfName", MySqlDbType.VarChar).Value          = sarf.SarfName;
                 cmd.Parameters.Add("?DateCreated", MySqlDbType.DateTime).Value      = sarf.CreatedDate;
                 cmd.Parameters.Add("?ProcessInstanceID", MySqlDbType.VarChar).Value = sarf.ProcessInstanceID;
                 cmd.Parameters.Add("?SarfStatus", MySqlDbType.VarChar).Value        = sarf.SarfStatus;
                 cmd.Parameters.Add("?AtollSiteName", MySqlDbType.VarChar).Value     = sarf.AtollSiteName;
                 cmd.Parameters.Add("?FA_Code", MySqlDbType.VarChar).Value           = sarf.FACode;
                 cmd.Parameters.Add("?Search_Ring_ID", MySqlDbType.VarChar).Value    = sarf.SearchRingId;
                 cmd.Parameters.Add("?iPlan_Job", MySqlDbType.VarChar).Value         = sarf.IPlanJob;
                 cmd.Parameters.Add("?Pace", MySqlDbType.VarChar).Value                      = sarf.PaceNumber;
                 cmd.Parameters.Add("?Market", MySqlDbType.VarChar).Value                    = sarf.Market;
                 cmd.Parameters.Add("?County", MySqlDbType.VarChar).Value                    = sarf.County;
                 cmd.Parameters.Add("?FA_Type", MySqlDbType.VarChar).Value                   = sarf.FAType;
                 cmd.Parameters.Add("?Market_Cluster", MySqlDbType.VarChar).Value            = sarf.MarketCluster;
                 cmd.Parameters.Add("?Region", MySqlDbType.VarChar).Value                    = sarf.Region;
                 cmd.Parameters.Add("?RF_Design_Engineer_ATTUID", MySqlDbType.VarChar).Value = sarf.RFDesignEnggId;
                 cmd.ExecuteNonQuery();
                 id = cmd.LastInsertedId;
             }
             return(id);
         }
         catch (Exception ex)
         {
             throw new Exception("Data Error : " + ex.Message);
         }
         finally
         {
             if (cn.State == System.Data.ConnectionState.Open)
             {
                 cn.Close();
             }
         }
     }
 }