Example #1
0
        public bool ProgrammeSave(Programme obj)
        {
            var retVal   = true;
            var procName = (obj.IsNew ? "dbo.OXO_Programme_New" : "dbo.OXO_Programme_Edit");

            using (var conn = DbHelper.GetDBConnection())
            {
                try
                {
                    obj.Save(CurrentCDSID);

                    var para = new DynamicParameters();

                    // para.Add("@p_AKA", obj.AKA, dbType: DbType.String, size: 500);
                    para.Add("@p_Notes", obj.Notes, DbType.String, size: 2000);
                    para.Add("@p_Product_Manager", obj.ProductManager, DbType.String, size: 8);
                    para.Add("@p_RSG_UID", obj.RSGUID, DbType.String, size: 500);
                    para.Add("@p_Active", obj.Active, DbType.Boolean);
                    para.Add("@p_Created_By", obj.CreatedBy, DbType.String, size: 8);
                    para.Add("@p_Created_On", obj.CreatedOn, DbType.DateTime);
                    para.Add("@p_Updated_By", obj.UpdatedBy, DbType.String, size: 8);
                    para.Add("@p_Last_Updated", obj.LastUpdated, DbType.DateTime);
                    para.Add("@p_Id", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);

                    conn.Execute(procName, para, commandType: CommandType.StoredProcedure);

                    if (obj.Id == 0)
                    {
                        obj.Id = para.Get <int>("@p_Id");
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }

            return(retVal);
        }
        public bool ProgrammeSave(Programme obj)
        {
            var retVal = true;
            var procName = (obj.IsNew ? "dbo.OXO_Programme_New" : "dbo.OXO_Programme_Edit");

            using (var conn = DbHelper.GetDBConnection())
            {
                try
                {
                    obj.Save(CurrentCDSID);
 
                    var para = new DynamicParameters();

                   // para.Add("@p_AKA", obj.AKA, dbType: DbType.String, size: 500);
                    para.Add("@p_Notes", obj.Notes, DbType.String, size: 2000);
                    para.Add("@p_Product_Manager", obj.ProductManager, DbType.String, size: 8);
                    para.Add("@p_RSG_UID", obj.RSGUID, DbType.String, size: 500);
                    para.Add("@p_Active", obj.Active, DbType.Boolean);
                    para.Add("@p_Created_By", obj.CreatedBy, DbType.String, size: 8);
                    para.Add("@p_Created_On", obj.CreatedOn, DbType.DateTime);
                    para.Add("@p_Updated_By", obj.UpdatedBy, DbType.String, size: 8);
                    para.Add("@p_Last_Updated", obj.LastUpdated, DbType.DateTime);
                    para.Add("@p_Id", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);

                    conn.Execute(procName, para, commandType: CommandType.StoredProcedure);

                    if (obj.Id == 0)
                    {
                        obj.Id = para.Get<int>("@p_Id");
                    }

                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }

            return retVal;
            
        }