using CallCenterApi.DB;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CallCenterApi.DAL
{
    /// <summary>
	/// 数据访问类:T_Bus_WorkOrder_GriddingWO_logs
	/// </summary>
	public partial class T_Bus_WorkOrder_GriddingWO_logs
    {
        public T_Bus_WorkOrder_GriddingWO_logs()
        { }
        #region  Method

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(CallCenterApi.Model.T_Bus_WorkOrder_GriddingWO_logs model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into T_Bus_WorkOrder_GriddingWO_logs(");
            strSql.Append("F_WorkOrderId,F_Result,F_Usercode,F_dealman,F_Files,F_ProSituation,F_DealContact,F_ConnectTime,F_ConnectMode,F_Duties,F_Situation,F_State,F_FeedbackID,F_IsProResult,F_IsSatisfied,F_uuid,F_port_password,F_MapID,F_Direction,F_AddTime,F_Message)");
            strSql.Append(" values (");
            strSql.Append("@F_WorkOrderId,@F_Result,@F_Usercode,@F_dealman,@F_Files,@F_ProSituation,@F_DealContact,@F_ConnectTime,@F_ConnectMode,@F_Duties,@F_Situation,@F_State,@F_FeedbackID,@F_IsProResult,@F_IsSatisfied,@F_uuid,@F_port_password,@F_MapID,@F_Direction,@F_AddTime,@F_Message)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@F_WorkOrderId", SqlDbType.NVarChar,50),
                    new SqlParameter("@F_Result", SqlDbType.NVarChar),
                    new SqlParameter("@F_Usercode", SqlDbType.NVarChar,50),
                    new SqlParameter("@F_dealman", SqlDbType.NVarChar,50),
                    new SqlParameter("@F_Files", SqlDbType.VarChar,500),
                    new SqlParameter("@F_ProSituation", SqlDbType.NVarChar),
                    new SqlParameter("@F_DealContact", SqlDbType.NVarChar,200),
                    new SqlParameter("@F_ConnectTime", SqlDbType.NVarChar,200),
                    new SqlParameter("@F_ConnectMode", SqlDbType.NVarChar,500),
                    new SqlParameter("@F_Duties", SqlDbType.NVarChar,200),
                    new SqlParameter("@F_Situation", SqlDbType.NVarChar),
                    new SqlParameter("@F_State", SqlDbType.Int,4),
                    new SqlParameter("@F_FeedbackID", SqlDbType.Int,4),
                    new SqlParameter("@F_IsProResult", SqlDbType.Int,4),
                    new SqlParameter("@F_IsSatisfied", SqlDbType.Int,4),
                    new SqlParameter("@F_uuid", SqlDbType.NVarChar,50),
                    new SqlParameter("@F_port_password", SqlDbType.NVarChar,200),
                    new SqlParameter("@F_MapID", SqlDbType.Int,4),
                    new SqlParameter("@F_Direction", SqlDbType.NVarChar,20),
                    new SqlParameter("@F_AddTime", SqlDbType.DateTime),
                    new SqlParameter("@F_Message", SqlDbType.NVarChar)};
            parameters[0].Value = model.F_WorkOrderId;
            parameters[1].Value = model.F_Result;
            parameters[2].Value = model.F_Usercode;
            parameters[3].Value = model.F_dealman;
            parameters[4].Value = model.F_Files;
            parameters[5].Value = model.F_ProSituation;
            parameters[6].Value = model.F_DealContact;
            parameters[7].Value = model.F_ConnectTime;
            parameters[8].Value = model.F_ConnectMode;
            parameters[9].Value = model.F_Duties;
            parameters[10].Value = model.F_Situation;
            parameters[11].Value = model.F_State;
            parameters[12].Value = model.F_FeedbackID;
            parameters[13].Value = model.F_IsProResult;
            parameters[14].Value = model.F_IsSatisfied;
            parameters[15].Value = model.F_uuid;
            parameters[16].Value = model.F_port_password;
            parameters[17].Value = model.F_MapID;
            parameters[18].Value = model.F_Direction;
            parameters[19].Value = model.F_AddTime;
            parameters[20].Value = model.F_Message;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        #endregion  Method
    }
}
