public JObject CreateStudio(String connection, UDC.Studio studio) { try { JObject jsonObj = default(JObject); jsonObj = new JObject(); jsonObj = JObject.Parse(studio.StudioData); List <JToken> results = jsonObj.Children().ToList(); ArrayList new_nodes = new ArrayList(); DataTable table = new DataTable("temp_ivr_flows"); DataColumn col1 = new DataColumn("node_id", System.Type.GetType("System.Int32")); DataColumn col2 = new DataColumn("node_type", System.Type.GetType("System.String")); DataColumn col3 = new DataColumn("xml_data", System.Type.GetType("System.String")); table.Columns.Add(col1); table.Columns.Add(col2); table.Columns.Add(col3); int i = 1; foreach (JProperty item in results) { new_nodes.Add(Convert.ToInt32(item.Name)); object[] val = new object[3]; val[0] = item.Name; val[1] = item.Value["type"].ToString(); val[2] = item.Value["data"].ToString(); table.Rows.Add(val); i = i + 1; } XmlDocument xmlobj = new XmlDocument(); xmlobj.LoadXml(studio.StudioXml); Press3.DataAccessLayer.Studio studioObj = new Press3.DataAccessLayer.Studio(connection); DataSet ds = studioObj.CreateOrUpdateStudio(studio, table); if (ds == null) { helper.CreateProperty(UDC.Label.MESSAGE, "No data returned from database"); helper.CreateProperty(UDC.Label.SUCCESS, false); } else { helper.ParseDataSet(ds); } } catch (Exception ex) { Logger.Error("Exception In BAL.CreateStudio " + ex.ToString()); } return(helper.GetResponse()); }
public DataSet CreateOrUpdateStudio(UDC.Studio studio, DataTable nodesData) { _cmd = new SqlCommand(); _ds = new DataSet(); _da = new SqlDataAdapter(); try { _cmd.CommandText = "CreateOrUpdateStudio"; _cmd.CommandType = CommandType.StoredProcedure; _cmd.Connection = Connection; _cmd.Parameters.Add("@AccountId", SqlDbType.Int).Value = studio.AccountId; _cmd.Parameters.Add("@AgentId", SqlDbType.Int).Value = studio.AgentId; _cmd.Parameters.Add("@StudioId", SqlDbType.Int).Value = studio.Id; _cmd.Parameters.Add("@StudioName", SqlDbType.VarChar, 100).Value = studio.Name; _cmd.Parameters.Add("@StudioXml", SqlDbType.VarChar, -1).Value = studio.StudioXml; _cmd.Parameters.Add("@IvrStudioNodesData", SqlDbType.Structured).Value = nodesData; _cmd.Parameters.Add("@DeletedNodes", SqlDbType.VarChar, 1000).Value = studio.DeletedNodeIds; //_cmd.Parameters.Add("@IsOutbound", SqlDbType.Int).Value = studio.IsOutbound; //_cmd.Parameters.Add("@CallerId", SqlDbType.Int).Value = studio.CallerIdId; _cmd.Parameters.Add("@IsActive", SqlDbType.Int).Value = studio.IsActive; _cmd.Parameters.Add("@Message", SqlDbType.VarChar, 500).Direction = ParameterDirection.Output; _cmd.Parameters.Add("@Success", SqlDbType.Bit).Direction = ParameterDirection.Output; _cmd.Parameters.Add("@RetStudioId", SqlDbType.Int).Direction = ParameterDirection.Output; Connection.Open(); _cmd.ExecuteNonQuery(); Connection.Close(); _ds.Tables.Add(_helper.ConvertOutputParametersToDataTable(_cmd.Parameters)); } catch (Exception ex) { Logger.Error(ex.ToString()); throw; } finally { _cmd = null; Connection.Close(); } return(_ds); }
public JObject CreateOrUpdateStudioGenericDetails(String connection, UDC.Studio studio) { try { Press3.DataAccessLayer.Studio studioObj = new Press3.DataAccessLayer.Studio(connection); DataSet ds = studioObj.CreateOrUpdateStudioGenericDetails(studio); if (ds == null) { helper.CreateProperty(UDC.Label.MESSAGE, "No data returned from database"); helper.CreateProperty(UDC.Label.SUCCESS, false); } else { helper.ParseDataSet(ds); } } catch (Exception ex) { Logger.Error("Exception In BAL.CreateOrUpdateStudioGenericDetails " + ex.ToString()); } return(helper.GetResponse()); }